Patchwork [4,of,8] cmdutil: simplify the dirty check in howtocontinue()

login
register
mail settings
Submitter Matt Harbison
Date July 9, 2017, 11:34 p.m.
Message ID <3026ee006b20cf266d90.1499643292@Envy>
Download mbox | patch
Permalink /patch/22188/
State Accepted
Headers show

Comments

Matt Harbison - July 9, 2017, 11:34 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1499575996 14400
#      Sun Jul 09 00:53:16 2017 -0400
# Node ID 3026ee006b20cf266d90181edbc9e2061cce8f92
# Parent  fca94a77d9cac7b60a44444b152fcb42ddb4dd1a
cmdutil: simplify the dirty check in howtocontinue()

This is equivalent to the previous code.  But it seems to me that if the user is
going to be prompted that a commit is needed, missing files should be ignored,
but branch and merge changes shouldn't be.
Yuya Nishihara - July 10, 2017, 2:29 p.m.
On Sun, 09 Jul 2017 19:34:52 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1499575996 14400
> #      Sun Jul 09 00:53:16 2017 -0400
> # Node ID 3026ee006b20cf266d90181edbc9e2061cce8f92
> # Parent  fca94a77d9cac7b60a44444b152fcb42ddb4dd1a
> cmdutil: simplify the dirty check in howtocontinue()

Great. Queued up to here, thanks.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3547,10 +3547,7 @@ 
     for f, msg in afterresolvedstates:
         if repo.vfs.exists(f):
             return contmsg % msg, True
-    workingctx = repo[None]
-    dirty = any(repo.status()) or any(workingctx.sub(s).dirty()
-                                         for s in workingctx.substate)
-    if dirty:
+    if repo[None].dirty(missing=True, merge=False, branch=False):
         return contmsg % _("hg commit"), False
     return None, None