[PATCH] identify: rename 'changed' keyword -> 'dirty'

Matt Harbison mharbison72 at gmail.com
Sun Jun 25 18:59:38 EDT 2017


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1498427195 14400
#      Sun Jun 25 17:46:35 2017 -0400
# Node ID a49ab7f5e7e765a94a1dfab2ee3b1da695789eb6
# Parent  ef46d432e2e4cfecafb1faa4765254bf0650d4ef
identify: rename 'changed' keyword -> 'dirty'

I meant to do this before sending the initial templater support, but forgot.

I'm quite surprised that 'dirty' doesn't occur in more user facing contexts, but
there are a few, like the help for blackbox.  It also more obviously mirrors the
'(clean)' state printed by the summary command.  I also didn't like that it was
just one letter off from {changes} in the {latesttags} sub-keywords, which has a
totally different meaning.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2775,20 +2775,20 @@
             for p in parents:
                 taglist.extend(p.tags())
 
-            changed = ""
+            dirty = ""
             if (any(repo.status())
                 or any(ctx.sub(s).dirty() for s in ctx.substate)):
-                changed = '+'
-            fm.data(changed=changed)
+                dirty = '+'
+            fm.data(dirty=dirty)
 
             hexoutput = [hexfunc(p.node()) for p in parents]
             if default or id:
-                output = ["%s%s" % ('+'.join(hexoutput), changed)]
-            fm.data(id="%s%s" % ('+'.join(hexoutput), changed))
+                output = ["%s%s" % ('+'.join(hexoutput), dirty)]
+            fm.data(id="%s%s" % ('+'.join(hexoutput), dirty))
 
             if num:
                 numoutput = ["%d" % p.rev() for p in parents]
-                output.append("%s%s" % ('+'.join(numoutput), changed))
+                output.append("%s%s" % ('+'.join(numoutput), dirty))
 
             for i, p in enumerate(parents):
                 fn = fm.nested('p%d' % (i + 1))
diff --git a/tests/test-identify.t b/tests/test-identify.t
--- a/tests/test-identify.t
+++ b/tests/test-identify.t
@@ -48,7 +48,7 @@
    {
     "bookmarks": [],
     "branch": "default",
-    "changed": "",
+    "dirty": "",
     "id": "cb9a9f314b8b",
     "node": "ffffffffffffffffffffffffffffffffffffffff",
     "p1": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}],
@@ -66,7 +66,7 @@
    {
     "bookmarks": [],
     "branch": "default",
-    "changed": "+",
+    "dirty": "+",
     "id": "cb9a9f314b8b+",
     "node": "ffffffffffffffffffffffffffffffffffffffff",
     "p1": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}],
diff --git a/tests/test-merge-default.t b/tests/test-merge-default.t
--- a/tests/test-merge-default.t
+++ b/tests/test-merge-default.t
@@ -54,7 +54,7 @@
    {
     "bookmarks": [],
     "branch": "default",
-    "changed": "+",
+    "dirty": "+",
     "id": "f25cbe84d8b3+2d95304fed5d+",
     "node": "ffffffffffffffffffffffffffffffffffffffff",
     "p1": [{"node": "f25cbe84d8b320e298e7703f18a25a3959518c23", "rev": 4}],


More information about the Mercurial-devel mailing list