Browse Source

pgm: add option to configure if convert-ref-storage should create backup

Change-Id: I926f116797508a5982961dfd30c2f765d9536eee
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-5.7
Matthias Sohn 5 years ago
parent
commit
dbe915def1
  1. 3
      org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
  2. 7
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ConvertRefStorage.java

3
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)

7
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);
}
}

Loading…
Cancel
Save