From dbe915def18d9b4dbadfc972d648aaa38462cd17 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Sat, 14 Dec 2019 23:06:47 +0100 Subject: [PATCH] pgm: add option to configure if convert-ref-storage should create backup Change-Id: I926f116797508a5982961dfd30c2f765d9536eee Signed-off-by: Matthias Sohn --- .../org/eclipse/jgit/pgm/internal/CLIText.properties | 3 +++ .../src/org/eclipse/jgit/pgm/ConvertRefStorage.java | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) 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 02f054320..bce2892c2 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 a59b8852e..3f3cd12a0 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); } }