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.
519308
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
902427
function resolveConflicts(strategy, packages) {
  const { name, version } = packages.sort(strategy)[0];
  return { name, version };
}
1169460
@Override
  public boolean intersects(IVersionRange yourRange)
  {
    // If the supplied set is a version set, let it deal with it
    if (yourRange instanceof VersionSet) {
      return yourRange.intersects(this);
    }
    // If the other range is a simple range, then we can just check the extremities
    // to see if they overlap
    else if (yourRange instanceof VersionRange) {
      IVersion useMyVersion = null;
      switch (operator) {
        case ">":
          useMyVersion = version.getNextVersion();
          break;
        case "<":
          useMyVersion = version.getPrevVersion();
          break;
        default:
          useMyVersion = version;
          break;
      }
      if (yourRange.contains(useMyVersion)) {
        return true;
      }

      IVersion useYourVersion = null;
      switch (((VersionRange) yourRange).operator) {
        case ">":
          useYourVersion = ((VersionRange) yourRange).version.getNextVersion();
          break;
        case "<":
          useYourVersion = ((VersionRange) yourRange).version.getPrevVersion();
          break;
        default:
          useYourVersion = ((VersionRange) yourRange).version;
          break;
      }
      if (this.contains(useYourVersion)) {
        return true;
      }

      // Special case: Versions right next to each other >1.2.6 & <1.2.7
      // There may be micro-versions or snapshot versions between them
      if (this.version.equals(useYourVersion) && ((VersionRange) yourRange).version.equals(useMyVersion)) {
        return true;
      }
    }
    // Logical ranges need to be broken down
    else if (yourRange instanceof AndRange) {
      return yourRange.intersects(this);
    }
    else if (yourRange instanceof OrRange) {
      return yourRange.intersects(this);
    }
    else {
      throw new UnsupportedOperationException();
    }
    return false;
  }
740574
def file_resolve(backend, filepath):
    
    recipe = DKRecipeDisk.find_recipe_name()
    if recipe is None:
        raise click.ClickException('You must be in a recipe folder.')

    click.secho("%s - Resolving conflicts" % get_datetime())

    for file_to_resolve in filepath:
        if not os.path.exists(file_to_resolve):
            raise click.ClickException('%s does not exist' % file_to_resolve)
        check_and_print(DKCloudCommandRunner.resolve_conflict(file_to_resolve))
695154
def conflict(request, target=None, template_name='409.html'):
    
    try:
        template = loader.get_template(template_name)
    except TemplateDoesNotExist:  # pragma: no cover
        template = Template(
            '<h1>Conflict</h1>'
            '<p>The request was unsuccessful due to a conflict. '
            'The object changed during the transaction.</p>')
    try:
        saved = target.__class__._default_manager.get(pk=target.pk)
    except target.__class__.DoesNotExist:  # pragma: no cover
        saved = None
    ctx = {'target': target,
           'saved': saved,
           'request_path': request.path}

    return ConflictResponse(template.render(ctx))
78602
def check_no_overlapping_paths(paths):
  """"""
  for path in paths:
    list_copy_without_path = list(paths)
    list_copy_without_path.remove(path)
    if path in list_copy_without_path:
      raise ValueError('{} appeared more than once. All paths must be unique.'.format(path))
    for p in list_copy_without_path:
      if path in p:
        raise ValueError('{} and {} have the same prefix. All paths must be unique and cannot overlap.'.format(path, p))
677370
private static void updateCheckConflict(
            Map<TemporalField, Long> fieldValues,
            TemporalField targetField,
            TemporalField changeField,
            long changeValue) {
        
        Long old = fieldValues.put(changeField, changeValue);
        if (old != null && changeValue != old.longValue()) {
            throw new DateTimeException(
                    "Conflict found: " + changeField + " " + old +
                    " differs from " + changeField + " " + changeValue +
                    " while resolving  " + targetField);
        }
    }
