D6069: uncommit: add flag --allow-dirty-working-copy

navaneeth.suresh (Navaneeth Suresh) phabricator at mercurial-scm.org
Wed Mar 6 08:39:29 EST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGaa284d9a33ca: uncommit: add flag --allow-dirty-working-copy (authored by navaneeth.suresh, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D6069?vs=14372&id=14375#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6069?vs=14372&id=14375

REVISION DETAIL
  https://phab.mercurial-scm.org/D6069

AFFECTED FILES
  hgext/uncommit.py
  tests/test-uncommit.t

CHANGE DETAILS

diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t
--- a/tests/test-uncommit.t
+++ b/tests/test-uncommit.t
@@ -34,9 +34,10 @@
   
   options ([+] can be repeated):
   
-      --keep                allow an empty commit after uncommiting
-   -I --include PATTERN [+] include names matching the given patterns
-   -X --exclude PATTERN [+] exclude names matching the given patterns
+      --keep                     allow an empty commit after uncommiting
+      --allow-dirty-working-copy allow uncommit with outstanding changes
+   -I --include PATTERN [+]      include names matching the given patterns
+   -X --exclude PATTERN [+]      exclude names matching the given patterns
   
   (some details hidden, use --verbose to show complete help)
 
@@ -156,11 +157,11 @@
   M files
   $ hg uncommit
   abort: uncommitted changes
-  (requires experimental.uncommitondirtywdir to uncommit)
+  (requires --allow-dirty-working-copy to uncommit)
   [255]
   $ hg uncommit files
   abort: uncommitted changes
-  (requires experimental.uncommitondirtywdir to uncommit)
+  (requires --allow-dirty-working-copy to uncommit)
   [255]
   $ cat files
   abcde
@@ -172,7 +173,7 @@
   $ echo "bar" >> files
   $ hg uncommit
   abort: uncommitted changes
-  (requires experimental.uncommitondirtywdir to uncommit)
+  (requires --allow-dirty-working-copy to uncommit)
   [255]
   $ hg uncommit --config experimental.uncommitondirtywdir=True
   $ hg commit -m "files abcde + foo"
@@ -395,7 +396,7 @@
 
   $ hg uncommit
   abort: outstanding uncommitted merge
-  (requires experimental.uncommitondirtywdir to uncommit)
+  (requires --allow-dirty-working-copy to uncommit)
   [255]
 
   $ hg uncommit --config experimental.uncommitondirtywdir=True
@@ -483,7 +484,7 @@
   note: keeping empty commit
   $ hg unc b
   abort: uncommitted changes
-  (requires experimental.uncommitondirtywdir to uncommit)
+  (requires --allow-dirty-working-copy to uncommit)
   [255]
   $ cat a
   super critical info!
@@ -497,7 +498,7 @@
   
   $ hg ci -Am 'add b'
   $ echo 'foo bar' > b
-  $ hg unc --config experimental.uncommitondirtywdir=True b
+  $ hg unc --allow-dirty-working-copy b
   $ hg log
   changeset:   3:30fa958635b2
   tag:         tip
diff --git a/hgext/uncommit.py b/hgext/uncommit.py
--- a/hgext/uncommit.py
+++ b/hgext/uncommit.py
@@ -140,6 +140,8 @@
 
 @command('uncommit',
     [('', 'keep', None, _('allow an empty commit after uncommiting')),
+     ('', 'allow-dirty-working-copy', False,
+    _('allow uncommit with outstanding changes'))
     ] + commands.walkopts,
     _('[OPTION]... [FILE]...'),
     helpcategory=command.CATEGORY_CHANGE_MANAGEMENT)
@@ -160,10 +162,11 @@
 
         m, a, r, d = repo.status()[:4]
         isdirtypath = any(set(m + a + r + d) & set(pats))
-        if (not repo.ui.configbool('experimental', 'uncommitondirtywdir') and
-            (not pats or isdirtypath)):
+        allowdirtywcopy = (opts['allow_dirty_working_copy'] or
+                    repo.ui.configbool('experimental', 'uncommitondirtywdir'))
+        if not allowdirtywcopy and (not pats or isdirtypath):
             cmdutil.bailifchanged(repo, hint=_('requires '
-                                'experimental.uncommitondirtywdir to uncommit'))
+                                '--allow-dirty-working-copy to uncommit'))
         old = repo['.']
         rewriteutil.precheck(repo, [old.rev()], 'uncommit')
         if len(old.parents()) > 1:



To: navaneeth.suresh, #hg-reviewers, pulkit
Cc: pulkit, mercurial-devel


More information about the Mercurial-devel mailing list