[PATCH STABLE v2] context: back out sneaky code change in documentation change

Martin von Zweigbergk martinvonz at google.com
Tue Jan 26 00:03:11 UTC 2016


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1453765715 28800
#      Mon Jan 25 15:48:35 2016 -0800
# Branch stable
# Node ID 14c76a66188ab9b58223dbbe95950029bdd893af
# Parent  cfe7da66f5550c539a4b8bf46772e1366687f60c
context: back out sneaky code change in documentation change

In 81b391a45264 (context: clarify why we don't compare file contents
when nodeid differs, 2016-01-12), I also changed "node2 != _newnode"
into "self.rev() is not None". I don't remember why. They are similar,
but the former also catches the case where the file is clean in the
dirstate (so node2 is not _newnode), but different from the "other"
context. This resulted in unnecessary file content comparison a few
lines further down in the code. Let's just back out the code change.

Thanks to Durham Goode for spotting this.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -142,7 +142,7 @@
                 removed.append(fn)
             elif flag1 != flag2:
                 modified.append(fn)
-            elif self.rev() is not None:
+            elif node2 != _newnode:
                 # When comparing files between two commits, we save time by
                 # not comparing the file contents when the nodeids differ.
                 # Note that this means we incorrectly report a reverted change


More information about the Mercurial-devel mailing list