Browse Source

debug-rebuild-ref-tree: Add --enable flag to turn the database on

Change-Id: Iad8ebdb0c4c0ad6dcd2b12dd56ffe1be6a20840f
stable-4.3
Shawn Pearce 9 years ago
parent
commit
e1529ced42
  1. 14
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java

14
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java

@ -57,12 +57,17 @@ import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefDatabase;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.pgm.Command;
import org.eclipse.jgit.pgm.TextBuiltin;
import org.eclipse.jgit.revwalk.RevWalk;
import org.kohsuke.args4j.Option;
@Command(usage = "usage_RebuildRefTree")
class RebuildRefTree extends TextBuiltin {
@Option(name = "--enable", usage = "set extensions.refsStorage = reftree")
boolean enable;
private String txnNamespace;
private String txnCommitted;
@ -122,6 +127,15 @@ class RebuildRefTree extends TextBuiltin {
default:
throw die(String.format("%s: %s", update.getName(), result)); //$NON-NLS-1$
}
if (enable && !(db.getRefDatabase() instanceof RefTreeDatabase)) {
StoredConfig cfg = db.getConfig();
cfg.setInt("core", null, "repositoryformatversion", 1); //$NON-NLS-1$ //$NON-NLS-2$
cfg.setString("extensions", null, "refsStorage", "reftree"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
cfg.save();
errw.println("Enabled reftree."); //$NON-NLS-1$
errw.flush();
}
}
}

Loading…
Cancel
Save