247656
private static boolean confirmNoFileConflicts(Set<UpdatedFile> updatedFiles1, Set<UpdatedFile> updatedFiles2) {

        for (Iterator<UpdatedFile> iter1 = updatedFiles1.iterator(); iter1.hasNext();) {
            UpdatedFile currFile1 = iter1.next();
            for (Iterator<UpdatedFile> iter2 = updatedFiles2.iterator(); iter2.hasNext();) {
                UpdatedFile currFile2 = iter2.next();
                if (currFile1.getId().equals(currFile2.getId())) {
                    return false;
                }
            }
        }
        return true;
    }
1019720
function resolve(baseUri, relativeUri) {
  // there are several kinds of relative urls:
  // 1. //foo - replaces everything from the domain on.  foo is a domain name
  // 2. foo - replaces the last part of the path, the whole query and fragment
  // 3. /foo - replaces the the path, the query and fragment
  // 4. ?foo - replace the query and fragment
  // 5. #foo - replace the fragment only

  var absoluteUri = baseUri.clone();
  // we satisfy these conditions by looking for the first part of relativeUri
  // that is not blank and applying defaults to the rest

  var overridden = relativeUri.hasScheme();

  if (overridden) {
    absoluteUri.setRawScheme(relativeUri.getRawScheme());
  } else {
    overridden = relativeUri.hasCredentials();
  }

  if (overridden) {
    absoluteUri.setRawCredentials(relativeUri.getRawCredentials());
  } else {
    overridden = relativeUri.hasDomain();
  }

  if (overridden) {
    absoluteUri.setRawDomain(relativeUri.getRawDomain());
  } else {
    overridden = relativeUri.hasPort();
  }

  var rawPath = relativeUri.getRawPath();
  var simplifiedPath = collapse_dots(rawPath);
  if (overridden) {
    absoluteUri.setPort(relativeUri.getPort());
    simplifiedPath = simplifiedPath
        && simplifiedPath.replace(EXTRA_PARENT_PATHS_RE, '');
  } else {
    overridden = !!rawPath;
    if (overridden) {
      // resolve path properly
      if (simplifiedPath.charCodeAt(0) !== 0x2f /* / */) {  // path is relative
        var absRawPath = collapse_dots(absoluteUri.getRawPath() || '')
            .replace(EXTRA_PARENT_PATHS_RE, '');
        var slash = absRawPath.lastIndexOf('/') + 1;
        simplifiedPath = collapse_dots(
            (slash ? absRawPath.substring(0, slash) : '')
            + collapse_dots(rawPath))
            .replace(EXTRA_PARENT_PATHS_RE, '');
      }
    } else {
      simplifiedPath = simplifiedPath
          && simplifiedPath.replace(EXTRA_PARENT_PATHS_RE, '');
      if (simplifiedPath !== rawPath) {
        absoluteUri.setRawPath(simplifiedPath);
      }
    }
  }

  if (overridden) {
    absoluteUri.setRawPath(simplifiedPath);
  } else {
    overridden = relativeUri.hasQuery();
  }

  if (overridden) {
    absoluteUri.setRawQuery(relativeUri.getRawQuery());
  } else {
    overridden = relativeUri.hasFragment();
  }

  if (overridden) {
    absoluteUri.setRawFragment(relativeUri.getRawFragment());
  }

  return absoluteUri;
}
174733
function() {
			if(resolve.isCore(path)) throw new Error();
			debug('  - standard');
			return resolve.sync(getPath(options.alternative && options.alternative[parts[0]]),resolverOptions);
		}
624952
def validate_target_remote_branch
      remote_path = File.join(config[:remote], config[:branch])

      remotes = []
      @gitrepo.remotes.each { |remote| remotes << remote.name }
      unless remotes.include?(remote_path)
        ui.error 'The remote/branch specified does not seem to exist.'
        exit 7
      end
    end
