/** * Does this specification's destination description match the ref name? * * @param r * ref name that should be tested. * @return true if the names match; false otherwise. */ public boolean matchDestination(String r) { return match(r, getDestination()); }
/** {@inheritDoc} */ @Override public int hashCode() { int hc = 0; if (getSource() != null) hc = hc * 31 + getSource().hashCode(); if (getDestination() != null) hc = hc * 31 + getDestination().hashCode(); return hc; }
/** {@inheritDoc} */ @Override public String toString() { final StringBuilder r = new StringBuilder(); if (isForceUpdate()) r.append('+'); if (getSource() != null) r.append(getSource()); if (getDestination() != null) { r.append(':'); r.append(getDestination()); } return r.toString(); } }
private static String findTrackingRefName(final String remoteName, final Collection<RefSpec> fetchSpecs) { // try to find matching tracking refs for (RefSpec fetchSpec : fetchSpecs) { if (fetchSpec.matchSource(remoteName)) { if (fetchSpec.isWildcard()) return fetchSpec.expandFromSource(remoteName) .getDestination(); else return fetchSpec.getDestination(); } } return null; }
/** * Does this specification's destination description match the ref? * * @param r * ref whose name should be tested. * @return true if the names match; false otherwise. */ public boolean matchDestination(Ref r) { return match(r.getName(), getDestination()); }
private RefSpec(RefSpec p) { force = p.isForceUpdate(); wildcard = p.isWildcard(); srcName = p.getSource(); dstName = p.getDestination(); allowMismatchedWildcards = p.allowMismatchedWildcards; }
private TrackingRefUpdate createUpdate(RefSpec spec, ObjectId newId) throws TransportException { Ref ref = localRefs().get(spec.getDestination()); ObjectId oldId = ref != null && ref.getObjectId() != null ? ref.getObjectId() : ObjectId.zeroId(); return new TrackingRefUpdate( spec.isForceUpdate(), spec.getSource(), spec.getDestination(), oldId, newId); }
private void want(Ref src, RefSpec spec) throws TransportException { final ObjectId newId = src.getObjectId(); if (newId == null) { throw new NullPointerException(MessageFormat.format( JGitText.get().transportProvidedRefWithNoObjectId, src.getName())); } if (spec.getDestination() != null) { final TrackingRefUpdate tru = createUpdate(spec, newId); if (newId.equals(tru.getOldObjectId())) return; localUpdates.add(tru); } askFor.put(newId, src); final FetchHeadRecord fhr = new FetchHeadRecord(); fhr.newValue = newId; fhr.notForMerge = spec.getDestination() != null; fhr.sourceName = src.getName(); fhr.sourceURI = transport.getURI(); fetchHeadUpdates.add(fhr); }
/** {@inheritDoc} */ @Override public boolean equals(Object obj) { if (!(obj instanceof RefSpec)) return false; final RefSpec b = (RefSpec) obj; if (isForceUpdate() != b.isForceUpdate()) return false; if (isWildcard() != b.isWildcard()) return false; if (!eq(getSource(), b.getSource())) return false; if (!eq(getDestination(), b.getDestination())) return false; return true; }
/** * Finds the tracked remote tracking branch * * @param remote * Remote name * @param mergeRef * merge Ref of the local branch tracking the remote tracking * branch * @return full remote tracking branch name or null */ private String findRemoteTrackingBranch(String remote, String mergeRef) { RemoteConfig remoteConfig; try { remoteConfig = new RemoteConfig(config, remote); } catch (URISyntaxException e) { return null; } for (RefSpec refSpec : remoteConfig.getFetchRefSpecs()) { if (refSpec.matchSource(mergeRef)) { RefSpec expanded = refSpec.expandFromSource(mergeRef); return expanded.getDestination(); } } return null; }
srcSpec = srcRef.getName(); String destSpec = spec.getDestination(); if (destSpec == null) {
for (RefSpec configured : fetch) { final String cfgSrc = configured.getSource(); final String cfgDst = configured.getDestination(); if (cfgSrc.equals(reqSrc) && cfgDst != null) { tmp.add(configured);
@Override public String getText(final Object element) { return ((RefSpec) element).getDestination(); }
@Override protected Object getValue(final Object element) { return ((RefSpec) element).getDestination(); }
RefSpec expandFromSource = refSpec .expandFromSource(remoteBranchName); name = expandFromSource.getDestination(); break;
/** * Does this specification's destination description match the ref name? * * @param r * ref name that should be tested. * @return true if the names match; false otherwise. */ public boolean matchDestination(String r) { return match(r, getDestination()); }
public String toString() { final StringBuilder r = new StringBuilder(); if (isForceUpdate()) r.append('+'); if (getSource() != null) r.append(getSource()); if (getDestination() != null) { r.append(':'); r.append(getDestination()); } return r.toString(); } }
/** * Does this specification's destination description match the ref? * * @param r * ref whose name should be tested. * @return true if the names match; false otherwise. */ public boolean matchDestination(final Ref r) { return match(r.getName(), getDestination()); }
private static RefSpec setRefSpecSource(final RefSpec spec, final String src) { final String dst; if (RefSpec.isWildcard(src)) dst = wildcardSpecComponent(spec.getDestination()); else dst = unwildcardSpecComponent(spec.getDestination(), src); return spec.setSourceDestination(src, dst); }
private RefSpec(final RefSpec p) { force = p.isForceUpdate(); wildcard = p.isWildcard(); srcName = p.getSource(); dstName = p.getDestination(); allowMismatchedWildcards = p.allowMismatchedWildcards; }