Revert "Create ref for new patch set on direct push"

This reverts commit 4d46cb0bcd

It turned out that this breaks uploading of new patch sets for review
since in this case the change ref is already created and trying to
create it again fails.

Change-Id: Ie8ca65626cb8abe890313bebd25f42791ea6995c
This commit is contained in:
Edwin Kempin
2013-01-09 02:06:20 -08:00
committed by Edwin Kempin
parent 4d46cb0bcd
commit 21f5616faa

View File

@@ -97,7 +97,6 @@ import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectReader;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.notes.NoteMap;
import org.eclipse.jgit.revwalk.FooterKey;
@@ -1676,7 +1675,7 @@ public class ReceiveCommits {
ListenableFuture<PatchSet.Id> future = changeUpdateExector.submit(
requestScopePropagator.wrap(new Callable<PatchSet.Id>() {
@Override
public PatchSet.Id call() throws OrmException, IOException {
public PatchSet.Id call() throws OrmException {
try {
if (caller == Thread.currentThread()) {
return insertPatchSet(db);
@@ -1698,7 +1697,7 @@ public class ReceiveCommits {
return Futures.makeChecked(future, ORM_EXCEPTION);
}
PatchSet.Id insertPatchSet(ReviewDb db) throws OrmException, IOException {
PatchSet.Id insertPatchSet(ReviewDb db) throws OrmException {
final Account.Id me = currentUser.getAccountId();
final Set<Account.Id> reviewers = new HashSet<Account.Id>(reviewerId);
final Set<Account.Id> cc = new HashSet<Account.Id>(ccId);
@@ -1813,14 +1812,7 @@ public class ReceiveCommits {
markChangeMergedByPush(db, this);
}
final RefUpdate ru = repo.updateRef(newPatchSet.getRefName());
ru.setNewObjectId(newCommit);
ru.disableRefLog();
if (ru.update(rp.getRevWalk()) != RefUpdate.Result.NEW) {
throw new IOException("Failed to create ref " + newPatchSet.getRefName() + " in "
+ repo.getDirectory() + ": " + ru.getResult());
}
replication.fire(project.getNameKey(), ru.getName());
replication.fire(project.getNameKey(), newPatchSet.getRefName());
hooks.doPatchsetCreatedHook(change, newPatchSet, db);
if (mergedIntoRef != null) {
hooks.doChangeMergedHook(