Merge "Simplify push error message when ref already exists"

This commit is contained in:
Shawn O. Pearce 2012-10-25 17:15:02 -04:00 committed by Gerrit Code Review @ Eclipse.org
commit 500becfc63
5 changed files with 7 additions and 6 deletions

View File

@ -377,7 +377,8 @@ readTimedOut=Read timed out
receivePackObjectTooLarge1=Object too large, rejecting the pack. Max object size limit is {0} bytes. receivePackObjectTooLarge1=Object too large, rejecting the pack. Max object size limit is {0} bytes.
receivePackObjectTooLarge2=Object too large ({0} bytes), rejecting the pack. Max object size limit is {1} bytes. receivePackObjectTooLarge2=Object too large ({0} bytes), rejecting the pack. Max object size limit is {1} bytes.
receivingObjects=Receiving objects receivingObjects=Receiving objects
refAlreadyExists=Ref {0} already exists refAlreadyExists=already exists
refAlreadyExists1=Ref {0} already exists
reflogEntryNotFound=Entry {0} not found in reflog for ''{1}'' reflogEntryNotFound=Entry {0} not found in reflog for ''{1}''
refNotResolved=Ref {0} can not be resolved refNotResolved=Ref {0} can not be resolved
refUpdateReturnCodeWas=RefUpdate return code was: {0} refUpdateReturnCodeWas=RefUpdate return code was: {0}

View File

@ -131,7 +131,7 @@ public Ref call() throws GitAPIException, RefAlreadyExistsException,
&& refToCheck.getName().startsWith(Constants.R_HEADS); && refToCheck.getName().startsWith(Constants.R_HEADS);
if (!force && exists) if (!force && exists)
throw new RefAlreadyExistsException(MessageFormat.format( throw new RefAlreadyExistsException(MessageFormat.format(
JGitText.get().refAlreadyExists, name)); JGitText.get().refAlreadyExists1, name));
ObjectId startAt = getStartPoint(); ObjectId startAt = getStartPoint();
String startPointFullName = null; String startPointFullName = null;

View File

@ -108,7 +108,7 @@ public Ref call() throws GitAPIException, RefNotFoundException, InvalidRefNameEx
String fullNewName; String fullNewName;
if (repo.getRef(newName) != null) if (repo.getRef(newName) != null)
throw new RefAlreadyExistsException(MessageFormat.format( throw new RefAlreadyExistsException(MessageFormat.format(
JGitText.get().refAlreadyExists, newName)); JGitText.get().refAlreadyExists1, newName));
if (oldName != null) { if (oldName != null) {
Ref ref = repo.getRef(oldName); Ref ref = repo.getRef(oldName);
if (ref == null) if (ref == null)

View File

@ -438,6 +438,7 @@ public static JGitText get() {
/***/ public String receivePackObjectTooLarge2; /***/ public String receivePackObjectTooLarge2;
/***/ public String receivingObjects; /***/ public String receivingObjects;
/***/ public String refAlreadyExists; /***/ public String refAlreadyExists;
/***/ public String refAlreadyExists1;
/***/ public String reflogEntryNotFound; /***/ public String reflogEntryNotFound;
/***/ public String refNotResolved; /***/ public String refNotResolved;
/***/ public String refUpdateReturnCodeWas; /***/ public String refUpdateReturnCodeWas;

View File

@ -55,7 +55,6 @@
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
@ -1055,8 +1054,8 @@ protected void validateCommands() {
// A well behaved client shouldn't have sent us a // A well behaved client shouldn't have sent us a
// create command for a ref we advertised to it. // create command for a ref we advertised to it.
// //
cmd.setResult(Result.REJECTED_OTHER_REASON, MessageFormat cmd.setResult(Result.REJECTED_OTHER_REASON,
.format(JGitText.get().refAlreadyExists, ref)); JGitText.get().refAlreadyExists);
continue; continue;
} }
} }