aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-12-14 23:06:47 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2019-12-15 10:15:49 +0100
commitdbe915def18d9b4dbadfc972d648aaa38462cd17 (patch)
tree38f90355da56719b57a78945df50de3e57bf1877
parent83f90a274cc8629caadb7ee3a1838be5e5c12b33 (diff)
downloadjgit-dbe915def18d9b4dbadfc972d648aaa38462cd17.tar.gz
jgit-dbe915def18d9b4dbadfc972d648aaa38462cd17.zip
pgm: add option to configure if convert-ref-storage should create backup
Change-Id: I926f116797508a5982961dfd30c2f765d9536eee Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties3
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ConvertRefStorage.java7
2 files changed, 9 insertions, 1 deletions
diff --git a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
index 02f0543206..bce2892c20 100644
--- a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
+++ b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
@@ -5,6 +5,8 @@
#
# default meta variable defined in the org.kohsuke.args4j.spi.StringOptionHandler
VAL=VAL
+# default meta variable defined in the org.kohsuke.args4j.spi.ExplicitBooleanOptionHandler
+VALUE=VAL
# default meta variable defined in the org.kohsuke.args4j.spi.StopOptionHandler
ARGUMENTS=ARGUMENTS
# default meta variable defined in the org.kohsuke.args4j.spi.OneArgumentOptionHandler
@@ -327,6 +329,7 @@ usage_configLocal=use local configuration in .git/config
usage_configSystem=use system-wide configuration in $(prefix)/etc/gitconfig
usage_configureTheServiceInDaemonServicename=configure the service in daemon.servicename
usage_convertRefStorage=Convert ref storage to reftable
+usage_convertRefStorageBackup=Create backup of old ref storage format
usage_convertRefStorageFormat=Format to convert to (reftable or refdir)
usage_createBranchAndCheckout=create branch and check out
usage_deleteBranchEvenIfNotMerged=delete branch (even if not merged)
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ConvertRefStorage.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ConvertRefStorage.java
index a59b8852ed..3f3cd12a0e 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ConvertRefStorage.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ConvertRefStorage.java
@@ -45,6 +45,7 @@ package org.eclipse.jgit.pgm;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.kohsuke.args4j.Option;
+import org.kohsuke.args4j.spi.ExplicitBooleanOptionHandler;
@Command(common = true, usage = "usage_convertRefStorage")
class ConvertRefStorage extends TextBuiltin {
@@ -52,9 +53,13 @@ class ConvertRefStorage extends TextBuiltin {
@Option(name = "--format", usage = "usage_convertRefStorageFormat")
private String format = "reftable"; //$NON-NLS-1$
+ @Option(name = "--backup", handler = ExplicitBooleanOptionHandler.class, aliases = {
+ "-b" }, usage = "usage_convertRefStorageBackup")
+ private boolean backup = true;
+
/** {@inheritDoc} */
@Override
protected void run() throws Exception {
- ((FileRepository) db).convertRefStorage(format, true, true);
+ ((FileRepository) db).convertRefStorage(format, true, backup);
}
}