diff options
Diffstat (limited to 'org.eclipse.jgit.pgm')
3 files changed, 10 insertions, 2 deletions
diff --git a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/CLIText.properties b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/CLIText.properties index bf95ab34ab..6f5c8eb685 100644 --- a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/CLIText.properties +++ b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/CLIText.properties @@ -150,6 +150,7 @@ statusNewFile=new file: statusRemoved=deleted: switchedToNewBranch=Switched to a new branch ''{0}'' switchedToBranch=Switched to branch ''{0}'' +tagAlreadyExists=tag ''{0}'' already exists tagLabel=tag taggerInfo=Tagger: {0} <{1}> timeInMilliSeconds={0} ms diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java index 62d772de0f..c1cac71cfa 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java @@ -211,6 +211,7 @@ public class CLIText extends TranslationBundle { /***/ public String statusRemoved; /***/ public String switchedToNewBranch; /***/ public String switchedToBranch; + /***/ public String tagAlreadyExists; /***/ public String tagLabel; /***/ public String taggerInfo; /***/ public String timeInMilliSeconds; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java index 81143f6b86..665b79dfa0 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java @@ -48,11 +48,13 @@ package org.eclipse.jgit.pgm; +import java.text.MessageFormat; import java.util.List; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.ListTagCommand; import org.eclipse.jgit.api.TagCommand; +import org.eclipse.jgit.api.errors.RefAlreadyExistsException; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; @@ -85,8 +87,12 @@ class Tag extends TextBuiltin { RevWalk walk = new RevWalk(db); command.setObjectId(walk.parseAny(object)); } - - command.call(); + try { + command.call(); + } catch (RefAlreadyExistsException e) { + throw die(MessageFormat.format(CLIText.get().tagAlreadyExists, + tagName)); + } } else { ListTagCommand command = git.tagList(); List<Ref> list = command.call(); |