Mercurial > evolve
changeset 1220:71240f696f26
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.
author | Durham Goode <durham@fb.com> |
---|---|
date | Thu, 19 Mar 2015 12:31:51 -0700 |
parents | 658b0d032699 |
children | 524dbc8ffeac |
files | hgext/evolve.py tests/test-prune.t |
diffstat | 2 files changed, 40 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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,
--- 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