diff hgext/evolve.py @ 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
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,