def add_remote(new)
      # Cannot have both a tag and a version defined for a remote
      if ([:tag, :version] - new.keys).empty?
        Origen.log.error('Cannot define both a tag and a version for a remote!')
        fail
      end
      name = name_of(new)
      # If the current remote has been imported by one of it's dev dependencies
      # then always use the local workspace
      if name == @current_app_name
        new = @current_app
      end
      existing = remotes[name]
      if existing
        if new[:path]
          if existing[:path]
            if existing[:path] != new[:path]
              Origen.log.error 'Cannot resolve remote dependencies due to conflicting paths:'
              Origen.log.error "  #{name}:"
              Origen.log.error "    - #{existing[:path]}"
              Origen.log.error "    - #{new[:path]}"
              Origen.log.error ''
              fail 'Remote error!'
            end
          else
            remotes[name] = new
          end
        elsif existing[:version] != new[:version]
          existing_version = Origen::VersionString.new(existing[:version])
          if existing_version.less_than?(new[:version])
            remotes[name] = new
          end
        end
      else
        remotes[name] = new
      end
    end
def add_remote(new)
      # Cannot have both a tag and a version defined for a remote
      if ([:tag, :version] - new.keys).empty?
        Origen.log.error('Cannot define both a tag and a version for a remote!')
        fail
      end
      name = name_of(new)
      # If the current remote has been imported by one of it's dev dependencies
      # then always use the local workspace
      if name == @current_app_name
        new = @current_app
      end
      existing = remotes[name]
      if existing
        if new[:path]
          if existing[:path]
            if existing[:path] != new[:path]
              Origen.log.error 'Cannot resolve remote dependencies due to conflicting paths:'
              Origen.log.error "  #{name}:"
              Origen.log.error "    - #{existing[:path]}"
              Origen.log.error "    - #{new[:path]}"
              Origen.log.error ''
              fail 'Remote error!'
            end
          else
            remotes[name] = new
          end
        elsif existing[:version] != new[:version]
          existing_version = Origen::VersionString.new(existing[:version])
          if existing_version.less_than?(new[:version])
            remotes[name] = new
          end
        end
      else
        remotes[name] = new
      end
    end
Conflicts are resolved by the following rules:
   * A path reference always wins.
   * If two different paths are found an errors will be raised.
   * If multiple versions of the same remote are found the most
     recent one wins.