Patchwork [4,of,6] status: handle more node indicators in buildstatus

login
register
mail settings
Submitter Durham Goode
Date March 3, 2017, 7:34 p.m.
Message ID <78e0fb2bd1bc972444ae.1488569659@dev111.prn1.facebook.com>
Download mbox | patch
Permalink /patch/18901/
State Accepted
Delegated to: Martin von Zweigbergk
Headers show

Comments

Durham Goode - March 3, 2017, 7:34 p.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1488566235 28800
#      Fri Mar 03 10:37:15 2017 -0800
# Node ID 78e0fb2bd1bc972444ae08e7b7165da66cbf53a3
# Parent  883bb49a3b40609074d56257aab7619f0c306efc
status: handle more node indicators in buildstatus

There are several different node markers that indicate different working copy
states. The context._buildstatus function was only handling one of them, and
this patch makes it handle all of them (falling back to file content comparisons
when in one of these states).

This affects a future patch where we get rid of context._manifestmatches as part
of getting rid of manifest.matches(). context._manifestmatches is currently
hacky in that it uses the newnodeid for all added and modified files, which is
why the current newnodeid check is sufficient. When we get rid of this function
and use the normal manifest.diff function, we start to see the other indicators
in the nodes, so they need to be handled or else the tests fail.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -23,6 +23,7 @@  from .node import (
     nullrev,
     short,
     wdirid,
+    wdirnodes,
 )
 from . import (
     encoding,
@@ -140,7 +141,7 @@  class basectx(object):
                 removed.append(fn)
             elif flag1 != flag2:
                 modified.append(fn)
-            elif node2 != newnodeid:
+            elif node2 not in wdirnodes:
                 # 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