diff options
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api')
23 files changed, 111 insertions, 104 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java index f89f3e480c..ef2e987b4e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java @@ -130,7 +130,7 @@ public class AddCommand extends GitCommand<DirCache> { checkCallable(); DirCache dc = null; boolean addAll = false; - if (filepatterns.contains(".")) + if (filepatterns.contains(".")) //$NON-NLS-1$ addAll = true; ObjectInserter inserter = repo.newObjectInserter(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java index e6070eccf8..2bda76c323 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java @@ -227,14 +227,14 @@ public class ApplyCommand extends GitCommand<ApplyResult> { } } if (!isNoNewlineAtEndOfFile(fh)) - newLines.add(""); + newLines.add(""); //$NON-NLS-1$ if (!rt.isMissingNewlineAtEnd()) - oldLines.add(""); + oldLines.add(""); //$NON-NLS-1$ if (!isChanged(oldLines, newLines)) return; // don't touch the file StringBuilder sb = new StringBuilder(); final String eol = rt.size() == 0 - || (rt.size() == 1 && rt.isMissingNewlineAtEnd()) ? "\n" : rt + || (rt.size() == 1 && rt.isMissingNewlineAtEnd()) ? "\n" : rt //$NON-NLS-1$ .getLineDelimiter(); for (String l : newLines) { sb.append(l); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java index ef227dc854..eb447f3142 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java @@ -218,7 +218,7 @@ public class CheckoutCommand extends GitCommand<Ref> { Ref headRef = repo.getRef(Constants.HEAD); String shortHeadRef = getShortBranchName(headRef); - String refLogMessage = "checkout: moving from " + shortHeadRef; + String refLogMessage = "checkout: moving from " + shortHeadRef; //$NON-NLS-1$ ObjectId branch = repo.resolve(name); if (branch == null) throw new RefNotFoundException(MessageFormat.format(JGitText @@ -252,7 +252,7 @@ public class CheckoutCommand extends GitCommand<Ref> { String toName = Repository.shortenRefName(name); RefUpdate refUpdate = repo.updateRef(Constants.HEAD, ref == null); refUpdate.setForceUpdate(force); - refUpdate.setRefLogMessage(refLogMessage + " to " + toName, false); + refUpdate.setRefLogMessage(refLogMessage + " to " + toName, false); //$NON-NLS-1$ Result updateResult; if (ref != null) updateResult = refUpdate.link(ref.getName()); @@ -469,7 +469,7 @@ public class CheckoutCommand extends GitCommand<Ref> { && (name == null || !Repository .isValidRefName(Constants.R_HEADS + name))) throw new InvalidRefNameException(MessageFormat.format(JGitText - .get().branchNameInvalid, name == null ? "<null>" : name)); + .get().branchNameInvalid, name == null ? "<null>" : name)); //$NON-NLS-1$ } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java index 3d3b47d089..dca7197d18 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java @@ -148,7 +148,7 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> { String ourName = calculateOurName(headRef); String cherryPickName = srcCommit.getId().abbreviate(7).name() - + " " + srcCommit.getShortMessage(); + + " " + srcCommit.getShortMessage(); //$NON-NLS-1$ ResolveMerger merger = (ResolveMerger) MergeStrategy.RESOLVE .newMerger(repo); @@ -168,7 +168,7 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> { newHead = new Git(getRepository()).commit() .setMessage(srcCommit.getFullMessage()) .setReflogComment( - "cherry-pick: " + "cherry-pick: " //$NON-NLS-1$ + srcCommit.getShortMessage()) .setAuthor(srcCommit.getAuthorIdent()).call(); cherryPickedRefs.add(src); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java index f76d98afd3..b42c80f67b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java @@ -131,7 +131,7 @@ public class CleanCommand extends GitCommand<Set<String>> { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), dir), FileUtils.RECURSIVE); - files.add(dir + "/"); + files.add(dir + "/"); //$NON-NLS-1$ } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java index e4c55698e0..22bda612fb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java @@ -158,7 +158,8 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> { + config.getName(); RefSpec refSpec = new RefSpec(); refSpec = refSpec.setForceUpdate(true); - refSpec = refSpec.setSourceDestination(Constants.R_HEADS + "*", dst + "/*"); //$NON-NLS-1$ //$NON-NLS-2$ + refSpec = refSpec.setSourceDestination( + Constants.R_HEADS + "*", dst + "/*"); //$NON-NLS-1$ //$NON-NLS-2$ config.addFetchRefSpec(refSpec); config.update(clonedRepo.getConfig()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java index eab2e8d4b8..5f559bcbf8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java @@ -159,7 +159,7 @@ public class CommitCommand extends GitCommand<RevCommit> { Git git = new Git(repo); try { git.add() - .addFilepattern(".") + .addFilepattern(".") //$NON-NLS-1$ .setUpdate(true).call(); } catch (NoFilepatternException e) { // should really not happen @@ -173,7 +173,7 @@ public class CommitCommand extends GitCommand<RevCommit> { JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported); // determine the current HEAD and the commit it is referring to - ObjectId headId = repo.resolve(Constants.HEAD + "^{commit}"); + ObjectId headId = repo.resolve(Constants.HEAD + "^{commit}"); //$NON-NLS-1$ if (headId == null && amend) throw new WrongRepositoryStateException( JGitText.get().commitAmendOnInitialNotPossible); @@ -226,7 +226,7 @@ public class CommitCommand extends GitCommand<RevCommit> { if (reflogComment != null) { ru.setRefLogMessage(reflogComment, false); } else { - String prefix = amend ? "commit (amend): " + String prefix = amend ? "commit (amend): " //$NON-NLS-1$ : "commit: "; ru.setRefLogMessage( prefix + revCommit.getShortMessage(), false); @@ -287,9 +287,9 @@ public class CommitCommand extends GitCommand<RevCommit> { author, committer, message); message = ChangeIdUtil.insertId(message, changeId); if (changeId != null) - message = message.replaceAll("\nChange-Id: I" - + ObjectId.zeroId().getName() + "\n", "\nChange-Id: I" - + changeId.getName() + "\n"); + message = message.replaceAll("\nChange-Id: I" //$NON-NLS-1$ + + ObjectId.zeroId().getName() + "\n", "\nChange-Id: I" //$NON-NLS-1$ //$NON-NLS-2$ + + changeId.getName() + "\n"); //$NON-NLS-1$ } private DirCache createTemporaryIndex(ObjectId headId, DirCache index) @@ -455,7 +455,7 @@ public class CommitCommand extends GitCommand<RevCommit> { while (true) { if (p.equals(o)) return i; - int l = p.lastIndexOf("/"); + int l = p.lastIndexOf("/"); //$NON-NLS-1$ if (l < 1) break; p = p.substring(0, l); @@ -633,8 +633,8 @@ public class CommitCommand extends GitCommand<RevCommit> { checkCallable(); if (!only.isEmpty()) throw new JGitInternalException(MessageFormat.format( - JGitText.get().illegalCombinationOfArguments, "--all", - "--only")); + JGitText.get().illegalCombinationOfArguments, "--all", //$NON-NLS-1$ + "--only")); //$NON-NLS-1$ this.all = all; return this; } @@ -668,9 +668,9 @@ public class CommitCommand extends GitCommand<RevCommit> { checkCallable(); if (all) throw new JGitInternalException(MessageFormat.format( - JGitText.get().illegalCombinationOfArguments, "--only", - "--all")); - String o = only.endsWith("/") ? only.substring(0, only.length() - 1) + JGitText.get().illegalCombinationOfArguments, "--only", //$NON-NLS-1$ + "--all")); //$NON-NLS-1$ + String o = only.endsWith("/") ? only.substring(0, only.length() - 1) //$NON-NLS-1$ : only; // ignore duplicates if (!this.only.contains(o)) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java index 0cd478cd54..aa1484c0f9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java @@ -144,7 +144,7 @@ public class CreateBranchCommand extends GitCommand<Ref> { // determine whether we are based on a commit, // a branch, or a tag and compose the reflog message String refLogMessage; - String baseBranch = ""; + String baseBranch = ""; //$NON-NLS-1$ if (startPointFullName == null) { String baseCommit; if (startCommit != null) @@ -155,26 +155,26 @@ public class CreateBranchCommand extends GitCommand<Ref> { baseCommit = commit.getShortMessage(); } if (exists) - refLogMessage = "branch: Reset start-point to commit " + refLogMessage = "branch: Reset start-point to commit " //$NON-NLS-1$ + baseCommit; else - refLogMessage = "branch: Created from commit " + baseCommit; + refLogMessage = "branch: Created from commit " + baseCommit; //$NON-NLS-1$ } else if (startPointFullName.startsWith(Constants.R_HEADS) || startPointFullName.startsWith(Constants.R_REMOTES)) { baseBranch = startPointFullName; if (exists) - refLogMessage = "branch: Reset start-point to branch " + refLogMessage = "branch: Reset start-point to branch " //$NON-NLS-1$ + startPointFullName; // TODO else - refLogMessage = "branch: Created from branch " + baseBranch; + refLogMessage = "branch: Created from branch " + baseBranch; //$NON-NLS-1$ } else { startAt = revWalk.peel(revWalk.parseAny(startAt)); if (exists) - refLogMessage = "branch: Reset start-point to tag " + refLogMessage = "branch: Reset start-point to tag " //$NON-NLS-1$ + startPointFullName; else - refLogMessage = "branch: Created from tag " + refLogMessage = "branch: Created from tag " //$NON-NLS-1$ + startPointFullName; } @@ -233,9 +233,9 @@ public class CreateBranchCommand extends GitCommand<Ref> { String autosetupflag = repo.getConfig().getString( ConfigConstants.CONFIG_BRANCH_SECTION, null, ConfigConstants.CONFIG_KEY_AUTOSETUPMERGE); - if ("false".equals(autosetupflag)) { + if ("false".equals(autosetupflag)) { //$NON-NLS-1$ doConfigure = false; - } else if ("always".equals(autosetupflag)) { + } else if ("always".equals(autosetupflag)) { //$NON-NLS-1$ doConfigure = true; } else { // in this case, the default is to configure @@ -246,8 +246,8 @@ public class CreateBranchCommand extends GitCommand<Ref> { if (doConfigure) { StoredConfig config = repo.getConfig(); - String[] tokens = baseBranch.split("/", 4); - boolean isRemote = tokens[1].equals("remotes"); + String[] tokens = baseBranch.split("/", 4); //$NON-NLS-1$ + boolean isRemote = tokens[1].equals("remotes"); //$NON-NLS-1$ if (isRemote) { // refs/remotes/<remote name>/<branch> String remoteName = tokens[2]; @@ -262,7 +262,7 @@ public class CreateBranchCommand extends GitCommand<Ref> { } else { // set "." as remote config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, - name, ConfigConstants.CONFIG_KEY_REMOTE, "."); + name, ConfigConstants.CONFIG_KEY_REMOTE, "."); //$NON-NLS-1$ config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, name, ConfigConstants.CONFIG_KEY_MERGE, baseBranch); } @@ -298,7 +298,7 @@ public class CreateBranchCommand extends GitCommand<Ref> { if (name == null || !Repository.isValidRefName(Constants.R_HEADS + name)) throw new InvalidRefNameException(MessageFormat.format(JGitText - .get().branchNameInvalid, name == null ? "<null>" : name)); + .get().branchNameInvalid, name == null ? "<null>" : name)); //$NON-NLS-1$ } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java index 0d03162543..30b27f22c7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java @@ -138,7 +138,7 @@ public class DeleteBranchCommand extends GitCommand<List<String>> { JGitText.get().cannotDeleteCheckedOutBranch, branchName)); RefUpdate update = repo.updateRef(fullName); - update.setRefLogMessage("branch deleted", false); + update.setRefLogMessage("branch deleted", false); //$NON-NLS-1$ update.setForceUpdate(true); Result deleteResult = update.delete(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java index 9b4476d628..f31198f946 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java @@ -120,7 +120,7 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> { try { if (cached) { if (oldTree == null) { - ObjectId head = repo.resolve(HEAD + "^{tree}"); + ObjectId head = repo.resolve(HEAD + "^{tree}"); //$NON-NLS-1$ if (head == null) throw new NoHeadException(JGitText.get().cannotReadTree); CanonicalTreeParser p = new CanonicalTreeParser(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java index 8777be5546..bf43e90d42 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java @@ -80,7 +80,7 @@ public class InitCommand implements Callable<Git> { d = new File(d, Constants.DOT_GIT); builder.setGitDir(d); } else if (builder.getGitDir() == null) { - File d = new File("."); + File d = new File("."); //$NON-NLS-1$ if (d.getParentFile() != null) d = d.getParentFile(); if (!bare) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java index c450ea962c..3843dc4a18 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java @@ -161,9 +161,9 @@ public class LsRemoteCommand extends Collection<RefSpec> refSpecs = new ArrayList<RefSpec>(1); if (tags) refSpecs.add(new RefSpec( - "refs/tags/*:refs/remotes/origin/tags/*")); + "refs/tags/*:refs/remotes/origin/tags/*")); //$NON-NLS-1$ if (heads) - refSpecs.add(new RefSpec("refs/heads/*:refs/remotes/origin/*")); + refSpecs.add(new RefSpec("refs/heads/*:refs/remotes/origin/*")); //$NON-NLS-1$ Collection<Ref> refs; Map<String, Ref> refmap = new HashMap<String, Ref>(); fc = transport.openFetch(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java index a884c70cb0..04d91af4b0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java @@ -151,7 +151,7 @@ public class MergeCommand extends GitCommand<MergeResult> { if (head == null) throw new NoHeadException( JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported); - StringBuilder refLogMessage = new StringBuilder("merge "); + StringBuilder refLogMessage = new StringBuilder("merge "); //$NON-NLS-1$ // Check for FAST_FORWARD, ALREADY_UP_TO_DATE revWalk = new RevWalk(repo); @@ -179,7 +179,7 @@ public class MergeCommand extends GitCommand<MergeResult> { .updateRef(head.getTarget().getName()); refUpdate.setNewObjectId(objectId); refUpdate.setExpectedOldObjectId(null); - refUpdate.setRefLogMessage("initial pull", false); + refUpdate.setRefLogMessage("initial pull", false); //$NON-NLS-1$ if (refUpdate.update() != Result.NEW) throw new NoHeadException( JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported); @@ -200,7 +200,7 @@ public class MergeCommand extends GitCommand<MergeResult> { && fastForwardMode == FastForwardMode.FF) { // FAST_FORWARD detected: skip doing a real merge but only // update HEAD - refLogMessage.append(": " + MergeStatus.FAST_FORWARD); + refLogMessage.append(": " + MergeStatus.FAST_FORWARD); //$NON-NLS-1$ dco = new DirCacheCheckout(repo, headCommit.getTree(), repo.lockDirCache(), srcCommit.getTree()); @@ -233,7 +233,7 @@ public class MergeCommand extends GitCommand<MergeResult> { new ObjectId[] { headCommit, srcCommit }, MergeStatus.ABORTED, mergeStrategy, null, null); } - String mergeMessage = ""; + String mergeMessage = ""; //$NON-NLS-1$ if (!squash) { mergeMessage = new MergeMessageFormatter().format( commits, head); @@ -254,7 +254,7 @@ public class MergeCommand extends GitCommand<MergeResult> { if (merger instanceof ResolveMerger) { ResolveMerger resolveMerger = (ResolveMerger) merger; resolveMerger.setCommitNames(new String[] { - "BASE", "HEAD", ref.getName() }); + "BASE", "HEAD", ref.getName() }); //$NON-NLS-1$ resolveMerger.setWorkingTreeIterator(new FileTreeIterator(repo)); noProblems = merger.merge(headCommit, srcCommit); lowLevelResults = resolveMerger @@ -263,11 +263,11 @@ public class MergeCommand extends GitCommand<MergeResult> { unmergedPaths = resolveMerger.getUnmergedPaths(); } else noProblems = merger.merge(headCommit, srcCommit); - refLogMessage.append(": Merge made by "); + refLogMessage.append(": Merge made by "); //$NON-NLS-1$ if (!revWalk.isMergedInto(headCommit, srcCommit)) refLogMessage.append(mergeStrategy.getName()); else - refLogMessage.append("recursive"); + refLogMessage.append("recursive"); //$NON-NLS-1$ refLogMessage.append('.'); if (noProblems) { dco = new DirCacheCheckout(repo, diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java index 8485a15440..1c930ebeb3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java @@ -324,6 +324,7 @@ public class MergeResult { return base; } + @SuppressWarnings("nls") @Override public String toString() { boolean first = true; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java index 8179098885..4c935095c3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java @@ -76,7 +76,7 @@ import org.eclipse.jgit.transport.FetchResult; */ public class PullCommand extends TransportCommand<PullCommand, PullResult> { - private final static String DOT = "."; + private final static String DOT = "."; //$NON-NLS-1$ private ProgressMonitor monitor = NullProgressMonitor.INSTANCE; @@ -218,7 +218,7 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> { JGitText.get().missingConfigurationForKey, missingKey)); } - final boolean isRemote = !remote.equals("."); + final boolean isRemote = !remote.equals("."); //$NON-NLS-1$ String remoteUri; FetchResult fetchRes; if (isRemote) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullResult.java index 49327fc9b9..c1eb89db7f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullResult.java @@ -112,6 +112,7 @@ public class PullResult { return true; } + @SuppressWarnings("nls") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java index 0022672744..3f7feb936f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java @@ -110,40 +110,40 @@ public class RebaseCommand extends GitCommand<RebaseResult> { /** * The name of the "rebase-merge" folder */ - public static final String REBASE_MERGE = "rebase-merge"; + public static final String REBASE_MERGE = "rebase-merge"; //$NON-NLS-1$ /** * The name of the "stopped-sha" file */ - public static final String STOPPED_SHA = "stopped-sha"; + public static final String STOPPED_SHA = "stopped-sha"; //$NON-NLS-1$ - private static final String AUTHOR_SCRIPT = "author-script"; + private static final String AUTHOR_SCRIPT = "author-script"; //$NON-NLS-1$ - private static final String DONE = "done"; + private static final String DONE = "done"; //$NON-NLS-1$ - private static final String GIT_AUTHOR_DATE = "GIT_AUTHOR_DATE"; + private static final String GIT_AUTHOR_DATE = "GIT_AUTHOR_DATE"; //$NON-NLS-1$ - private static final String GIT_AUTHOR_EMAIL = "GIT_AUTHOR_EMAIL"; + private static final String GIT_AUTHOR_EMAIL = "GIT_AUTHOR_EMAIL"; //$NON-NLS-1$ - private static final String GIT_AUTHOR_NAME = "GIT_AUTHOR_NAME"; + private static final String GIT_AUTHOR_NAME = "GIT_AUTHOR_NAME"; //$NON-NLS-1$ - private static final String GIT_REBASE_TODO = "git-rebase-todo"; + private static final String GIT_REBASE_TODO = "git-rebase-todo"; //$NON-NLS-1$ - private static final String HEAD_NAME = "head-name"; + private static final String HEAD_NAME = "head-name"; //$NON-NLS-1$ - private static final String INTERACTIVE = "interactive"; + private static final String INTERACTIVE = "interactive"; //$NON-NLS-1$ - private static final String MESSAGE = "message"; + private static final String MESSAGE = "message"; //$NON-NLS-1$ - private static final String ONTO = "onto"; + private static final String ONTO = "onto"; //$NON-NLS-1$ - private static final String ONTO_NAME = "onto-name"; + private static final String ONTO_NAME = "onto-name"; //$NON-NLS-1$ - private static final String PATCH = "patch"; + private static final String PATCH = "patch"; //$NON-NLS-1$ - private static final String REBASE_HEAD = "head"; + private static final String REBASE_HEAD = "head"; //$NON-NLS-1$ - private static final String AMEND = "amend"; + private static final String AMEND = "amend"; //$NON-NLS-1$ /** * The available operations @@ -275,9 +275,9 @@ public class RebaseCommand extends GitCommand<RebaseResult> { for (Step step : steps) { sb.setLength(0); sb.append(step.action.token); - sb.append(" "); + sb.append(" "); //$NON-NLS-1$ sb.append(step.commit.name()); - sb.append(" "); + sb.append(" "); //$NON-NLS-1$ sb.append(RawParseUtils.decode(step.shortMessage) .trim()); fw.write(sb.toString()); @@ -398,7 +398,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { } private RevCommit checkoutCurrentHead() throws IOException, NoHeadException { - ObjectId headTree = repo.resolve(Constants.HEAD + "^{tree}"); + ObjectId headTree = repo.resolve(Constants.HEAD + "^{tree}"); //$NON-NLS-1$ if (headTree == null) throw new NoHeadException( JGitText.get().cannotRebaseWithoutCurrentHead); @@ -442,7 +442,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { treeWalk.reset(); treeWalk.setRecursive(true); treeWalk.addTree(new DirCacheIterator(dc)); - ObjectId id = repo.resolve(Constants.HEAD + "^{tree}"); + ObjectId id = repo.resolve(Constants.HEAD + "^{tree}"); //$NON-NLS-1$ if (id == null) throw new NoHeadException( JGitText.get().cannotRebaseWithoutCurrentHead); @@ -496,23 +496,23 @@ public class RebaseCommand extends GitCommand<RebaseResult> { String toAuthorScript(PersonIdent author) { StringBuilder sb = new StringBuilder(100); sb.append(GIT_AUTHOR_NAME); - sb.append("='"); + sb.append("='"); //$NON-NLS-1$ sb.append(author.getName()); - sb.append("'\n"); + sb.append("'\n"); //$NON-NLS-1$ sb.append(GIT_AUTHOR_EMAIL); - sb.append("='"); + sb.append("='"); //$NON-NLS-1$ sb.append(author.getEmailAddress()); - sb.append("'\n"); + sb.append("'\n"); //$NON-NLS-1$ // the command line uses the "external String" // representation for date and timezone sb.append(GIT_AUTHOR_DATE); - sb.append("='"); - sb.append("@"); // @ for time in seconds since 1970 + sb.append("='"); //$NON-NLS-1$ + sb.append("@"); // @ for time in seconds since 1970 //$NON-NLS-1$ String externalString = author.toExternalString(); sb .append(externalString.substring(externalString .lastIndexOf('>') + 2)); - sb.append("'\n"); + sb.append("'\n"); //$NON-NLS-1$ return sb.toString(); } @@ -655,7 +655,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { createFile(rebaseDir, HEAD_NAME, headName); createFile(rebaseDir, ONTO, upstreamCommit.name()); createFile(rebaseDir, ONTO_NAME, upstreamCommitName); - createFile(rebaseDir, INTERACTIVE, ""); + createFile(rebaseDir, INTERACTIVE, ""); //$NON-NLS-1$ BufferedWriter fw = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(new File(rebaseDir, GIT_REBASE_TODO)), Constants.CHARACTER_ENCODING)); @@ -668,9 +668,9 @@ public class RebaseCommand extends GitCommand<RebaseResult> { for (RevCommit commit : cherryPickList) { sb.setLength(0); sb.append(Action.PICK.toToken()); - sb.append(" "); + sb.append(" "); //$NON-NLS-1$ sb.append(reader.abbreviate(commit).name()); - sb.append(" "); + sb.append(" "); //$NON-NLS-1$ sb.append(commit.getShortMessage()); fw.write(sb.toString()); fw.newLine(); @@ -747,8 +747,8 @@ public class RebaseCommand extends GitCommand<RebaseResult> { RefUpdate rup = repo.updateRef(headName); rup.setExpectedOldObjectId(oldCommit); rup.setNewObjectId(newCommit); - rup.setRefLogMessage("Fast-foward from " + oldCommit.name() - + " to " + newCommit.name(), false); + rup.setRefLogMessage("Fast-foward from " + oldCommit.name() //$NON-NLS-1$ + + " to " + newCommit.name(), false); //$NON-NLS-1$ Result res = rup.update(walk); switch (res) { case FAST_FORWARD: @@ -756,7 +756,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { case FORCED: break; default: - throw new IOException("Could not fast-forward"); + throw new IOException("Could not fast-forward"); //$NON-NLS-1$ } } return newCommit; @@ -1082,11 +1082,11 @@ public class RebaseCommand extends GitCommand<RebaseResult> { */ public static enum Action { /** Use commit */ - PICK("pick", "p"), + PICK("pick", "p"), //$NON-NLS-1$ //$NON-NLS-2$ /** Use commit, but edit the commit message */ - REWORD("reword", "r"), + REWORD("reword", "r"), //$NON-NLS-1$ //$NON-NLS-2$ /** Use commit, but stop for amending */ - EDIT("edit", "e"); // later add SQUASH, FIXUP, etc. + EDIT("edit", "e"); // later add SQUASH, FIXUP, etc. //$NON-NLS-1$ //$NON-NLS-2$ private final String token; @@ -1104,6 +1104,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { return this.token; } + @SuppressWarnings("nls") @Override public String toString() { return "Action[" + token + "]"; @@ -1165,9 +1166,12 @@ public class RebaseCommand extends GitCommand<RebaseResult> { return shortMessage; } + @SuppressWarnings("nls") @Override public String toString() { - return "Step[" + action + ", " + return "Step[" + + action + + ", " + ((commit == null) ? "null" : commit) + ", " + ((shortMessage == null) ? "null" : new String( @@ -1199,7 +1203,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { // the time is saved as <seconds since 1970> <timezone offset> int timeStart = 0; - if (time.startsWith("@")) + if (time.startsWith("@")) //$NON-NLS-1$ timeStart = 1; else timeStart = 0; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java index 22f4ef9862..607253b76d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java @@ -101,7 +101,7 @@ public class RenameBranchCommand extends GitCommand<Ref> { if (newName == null) throw new InvalidRefNameException(MessageFormat.format(JGitText - .get().branchNameInvalid, "<null>")); + .get().branchNameInvalid, "<null>")); //$NON-NLS-1$ try { String fullOldName; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java index 36c3334b82..80abbec2e3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java @@ -153,7 +153,7 @@ public class ResetCommand extends GitCommand<Ref> { // resolve the ref to a commit final ObjectId commitId; try { - commitId = repo.resolve(ref + "^{commit}"); + commitId = repo.resolve(ref + "^{commit}"); //$NON-NLS-1$ if (commitId == null) { // @TODO throw an InvalidRefNameException. We can't do that // now because this would break the API @@ -253,7 +253,7 @@ public class ResetCommand extends GitCommand<Ref> { if (!filepaths.isEmpty()) throw new JGitInternalException(MessageFormat.format( JGitText.get().illegalCombinationOfArguments, - "[--mixed | --soft | --hard]", "<paths>...")); + "[--mixed | --soft | --hard]", "<paths>...")); //$NON-NLS-1$ this.mode = mode; return this; } @@ -267,7 +267,7 @@ public class ResetCommand extends GitCommand<Ref> { if (mode != null) throw new JGitInternalException(MessageFormat.format( JGitText.get().illegalCombinationOfArguments, "<paths>...", - "[--mixed | --soft | --hard]")); + "[--mixed | --soft | --hard]")); //$NON-NLS-1$ filepaths.add(file); return this; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java index fde6b94d2d..910637d0e8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java @@ -164,13 +164,13 @@ public class RevertCommand extends GitCommand<RevCommit> { merger.getResultTreeId()); dco.setFailOnConflict(true); dco.checkout(); - String shortMessage = "Revert \"" + srcCommit.getShortMessage() + "\""; - String newMessage = shortMessage + "\n\n" - + "This reverts commit " - + srcCommit.getId().getName() + ".\n"; + String shortMessage = "Revert \"" + srcCommit.getShortMessage() + "\""; //$NON-NLS-2$ + String newMessage = shortMessage + "\n\n" //$NON-NLS-1$ + + "This reverts commit " //$NON-NLS-1$ + + srcCommit.getId().getName() + ".\n"; //$NON-NLS-1$ newHead = new Git(getRepository()).commit() .setMessage(newMessage) - .setReflogComment("revert: " + shortMessage).call(); + .setReflogComment("revert: " + shortMessage).call(); //$NON-NLS-1$ revertedRefs.add(src); } else { unmergedPaths = merger.getUnmergedPaths(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java index c26a48525d..5a6a4c785b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java @@ -84,7 +84,7 @@ import org.eclipse.jgit.util.FileUtils; */ public class StashApplyCommand extends GitCommand<ObjectId> { - private static final String DEFAULT_REF = Constants.STASH + "@{0}"; + private static final String DEFAULT_REF = Constants.STASH + "@{0}"; //$NON-NLS-1$ /** * Stash diff filter that looks for differences in the first three trees @@ -115,7 +115,7 @@ public class StashApplyCommand extends GitCommand<ObjectId> { @Override public String toString() { - return "STASH_DIFF"; + return "STASH_DIFF"; //$NON-NLS-1$ } } @@ -192,7 +192,7 @@ public class StashApplyCommand extends GitCommand<ObjectId> { private ObjectId getHeadTree() throws GitAPIException { final ObjectId headTree; try { - headTree = repo.resolve(Constants.HEAD + "^{tree}"); + headTree = repo.resolve(Constants.HEAD + "^{tree}"); //$NON-NLS-1$ } catch (IOException e) { throw new JGitInternalException(JGitText.get().cannotReadTree, e); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java index 8d887e3548..1784acd79b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java @@ -120,7 +120,7 @@ public class TagCommand extends GitCommand<Ref> { // if no id is set, we should attempt to use HEAD if (id == null) { - ObjectId objectId = repo.resolve(Constants.HEAD + "^{commit}"); + ObjectId objectId = repo.resolve(Constants.HEAD + "^{commit}"); //$NON-NLS-1$ if (objectId == null) throw new NoHeadException( JGitText.get().tagOnRepoWithoutHEADCurrentlyNotSupported); @@ -142,7 +142,7 @@ public class TagCommand extends GitCommand<Ref> { RefUpdate tagRef = repo.updateRef(refName); tagRef.setNewObjectId(tagId); tagRef.setForceUpdate(forceUpdate); - tagRef.setRefLogMessage("tagged " + name, false); + tagRef.setRefLogMessage("tagged " + name, false); //$NON-NLS-1$ Result updateResult = tagRef.update(revWalk); switch (updateResult) { case NEW: diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/ConcurrentRefUpdateException.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/ConcurrentRefUpdateException.java index a6ab5bc66d..b5e87f1f5c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/ConcurrentRefUpdateException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/ConcurrentRefUpdateException.java @@ -62,7 +62,7 @@ public class ConcurrentRefUpdateException extends GitAPIException { */ public ConcurrentRefUpdateException(String message, Ref ref, RefUpdate.Result rc, Throwable cause) { - super((rc == null) ? message : message + ". " + super((rc == null) ? message : message + ". " //$NON-NLS-1$ + MessageFormat.format(JGitText.get().refUpdateReturnCodeWas, rc), cause); this.rc = rc; this.ref = ref; @@ -75,7 +75,7 @@ public class ConcurrentRefUpdateException extends GitAPIException { */ public ConcurrentRefUpdateException(String message, Ref ref, RefUpdate.Result rc) { - super((rc == null) ? message : message + ". " + super((rc == null) ? message : message + ". " //$NON-NLS-1$ + MessageFormat.format(JGitText.get().refUpdateReturnCodeWas, rc)); this.rc = rc; this.ref = ref; |