[PATCH 4 of 5 RFC] xxx-context: account for files not in p1() when determining memctx status

Matt Harbison mharbison72 at gmail.com
Fri Jul 27 14:10:11 EDT 2018


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1531513454 14400
#      Fri Jul 13 16:24:14 2018 -0400
# Branch stable
# Node ID 08d713c87cb51e5987e44a63ac2323fe64852f1f
# Parent  07b5425f78bb30033a7922bfc99defeddbc9746f
xxx-context: account for files not in p1() when determining memctx status

This fixes most of the errors introduced in the last change.  It does break the
bzr conversion change in the previous test.  basectx._buildstatus() doesn't do
this (at least not explicitly), so I'm not sure why this helps the other tests.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -2313,8 +2313,9 @@ class memctx(committablectx):
                 modctx = lambda f, ctx: f in ctx and ctx[f].cmp(self[f])
                 if modflags(f) or modctx(f, self.p1()):
                     modified.append(f)
-                elif p2.node() != nullid and modctx(f, self.p2()):
-                    modified.append(f)
+                elif p2.node() != nullid:
+                    if f not in self.p1() or modctx(f, self.p2()):
+                        modified.append(f)
 
         return scmutil.status(modified, added, removed, [], [], [], [])
 
diff --git a/tests/test-convert-bzr-merges.t b/tests/test-convert-bzr-merges.t
--- a/tests/test-convert-bzr-merges.t
+++ b/tests/test-convert-bzr-merges.t
@@ -52,9 +52,9 @@ BUG: file-branch2 should not be added in
   1 Added brach2 file
   0 Merged branches
   $ glog -R source-hg
-  o    5 at source "(octopus merge fixup)" files+: [file-branch1], files-: [], files: []
+  o    5 at source "(octopus merge fixup)" files+: [], files-: [], files: []
   |\
-  | o    4 at source "Merged branches" files+: [file-branch2], files-: [], files: [file]
+  | o    4 at source "Merged branches" files+: [file-branch1 file-branch2], files-: [], files: [file]
   | |\
   o---+  3 at source-branch2 "Added brach2 file" files+: [file-branch2], files-: [], files: []
    / /
@@ -85,13 +85,14 @@ BUG: file-branch2 should not be added in
   $ hg -R hg2hg out source-hg -T compact
   comparing with source-hg
   searching for changes
-  no changes found
-  [1]
+  5[tip]:4,3   6bd55e826939   2009-10-10 08:00 +0100   foo
+    (octopus merge fixup)
+  
 
   $ glog -R hg2hg
-  o    5 at source "(octopus merge fixup)" files+: [file-branch1], files-: [], files: []
+  o    5 at source "(octopus merge fixup)" files+: [], files-: [], files: []
   |\
-  | o    4 at source "Merged branches" files+: [file-branch2], files-: [], files: [file]
+  | o    4 at source "Merged branches" files+: [file-branch1 file-branch2], files-: [], files: [file]
   | |\
   o---+  3 at source-branch2 "Added brach2 file" files+: [file-branch2], files-: [], files: []
    / /
@@ -105,32 +106,30 @@ XXX: The manifest lines should probably 
 converting hg -> hg
 
   $ hg -R source-hg log --debug -r tip
-  changeset:   5:9a3615c5d6c5613201e36f67a30eedc61e56952d
+  changeset:   5:b209510f11b2c987f920749cd8e352aa4b3230f2
   branch:      source
   tag:         tip
   phase:       draft
-  parent:      4:84daffe269016d606de8dd101b5a47742394fb63
+  parent:      4:1dc38c377bb35eeea4fa955056fbe4440d54a743
   parent:      3:4aaba1bfb426b8941bbf63f9dd52301152695164
-  manifest:    5:8ed636f9e66e51873a9df3749c40e8b53d7d1cc9
+  manifest:    5:1109e42bdcbd1f51baa69bc91079011d77057dbb
   user:        Foo Bar <foo.bar at example.com>
   date:        Sat Oct 10 08:00:04 2009 +0100
-  files+:      file-branch1
   extra:       branch=source
   description:
   (octopus merge fixup)
   
   
   $ hg -R hg2hg log --debug -r tip
-  changeset:   5:9a3615c5d6c5613201e36f67a30eedc61e56952d
+  changeset:   5:6bd55e8269392769783345686faf7ff7b3b0215d
   branch:      source
   tag:         tip
   phase:       draft
-  parent:      4:84daffe269016d606de8dd101b5a47742394fb63
+  parent:      4:1dc38c377bb35eeea4fa955056fbe4440d54a743
   parent:      3:4aaba1bfb426b8941bbf63f9dd52301152695164
-  manifest:    5:8ed636f9e66e51873a9df3749c40e8b53d7d1cc9
+  manifest:    4:daa315d56a98ba20811fdd0d9d575861f65cfa8c
   user:        Foo Bar <foo.bar at example.com>
   date:        Sat Oct 10 08:00:04 2009 +0100
-  files+:      file-branch1
   extra:       branch=source
   description:
   (octopus merge fixup)
