|
|
@ -57,12 +57,17 @@ import org.eclipse.jgit.lib.PersonIdent; |
|
|
|
import org.eclipse.jgit.lib.Ref; |
|
|
|
import org.eclipse.jgit.lib.Ref; |
|
|
|
import org.eclipse.jgit.lib.RefDatabase; |
|
|
|
import org.eclipse.jgit.lib.RefDatabase; |
|
|
|
import org.eclipse.jgit.lib.RefUpdate; |
|
|
|
import org.eclipse.jgit.lib.RefUpdate; |
|
|
|
|
|
|
|
import org.eclipse.jgit.lib.StoredConfig; |
|
|
|
import org.eclipse.jgit.pgm.Command; |
|
|
|
import org.eclipse.jgit.pgm.Command; |
|
|
|
import org.eclipse.jgit.pgm.TextBuiltin; |
|
|
|
import org.eclipse.jgit.pgm.TextBuiltin; |
|
|
|
import org.eclipse.jgit.revwalk.RevWalk; |
|
|
|
import org.eclipse.jgit.revwalk.RevWalk; |
|
|
|
|
|
|
|
import org.kohsuke.args4j.Option; |
|
|
|
|
|
|
|
|
|
|
|
@Command(usage = "usage_RebuildRefTree") |
|
|
|
@Command(usage = "usage_RebuildRefTree") |
|
|
|
class RebuildRefTree extends TextBuiltin { |
|
|
|
class RebuildRefTree extends TextBuiltin { |
|
|
|
|
|
|
|
@Option(name = "--enable", usage = "set extensions.refsStorage = reftree") |
|
|
|
|
|
|
|
boolean enable; |
|
|
|
|
|
|
|
|
|
|
|
private String txnNamespace; |
|
|
|
private String txnNamespace; |
|
|
|
private String txnCommitted; |
|
|
|
private String txnCommitted; |
|
|
|
|
|
|
|
|
|
|
@ -122,6 +127,15 @@ class RebuildRefTree extends TextBuiltin { |
|
|
|
default: |
|
|
|
default: |
|
|
|
throw die(String.format("%s: %s", update.getName(), result)); //$NON-NLS-1$
|
|
|
|
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(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|