1115068
function ensurePathsExist(pathsList, cb) {
	async.eachLimit(pathsList, 10, function (pathItem, callback) {
		var absolutePath = path.resolve(pathItem);
		fs.stat(absolutePath, function (error, stats) {
			if (error) {
				return callback(new Error('Path does not exist: ' + absolutePath));
			}

			if (!stats.isDirectory()) {
				return callback(new Error('Path is not a directory: ' + absolutePath));
			}

			return callback();
		});
	}, cb);
}
870078
def on_conflict(self, pair):
        """"""
        # self._log_action("skip", "conflict", "!", pair.local, min_level=2)
        # print("on_conflict", pair)
        any_entry = pair.any_entry
        if not self._test_match_or_print(any_entry):
            return

        resolve = self._interactive_resolve(pair)

        if resolve == "skip":
            self._log_action("skip", "conflict", "*?*", any_entry)
            self._inc_stat("conflict_files_skipped")
            return

        if pair.local and pair.remote:
            assert pair.local.is_file()
            is_newer = pair.local > pair.remote
            if (
                resolve == "local"
                or (is_newer and resolve == "new")
                or (not is_newer and resolve == "old")
            ):
                self._log_action("copy", "conflict", "*>*", pair.local)
                self._copy_file(self.local, self.remote, pair.local)
            elif (
                resolve == "remote"
                or (is_newer and resolve == "old")
                or (not is_newer and resolve == "new")
            ):
                self._log_action("copy", "conflict", "*<*", pair.local)
                self._copy_file(self.remote, self.local, pair.remote)
            else:
                raise NotImplementedError
        elif pair.local:
            assert pair.local.is_file()
            if resolve == "local":
                self._log_action("restore", "conflict", "*>x", pair.local)
                self._copy_file(self.local, self.remote, pair.local)
            elif resolve == "remote":
                self._log_action("delete", "conflict", "*<x", pair.local)
                self._remove_file(pair.local)
            else:
                raise NotImplementedError
        else:
            assert pair.remote.is_file()
            if resolve == "local":
                self._log_action("delete", "conflict", "x>*", pair.remote)
                self._remove_file(pair.remote)
            elif resolve == "remote":
                self._log_action("restore", "conflict", "x<*", pair.remote)
                self._copy_file(self.remote, self.local, pair.remote)
            else:
                raise NotImplementedError
        return
524582
function resolve(path, root, resolver) {
  try {
    // Add a default value to each path part lacking a prefix.
    let nspath = path.replace(/\/(?!\.)([^\/:\(]+)(?=\/|$)/g, '/_default_:$1')
    return platformResolve(nspath, root, resolver)
  } catch (err) {
    return fallbackResolve(path, root)
  }
}
543077
private void resolveMaxAgeConflicts() {
        long lastModified = requestFile.lastModified();
        String maxAgeString = EMPTY_STRING_VALUE;
        String maxAge = maxAgeDirectives.get(Directive.MAX_AGE);
        String maxAgeMPlus = maxAgeDirectives.get(Directive.MAX_AGE_MPLUS);

        if (maxAgeMPlus != null) {
            String maxAgeMPlusValue = parseMaxAgeMplus(maxAgeMPlus, lastModified);
            if (maxAge != null) {
                maxAgeString = Long.parseLong(maxAge) < Long.parseLong(maxAgeMPlusValue) ? maxAge : maxAgeMPlusValue;
            } else {
                maxAgeString = maxAgeMPlusValue;
            }
        } else if (maxAge != null) {
            maxAgeString = maxAge;
        }
        maxAgeResolvedValue = Long.parseLong(maxAgeString);
        isMaxAgeResolved = true;
    }
535997
def conflicts_with(self, other):
        """"""
        if isinstance(other, Requirement):
            if (self.name_ != other.name_) or (self.range is None) \
                    or (other.range is None):
                return False
            elif self.conflict:
                return False if other.conflict \
                    else self.range_.issuperset(other.range_)
            elif other.conflict:
                return other.range_.issuperset(self.range_)
            else:
                return not self.range_.intersects(other.range_)
        else:  # VersionedObject
            if (self.name_ != other.name_) or (self.range is None):
                return False
            if self.conflict:
                return (other.version_ in self.range_)
            else:
                return (other.version_ not in self.range_)
344977
def resolve_remote(self, uri):
        
        if uri.startswith('file://'):
            try:
                path = uri[7:]
                with open(path, 'r') as schema_file:
                    result = yaml.load(schema_file)
                if self.cache_remote:
                    self.store[uri] = result
                return result
            except yaml.parser.ParserError as e:
                logging.debug('Error parsing {!r} as YAML: {}'.format(
                    uri, e))
        return super(SchemaRefResolver, self).resolve_remote(uri)