From 244b1580b5155099bfdf98692d76c1b2a6183126 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 1 Sep 2010 09:34:43 -0700 Subject: [PATCH] log, diff: Add --src-prefix, --dst-prefix, --no-prefix Change-Id: I0c7154a51143d56362f12ee4fa93133778d3a9eb Signed-off-by: Shawn O. Pearce --- .../org/eclipse/jgit/pgm/CLIText.properties | 3 +++ .../src/org/eclipse/jgit/pgm/Diff.java | 16 ++++++++++++++++ .../src/org/eclipse/jgit/pgm/Log.java | 16 ++++++++++++++++ 3 files changed, 35 insertions(+) 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 e7dce1bf55..99878f14c8 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 @@ -152,6 +152,7 @@ usage_displayAListOfAllRegisteredJgitCommands=Display a list of all registered j usage_displayAllPossibleMergeBases=display all possible merge bases usage_displayThejavaStackTraceOnExceptions=display the Java stack trace on exceptions usage_displayThisHelpText=display this help text +usage_dstPrefix=show the destination prefix instead of "b/" usage_enableTheServiceInAllRepositories=enable the service in all repositories usage_exportRepositoriesOverGit=Export repositories over git:// usage_exportWithoutGitDaemonExportOk=export without git-daemon-export-ok @@ -168,6 +169,7 @@ usage_listCreateOrDeleteBranches=List, create, or delete branches usage_logAllPretty=format:%H %ct %P' output=log --all '--pretty=format:%H %ct %P' output usage_moveRenameABranch=move/rename a branch usage_nameStatus=show only name and status of files +usage_noPrefix=do not show any source or destination prefix usage_noRenames=disable rename detection usage_outputFile=Output file usage_path=path @@ -181,6 +183,7 @@ usage_renameLimit=limit size of rename matrix usage_setTheGitRepositoryToOperateOn=set the git repository to operate on usage_showRefNamesMatchingCommits=Show ref names matching commits usage_showPatch=display patch +usage_srcPrefix=show the source prefix instead of "a/" usage_symbolicVersionForTheProject=Symbolic version for the project usage_synchronizeIPZillaData=Synchronize IPZilla data usage_tagMessage=tag message diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java index b6650a4ea1..ec939b37e4 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java @@ -131,6 +131,22 @@ class Diff extends TextBuiltin { diffFmt.setAbbreviationLength(Constants.OBJECT_ID_STRING_LENGTH); } + @Option(name = "--src-prefix", usage = "usage_srcPrefix") + void sourcePrefix(String path) { + diffFmt.setOldPrefix(path); + } + + @Option(name = "--dst-prefix", usage = "usage_dstPrefix") + void dstPrefix(String path) { + diffFmt.setNewPrefix(path); + } + + @Option(name = "--no-prefix", usage = "usage_noPrefix") + void noPrefix(@SuppressWarnings("unused") boolean on) { + diffFmt.setOldPrefix(""); + diffFmt.setNewPrefix(""); + } + // END -- Options shared with Log @Override diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java index 2b29f73385..8eb2e54dc5 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java @@ -139,6 +139,22 @@ class Log extends RevWalkTextBuiltin { diffFmt.setAbbreviationLength(Constants.OBJECT_ID_STRING_LENGTH); } + @Option(name = "--src-prefix", usage = "usage_srcPrefix") + void sourcePrefix(String path) { + diffFmt.setOldPrefix(path); + } + + @Option(name = "--dst-prefix", usage = "usage_dstPrefix") + void dstPrefix(String path) { + diffFmt.setNewPrefix(path); + } + + @Option(name = "--no-prefix", usage = "usage_noPrefix") + void noPrefix(@SuppressWarnings("unused") boolean on) { + diffFmt.setOldPrefix(""); + diffFmt.setNewPrefix(""); + } + // END -- Options shared with Diff Log() { -- 2.39.5