copies: add test that makes both the merging csets dirty and run w/o error
authorSushil khanchi <sushilkhanchi97@gmail.com>
Thu, 14 Feb 2019 17:11:35 +0530
changeset 41930 cbdd2b56d4c3
parent 41929 35e29a3aa441
child 41931 fc4b7a46fda1
copies: add test that makes both the merging csets dirty and run w/o error This series of patches is to cover a case in fullcopytracing algorithms where both the merging csets are not descendant of merge base. In this algorithm we call a merging cset "dirty" if that cset is not the descendant of merge base. That said, added test in this patch cover case when both the merging csets are "dirty". Actually this case of "both dirty" was encountered by Pulkit when he was working on content-divergence where it is possible that both the csets are not descendant of merging base. For reference you can look into: https://phab.mercurial-scm.org/D3896 As this test run fine without any error and correctly traced the copies, I added this test to make sure that it doesn't break even after I will modify some code in next patches to fix an error. Next patch adds the tests where this algorithm throws an error for the same case of "both dirty". Differential Revision: https://phab.mercurial-scm.org/D5961
tests/test-copies.t
--- a/tests/test-copies.t	Sun Mar 10 16:51:21 2019 -0400
+++ b/tests/test-copies.t	Thu Feb 14 17:11:35 2019 +0530
@@ -491,3 +491,64 @@
   $ hg debugpathcopies 0 5
   x -> z
 
+
+Test for a case in fullcopytracing algorithm where both the merging csets are
+"dirty"; where a dirty cset means that cset is descendant of merge base. This
+test reflect that for this particular case this algorithm correctly find the copies:
+
+  $ cat >> $HGRCPATH << EOF
+  > [experimental]
+  > evolution.createmarkers=True
+  > evolution.allowunstable=True
+  > EOF
+
+  $ newrepo
+  $ echo a > a
+  $ hg add a
+  $ hg ci -m "added a"
+  $ echo b > b
+  $ hg add b
+  $ hg ci -m "added b"
+
+  $ hg mv b b1
+  $ hg ci -m "rename b to b1"
+
+  $ hg up ".^"
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo d > d
+  $ hg add d
+  $ hg ci -m "added d"
+  created new head
+
+  $ echo baba >> b
+  $ hg ci --amend -m "added d, modified b"
+
+  $ hg l --hidden
+  @  4 added d, modified b
+  |  b d
+  | x  3 added d
+  |/   d
+  | o  2 rename b to b1
+  |/   b b1
+  o  1 added b
+  |  b
+  o  0 added a
+     a
+
+Grafting revision 4 on top of revision 2, showing that it respect the rename:
+
+  $ hg up 2 -q
+  $ hg graft -r 4 --base 3 --hidden
+  grafting 4:af28412ec03c "added d, modified b" (tip)
+  merging b1 and b to b1
+
+  $ hg l -l1 -p
+  @  5 added d, modified b
+  |  b1
+  ~  diff -r 5a4825cc2926 -r 94a2f1a0e8e2 b1
+     --- a/b1	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/b1	Thu Jan 01 00:00:00 1970 +0000
+     @@ -1,1 +1,2 @@
+      b
+     +baba
+