# HG changeset patch # User Durham Goode # Date 1426793511 25200 # Node ID 71240f696f269eab6371c1da33e7dd842d5b27a1 # Parent 658b0d03269945f74a10335002b7f5f682680b26 strip: add the option for wrapping the strip command Adds an experimental option for wrapping the existing strip command and replacing its functionality with prune. It currently doesn't handle the --keep case, but an upcoming patch will address that. diff -r 658b0d032699 -r 71240f696f26 hgext/evolve.py --- a/hgext/evolve.py Thu Mar 19 12:32:32 2015 -0700 +++ b/hgext/evolve.py Thu Mar 19 12:31:51 2015 -0700 @@ -2096,6 +2096,31 @@ if lock is not None: lock.release() +@eh.wrapcommand('strip', extension='strip', opts=[ + ('', 'bundle', None, _("delete the commit entirely and move it to a " + "backup bundle")), + ]) +def stripwrapper(orig, ui, repo, *revs, **kwargs): + if (not ui.configbool('experimental', 'prunestrip') or + kwargs.get('bundle', False)): + return orig(ui, repo, *revs, **kwargs) + + if kwargs.get('force'): + ui.warn(_("warning: --force has no effect during strip with evolve " + "enabled\n")) + if kwargs.get('no_backup', False): + ui.warn(_("warning: --no-backup has no effect during strips with " + "evolve enabled\n")) + + revs = list(revs) + kwargs.pop('rev', []) + revs = set(scmutil.revrange(repo, revs)) + revs = repo.revs("(%ld)::", revs) + kwargs['rev'] = [] + kwargs['new'] = [] + kwargs['succ'] = [] + kwargs['biject'] = False + return cmdprune(ui, repo, *revs, **kwargs) + @command('^touch', [('r', 'rev', [], 'revision to update'), ('D', 'duplicate', False, diff -r 658b0d032699 -r 71240f696f26 tests/test-prune.t --- a/tests/test-prune.t Thu Mar 19 12:32:32 2015 -0700 +++ b/tests/test-prune.t Thu Mar 19 12:31:51 2015 -0700 @@ -223,6 +223,21 @@ cb7f8f706a6532967b98cf8583a81baab79a0fa7 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 (*) {'user': 'test'} (glob) 21b6f2f1cece8c10326e575dd38239189d467190 6e8148413dd541855b72a920a90c06fca127c7e7 0 (*) {'user': 'test'} (glob) +test hg strip replacement + + $ hg up 10 + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ mkcommit n1 + created new head + $ mkcommit n2 + $ hg --config extensions.strip= --config experimental.prunestrip=True strip -r . + 1 changesets pruned + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + working directory now at c7e58696a948 + $ hg --config extensions.strip= --config experimental.prunestrip=True strip -r . --bundle + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + saved backup bundle to $TESTTMP/repo/.hg/strip-backup/c7e58696a948-69ca36d3-backup.hg (glob) + test hg prune -B bookmark yoinked from test-mq-strip.t