Patchwork D2891: uncommit: simplify condition for keeping commit

login
register
mail settings
Submitter phabricator
Date March 17, 2018, 5:36 p.m.
Message ID <96fd50279a428b9e80e92f6d6b3ff8c5@localhost.localdomain>
Download mbox | patch
Permalink /patch/29584/
State Not Applicable
Headers show

Comments

phabricator - March 17, 2018, 5:36 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6c263f319e89: uncommit: simplify condition for keeping commit (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2891?vs=7090&id=7092

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

AFFECTED FILES
  hgext/uncommit.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/hgext/uncommit.py b/hgext/uncommit.py
--- a/hgext/uncommit.py
+++ b/hgext/uncommit.py
@@ -51,7 +51,7 @@ 
 # leave the attribute unspecified.
 testedwith = 'ships-with-hg-core'
 
-def _commitfiltered(repo, ctx, match, allowempty):
+def _commitfiltered(repo, ctx, match, keepcommit):
     """Recommit ctx with changed files not in match. Return the new
     node identifier, or None if nothing changed.
     """
@@ -66,7 +66,7 @@ 
 
     files = (initialfiles - exclude)
     # return the p1 so that we don't create an obsmarker later
-    if not files and not allowempty:
+    if not keepcommit:
         return ctx.parents()[0].node()
 
     # Filter copies
@@ -169,8 +169,8 @@ 
 
         with repo.transaction('uncommit'):
             match = scmutil.match(old, pats, opts)
-            allowempty = opts.get('keep') or pats
-            newid = _commitfiltered(repo, old, match, allowempty)
+            keepcommit = opts.get('keep') or pats
+            newid = _commitfiltered(repo, old, match, keepcommit)
             if newid is None:
                 ui.status(_("nothing to uncommit\n"))
                 return 1