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

login
register
mail settings
Submitter Martin von Zweigbergk
Date Jan. 26, 2016, 12:02 a.m.
Message ID <14c76a66188ab9b58223.1453766541@waste.org>
Download mbox | patch
Permalink /patch/12888/
State Superseded
Headers show

Comments

Martin von Zweigbergk - Jan. 26, 2016, 12:02 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@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.

Patch

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