uncommit: add --all option
authorPatrick Mezard <patrick@mezard.eu>
Sat, 23 Jun 2012 19:24:37 +0200
changeset 314 ebd286f06879
parent 313 47d10459fa24
child 315 4bbc17716f5a
uncommit: add --all option Convenient when combined with --exclude.
hgext/evolve.py
tests/test-uncommit.t
--- a/hgext/evolve.py	Tue Jun 26 16:12:52 2012 +0200
+++ b/hgext/evolve.py	Sat Jun 23 19:24:37 2012 +0200
@@ -564,7 +564,8 @@
         ds.copy(src, dst)
 
 @command('^uncommit',
-    [] + commands.walkopts,
+    [('a', 'all', None, _('uncommit all changes when no arguments given')),
+     ] + commands.walkopts,
     _('[OPTION]... [NAME]'))
 def uncommit(ui, repo, *pats, **opts):
     """move changes from parent revision to working directory
@@ -597,7 +598,8 @@
             updatebookmarks = _bookmarksupdater(repo, old.node())
             # Recommit the filtered changeset
             newid = None
-            if pats or opts.get('include') or opts.get('exclude'):
+            if (pats or opts.get('include') or opts.get('exclude')
+                or opts.get('all')):
                 match = scmutil.match(old, pats, opts)
                 newid = _commitfiltered(repo, old, match)
             if newid is None:
--- a/tests/test-uncommit.t	Tue Jun 26 16:12:52 2012 +0200
+++ b/tests/test-uncommit.t	Sat Jun 23 19:24:37 2012 +0200
@@ -277,3 +277,31 @@
   $ hg debugsuccessors
   5eb72dbe0cb4 c706fe2c12f8
   5eb72dbe0cb4 e8db4aa611f6
+
+Test --all
+
+  $ hg up -C 3
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  Working directory parent is obsolete
+  $ hg --config extensions.purge= purge
+  $ hg uncommit --all -X e
+  $ hg st --copies
+  M b
+  M d
+  M j
+  M o
+  A aa
+    a
+  A ff
+    f
+  A h
+    g
+  A k
+  A l
+  R c
+  R f
+  R g
+  R m
+  R n
+  $ hg st --copies --change .
+  A e