Patchwork [2,of,8] identify: simplify the dirty check

mail settings
Submitter Matt Harbison
Date July 9, 2017, 11:34 p.m.
Message ID <09a3c95bdd28d00bc007.1499643290@Envy>
Download mbox | patch
Permalink /patch/22186/
State Accepted
Headers show


Matt Harbison - July 9, 2017, 11:34 p.m.
# HG changeset patch
# User Matt Harbison <>
# Date 1499573943 14400
#      Sun Jul 09 00:19:03 2017 -0400
# Node ID 09a3c95bdd28d00bc0071a4ade1ab31cf61262b2
# Parent  19ffd0a7aa46964067e35dd6a092adac2c238502
identify: simplify the dirty check

This is equivalent to the previous code, but it seems better to be explicit
about what aspects of dirty are being ignored.  Perhaps they shouldn't be, since
the help text says 'followed by a "+" if the working directory has uncommitted
changes'.  Both merges and branch changes are committable, even if the files are

Additionally, this will make the `identify` command notice missing subrepo
files, once subrepos are taught to look for missing files.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -2775,8 +2775,7 @@ 
             dirty = ""
-            if (any(repo.status())
-                or any(ctx.sub(s).dirty() for s in ctx.substate)):
+            if ctx.dirty(missing=True, merge=False, branch=False):
                 dirty = '+'