D5961: copies: add test that makes both the merging csets dirty and run w/o error

khanchi97 (Sushil khanchi) phabricator at mercurial-scm.org
Thu Feb 14 14:15:13 UTC 2019


khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Adding a test for fullcopytracing algorithm where both the merging csets
  are dirty, which means no cset is descendant of merging base.
  
  This test shows that for this particular case fullcopytracing algorithm
  worked and found the copies. But there are the cases when the algorithm
  can fail to handle this "both dirty" case and errors.
  
  Next couple of csets will add those test cases when it fails and fix for
  the same.
  
  Previous patch sent by Pulkit on the same issue is here:
  https://phab.mercurial-scm.org/D3896

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5961

AFFECTED FILES
  tests/test-copytrace-heuristics.t

CHANGE DETAILS

diff --git a/tests/test-copytrace-heuristics.t b/tests/test-copytrace-heuristics.t
--- a/tests/test-copytrace-heuristics.t
+++ b/tests/test-copytrace-heuristics.t
@@ -716,3 +716,112 @@
   saved backup bundle to $TESTTMP/repo/repo/repo/.hg/strip-backup/8b6e13696c38-fc14ac83-rebase.hg
   $ cd ..
   $ rm -rf repo
+
+Test for a in fullcopytracing algorithm where both the merging csets are dirty
+which means no cset is descendant of merging 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
+
+  $ hg init repo
+  $ cd repo
+  $ 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"
+
+  $ hg log --git -pG --hidden -T "{rev}: {node|short} {desc}\n {phase} \n\n"
+  @  4: d70f3e12cfd9 added d
+  |   draft
+  |
+  |  diff --git a/b b/b
+  |  --- a/b
+  |  +++ b/b
+  |  @@ -1,1 +1,2 @@
+  |   b
+  |  +baba
+  |  diff --git a/d b/d
+  |  new file mode 100644
+  |  --- /dev/null
+  |  +++ b/d
+  |  @@ -0,0 +1,1 @@
+  |  +d
+  |
+  | x  3: c9241b0f2d5b added d
+  |/    draft
+  |
+  |    diff --git a/d b/d
+  |    new file mode 100644
+  |    --- /dev/null
+  |    +++ b/d
+  |    @@ -0,0 +1,1 @@
+  |    +d
+  |
+  | o  2: 5a4825cc2926 rename b to b1
+  |/    draft
+  |
+  |    diff --git a/b b/b1
+  |    rename from b
+  |    rename to b1
+  |
+  o  1: 5f6d8a4bf34a added b
+  |   draft
+  |
+  |  diff --git a/b b/b
+  |  new file mode 100644
+  |  --- /dev/null
+  |  +++ b/b
+  |  @@ -0,0 +1,1 @@
+  |  +b
+  |
+  o  0: 9092f1db7931 added a
+      draft
+  
+     diff --git a/a b/a
+     new file mode 100644
+     --- /dev/null
+     +++ b/a
+     @@ -0,0 +1,1 @@
+     +a
+  
+
+Grafting revision 4 on top of revision 2, showing that it respect the rename:
+
+  $ hg up 2 -q
+  $ hg graft -r 4 --base c9241b0f2d5b --hidden
+  grafting 4:d70f3e12cfd9 "added d" (tip)
+  merging b1 and b to b1
+
+  $ hg log --git -pG -l 1 -T "{rev}: {node|short} {desc}\n {phase} \n\n"
+  @  5: 54ee32fbd09a added d
+  |   draft
+  ~
+     diff --git a/b1 b/b1
+     --- a/b1
+     +++ b/b1
+     @@ -1,1 +1,2 @@
+      b
+     +baba
+  
+  $ cd ..
+  $ rm -rf repo
+



To: khanchi97, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list