@@ -143,6 +142,7 @@ converting hg -> hg
   7108421418404a937c684d2479a34a24d2ce4757 644   file-parent
   $ hg -R source-hg manifest --debug -r 'tip^'
   cdf31ed9242b209cd94697112160e2c5b37a667d 644   file
+  5108144f585149b29779d7c7e51d61dd22303ffe 644   file-branch1
   80753c4a9ac3806858405b96b24a907b309e3616 644   file-branch2
   7108421418404a937c684d2479a34a24d2ce4757 644   file-parent
 
@@ -153,6 +153,7 @@ converting hg -> hg
   7108421418404a937c684d2479a34a24d2ce4757 644   file-parent
   $ hg -R hg2hg manifest --debug -r 'tip^'
   cdf31ed9242b209cd94697112160e2c5b37a667d 644   file
+  5108144f585149b29779d7c7e51d61dd22303ffe 644   file-branch1
   80753c4a9ac3806858405b96b24a907b309e3616 644   file-branch2
   7108421418404a937c684d2479a34a24d2ce4757 644   file-parent
 
diff --git a/tests/test-convert-hg-source.t b/tests/test-convert-hg-source.t
--- a/tests/test-convert-hg-source.t
+++ b/tests/test-convert-hg-source.t
@@ -71,12 +71,54 @@ Make and delete some tags
   $ hg out ../orig
   comparing with ../orig
   searching for changes
-  no changes found
-  [1]
+  changeset:   2:8cf1566ebff4
+  parent:      0:d2defcc3350a
+  user:        test
+  date:        Thu Jan 01 00:00:02 1970 +0000
+  summary:     make bar and baz copies of foo
+  
+  changeset:   3:f1f737ef39ac
+  bookmark:    premerge1
+  parent:      2:8cf1566ebff4
+  parent:      1:1044fe9f955c
+  user:        test
+  date:        Thu Jan 01 00:00:03 1970 +0000
+  summary:     merge local copy
+  
+  changeset:   4:e959eea32878
+  parent:      1:1044fe9f955c
+  parent:      2:8cf1566ebff4
+  user:        test
+  date:        Thu Jan 01 00:00:04 1970 +0000
+  summary:     merge remote copy
+  
+  changeset:   5:06f8ebdac6d7
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     Added tag that for changeset e959eea32878
+  
+  changeset:   6:1795d6a22d39
+  tag:         this
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     Removed tag that
+  
+  changeset:   7:619db2420df9
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     Added tag this for changeset 1795d6a22d39
+  
+  changeset:   8:5c6e00472b57
+  bookmark:    premerge2
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:05 1970 +0000
+  summary:     mark baz executable
+  
 #if execbit
   $ hg bookmarks
-     premerge1                 3:973ef48a98a4
-     premerge2                 8:91d107c423ba
+     premerge1                 3:f1f737ef39ac
+     premerge2                 8:5c6e00472b57
 #else
 Different hash because no x bit
   $ hg bookmarks
@@ -104,11 +146,11 @@ Test that redoing a convert results in a
   $ hg -R new log -G -T '{rev} {desc}'
   o  8 mark baz executable
   |
-  o  7 Added tag this for changeset c56a7f387039
+  o  7 Added tag this for changeset 1795d6a22d39
   |
   o  6 Removed tag that
   |
-  o  5 Added tag that for changeset 88586c4e9f02
+  o  5 Added tag that for changeset e959eea32878
   |
   o    4 merge remote copy
   |\
diff --git a/tests/test-convert-svn-branches.t b/tests/test-convert-svn-branches.t
--- a/tests/test-convert-svn-branches.t
+++ b/tests/test-convert-svn-branches.t
@@ -85,8 +85,8 @@ Convert again
   $ hg branches
   newbranch                     11:a6d7cc050ad1
   default                       10:6e2b33404495
-  old                            9:93c4b0f99529
-  old2                           8:b52884d7bead (inactive)
+  old                            9:1b494af68c0b
+  old2                           8:5be40b8dcbf6 (inactive)
   $ hg tags -q
   tip
   $ cd ..
diff --git a/tests/test-fix.t b/tests/test-fix.t
--- a/tests/test-fix.t
+++ b/tests/test-fix.t
@@ -830,9 +830,9 @@ no ancestors that are replaced.
   
   $ hg fix -r 0:2
   $ hg log --graph --template '{node|shortest} {files}'
-  o  3801 bar.whole
+  o  b4e2 bar.whole
   |
-  o  38cc
+  o  59f4
   |
   | @  bc05 bar.whole
   | |
diff --git a/tests/test-paths.t b/tests/test-paths.t
--- a/tests/test-paths.t
+++ b/tests/test-paths.t
@@ -132,10 +132,8 @@ output:
 zeroconf wraps ui.configitems(), which shouldn't crash at least:
 
   $ hg paths --config extensions.zeroconf=
-  dupe = $TESTTMP/b#tip
-  dupe:pushurl = https://example.com/dupe
-  expand = $TESTTMP/a/$SOMETHING/bar
-  insecure = http://foo:***@example.com/
+  abort: No such device
+  [255]
 
   $ cd ..
 


More information about the Mercurial-devel mailing list