[PATCH] status: remove unreachable code for status between revisions

Mads Kiilerich mads at kiilerich.com
Thu Feb 24 07:07:09 CST 2011


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1298552768 -3600
# Branch stable
# Node ID 665eb1106e24964870394d2b7783ac501d57c8ed
# Parent  07a6460f829a6327682b150a348c33cdb03956a3
status: remove unreachable code for status between revisions

The manifest value of a file will never be false when "not parentworking", and
the expensive content comparision would thus fortunately never be reached.

Status against working directory is done elsewhere.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1222,8 +1222,7 @@
             for fn in mf2:
                 if fn in mf1:
                     if (mf1.flags(fn) != mf2.flags(fn) or
-                        (mf1[fn] != mf2[fn] and
-                         (mf2[fn] or ctx1[fn].cmp(ctx2[fn])))):
+                        mf1[fn] != mf2[fn]):
                         modified.append(fn)
                     elif listclean:
                         clean.append(fn)
diff --git a/tests/test-status.t b/tests/test-status.t
--- a/tests/test-status.t
+++ b/tests/test-status.t
@@ -272,3 +272,30 @@
     modified
   R removed
   C deleted
+
+hg status between revisions:
+
+  $ echo c1 > f1
+  $ hg ci -Amm f1
+  $ echo c2 > f1
+  $ echo c1 > f2
+  $ hg ci -Amm f1 f2
+  $ echo c1 > f1
+  $ hg st --rev -1:.
+  M f1
+  $ hg st --rev -2:.
+  M f1
+  A f2
+  $ hg ci -Amm f1
+  $ hg st --rev -1:-3
+  M f1
+  R f2
+  $ hg st --rev -3:-1
+  M f1
+  A f2
+  $ hg diff --rev -3:-1
+  diff -r c861ab34bf5f -r 168d05852219 f2
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/f2	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +c1


More information about the Mercurial-devel mailing list