public ObjectId getMapping(ObjectId commitId) { synchronized (delegate) { return delegate.getMapping(commitId); } }
public ObjectId getMapping(ObjectId commitId) { synchronized (delegate) { return delegate.getMapping(commitId); } }
@Override protected boolean existsInDestination(ObjectId commitId) { // If the commit has not been mapped, it hasn't been pushed to the remote yet return !source.graphDatabase().getMapping(commitId).equals(ObjectId.NULL); }
@Override protected boolean existsInDestination(ObjectId commitId) { // If the commit has not been mapped, it hasn't been pushed to the remote yet return !source.graphDatabase().getMapping(commitId).equals(ObjectId.NULL); }
@Override protected Evaluation evaluate(CommitNode commitNode) { if (!source.graphDatabase().getMapping(commitNode.getObjectId()) .equals(ObjectId.NULL)) { return Evaluation.EXCLUDE_AND_PRUNE; } return Evaluation.INCLUDE_AND_CONTINUE; }
@Override protected Evaluation evaluate(CommitNode commitNode) { if (!source.graphDatabase().getMapping(commitNode.getObjectId()) .equals(ObjectId.NULL)) { return Evaluation.EXCLUDE_AND_PRUNE; } return Evaluation.INCLUDE_AND_CONTINUE; }
&& local.graphDatabase().exists(remoteRef.getObjectId())) { ObjectId mappedCommit = local.graphDatabase() .getMapping(remoteRef.getObjectId()); if (mappedCommit != null) { newRef = new Ref(remoteRef.getName(), mappedCommit);
@Override public void pushNewData(Repository local, Ref ref, String refspec, ProgressListener progress) throws SynchronizationException { Optional<Ref> remoteRef = getRemoteRef(refspec); checkPush(local, ref, remoteRef); beginPush(); PushCommitGatherer gatherer = new PushCommitGatherer(local); try { gatherer.traverse(ref.getObjectId()); Stack<ObjectId> needed = gatherer.commits; while (!needed.isEmpty()) { ObjectId commitToPush = needed.pop(); pushSparseCommit(local, commitToPush); } ObjectId newCommitId = local.graphDatabase().getMapping(ref.getObjectId()); ObjectId originalRemoteRefValue = ObjectId.NULL; if (remoteRef.isPresent()) { originalRemoteRefValue = remoteRef.get().getObjectId(); } endPush(refspec, newCommitId, originalRemoteRefValue.toString()); } catch (Exception e) { Throwables.propagate(e); } finally { } }
@Override public void pushNewData(Repository local, Ref ref, String refspec, ProgressListener progress) throws SynchronizationException { Optional<Ref> remoteRef = getRemoteRef(refspec); checkPush(local, ref, remoteRef); beginPush(); PushCommitGatherer gatherer = new PushCommitGatherer(local); gatherer.traverse(ref.getObjectId()); Stack<ObjectId> needed = gatherer.commits; while (!needed.isEmpty()) { ObjectId commitToPush = needed.pop(); pushSparseCommit(local, commitToPush); } ObjectId newCommitId = local.graphDatabase().getMapping(ref.getObjectId()); ObjectId originalRemoteRefValue = ObjectId.NULL; if (remoteRef.isPresent()) { originalRemoteRefValue = remoteRef.get().getObjectId(); } endPush(refspec, newCommitId, originalRemoteRefValue.toString()); }
@Test public void testMapNode() throws IOException { ObjectId commitId = RevObjectTestSupport.hashString("commitId"); ObjectId mappedId = RevObjectTestSupport.hashString("mapped"); database.put(commitId, new ImmutableList.Builder<ObjectId>().build()); database.map(mappedId, commitId); ObjectId mapping = database.getMapping(mappedId); assertEquals(commitId + " : " + mappedId + " : " + mapping, commitId, mapping); // update mapping ObjectId commitId2 = RevObjectTestSupport.hashString("commitId2"); database.map(mappedId, commitId2); mapping = database.getMapping(mappedId); assertEquals(commitId2 + " : " + mappedId + " : " + mapping, commitId2, mapping); }
@Test public void testMapNode() throws IOException { ObjectId commitId = RevObjectTestSupport.hashString("commitId"); ObjectId mappedId = RevObjectTestSupport.hashString("mapped"); database.put(commitId, new ImmutableList.Builder<ObjectId>().build()); database.map(mappedId, commitId); ObjectId mapping = database.getMapping(mappedId); assertEquals(commitId + " : " + mappedId + " : " + mapping, commitId, mapping); // update mapping ObjectId commitId2 = RevObjectTestSupport.hashString("commitId2"); database.map(mappedId, commitId2); mapping = database.getMapping(mappedId); assertEquals(commitId2 + " : " + mappedId + " : " + mapping, commitId2, mapping); }
ObjectId headId = remoteRef.getObjectId(); if (!(newRef instanceof SymRef) && graphdb.exists(headId)) { ObjectId mappedCommit = graphdb.getMapping(headId); if (mappedCommit != null) { newRef = new Ref(remoteRef.getName(), mappedCommit);
ObjectId headId = remoteRef.getObjectId(); if (!(newRef instanceof SymRef) && graphdb.exists(headId)) { ObjectId mappedCommit = graphdb.getMapping(headId); if (mappedCommit != null) { newRef = new Ref(remoteRef.getName(), mappedCommit);
throw new SynchronizationException(StatusCode.CANNOT_PUSH_TO_SYMBOLIC_REF); ObjectId mappedId = local.graphDatabase().getMapping(remoteRef.get().getObjectId()); if (mappedId.equals(ref.getObjectId())) {
newParents.add(0, from.graphDatabase().getMapping(parentId)); continue; newParents.add(from.graphDatabase().getMapping(parentId)); parent = from.graphDatabase().getMapping(newParents.get(0));
newParents.add(0, from.graphDatabase().getMapping(parentId)); continue; newParents.add(from.graphDatabase().getMapping(parentId)); parent = from.graphDatabase().getMapping(newParents.get(0));
throw new SynchronizationException(StatusCode.CANNOT_PUSH_TO_SYMBOLIC_REF); ObjectId mappedId = local.graphDatabase().getMapping(remoteRef.get().getObjectId()); if (mappedId.equals(ref.getObjectId())) {
private Ref updateLocalRef(Ref remoteRef, Remote remote, ImmutableSet<Ref> localRemoteRefs) { final String refName; if (remoteRef.getName().startsWith(Ref.TAGS_PREFIX)) { refName = remoteRef.getName(); } else { refName = Ref.REMOTES_PREFIX + remote.getName() + "/" + remoteRef.localName(); } Ref updatedRef = remoteRef; if (remoteRef instanceof SymRef) { String targetBranch = Ref.localName(((SymRef) remoteRef).getTarget()); String newTarget = Ref.REMOTES_PREFIX + remote.getName() + "/" + targetBranch; updatedRef = command(UpdateSymRef.class).setName(refName).setNewValue(newTarget).call() .get(); } else { ObjectId effectiveId = remoteRef.getObjectId(); if (remote.getMapped() && !repository().commitExists(remoteRef.getObjectId())) { effectiveId = graphDatabase().getMapping(effectiveId); } updatedRef = command(UpdateRef.class).setName(refName).setNewValue(effectiveId).call() .get(); } return updatedRef; }
private Ref updateLocalRef(Ref remoteRef, Remote remote, ImmutableSet<Ref> localRemoteRefs) { final String refName; if (remoteRef.getName().startsWith(Ref.TAGS_PREFIX)) { refName = remoteRef.getName(); } else { refName = Ref.REMOTES_PREFIX + remote.getName() + "/" + remoteRef.localName(); } Ref updatedRef = remoteRef; if (remoteRef instanceof SymRef) { String targetBranch = Ref.localName(((SymRef) remoteRef).getTarget()); String newTarget = Ref.REMOTES_PREFIX + remote.getName() + "/" + targetBranch; updatedRef = command(UpdateSymRef.class).setName(refName).setNewValue(newTarget).call() .get(); } else { ObjectId effectiveId = remoteRef.getObjectId(); if (remote.getMapped() && !repository().commitExists(remoteRef.getObjectId())) { effectiveId = graphDatabase().getMapping(effectiveId); } updatedRef = command(UpdateRef.class).setName(refName).setNewValue(effectiveId).call() .get(); } return updatedRef; }
ObjectId mappedCommit = graphDatabase.getMapping(commit.getParentIds().get(0)); graphDatabase.map(commit.getId(), mappedCommit); Optional<ObjectId> treeId = local.command(ResolveTreeish.class) List<ObjectId> newParents = new LinkedList<ObjectId>(); for (ObjectId parentCommitId : commit.getParentIds()) { newParents.add(graphDatabase.getMapping(parentCommitId)); List<ObjectId> newParents = new LinkedList<>(); for (ObjectId parentCommitId : commit.getParentIds()) { newParents.add(graphDatabase.getMapping(parentCommitId)); } else { graphDatabase.setProperty(graphDatabase.getMapping(commit.getId()), GraphDatabase.SPARSE_FLAG, "true");