changeset 5781:613a144de642

divergence-resolution: add a buggy test case for resolution Explained in more details in the test itself. This will be fixed by next patch.
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Thu, 28 Jan 2021 13:40:36 +0530
parents e117cf7401db
children 72f65a647203
files tests/test-check-sdist.t tests/test-evolve-content-divergent-case-A5.t
diffstat 2 files changed, 185 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-check-sdist.t	Wed Feb 17 14:00:43 2021 -0800
+++ b/tests/test-check-sdist.t	Thu Jan 28 13:40:36 2021 +0530
@@ -27,7 +27,7 @@
 
   $ tar -tzf hg-evolve-*.tar.gz | sed 's|^hg-evolve-[^/]*/||' | sort > files
   $ wc -l files
-  344 files
+  345 files
   $ fgrep debian files
   tests/test-check-debian.t
   $ fgrep __init__.py files
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-content-divergent-case-A5.t	Thu Jan 28 13:40:36 2021 +0530
@@ -0,0 +1,184 @@
+===============================================
+Testing content-divergence resolution: Case A.5
+===============================================
+
+Independent rewrites of same changeset can lead to content-divergence. In most
+common cases, it can occur when multiple users rewrite the same changeset
+independently and push it.
+
+This test belongs to a series of tests checking the resolution of content-divergent
+changesets.
+
+Category A: no parents are obsolete
+Testcase 5: one side relocated backward and other rebased to parent's successor
+Variants:
+# a: "local" is relocated backward
+# b: "other" is relocated backward
+
+A.5 Relocated backward; Rebased to parent's successor
+=====================================================
+
+.. (Divergence reason):
+..    local: relocated the changeset backward in the graph
+..    other: rebased to the successor of parent
+.. Since one side rebased to the successor of parent and other cset relocated backward,
+.. the most reasonable behaviour is to set the parent of "backward-relocated" cset
+.. as resolution parent of divergence.
+..
+.. (local):
+..
+..      C ø⇠○ C'
+..        | |
+..      B ○ |
+..        | /
+..      A ○
+..        |
+..      O ●
+..
+.. (other):
+..
+..      C ø⇠○ C''
+..        | |
+..      B ø⇠○ B'
+..        | /
+..      A ○
+..        |
+..      O ●
+..
+.. (Resolution):
+XXX: current resolution is wrong and doesn't not do what we expect here, it will be fixed in next patch
+..
+..   B'○  ○ C'''
+..     | /
+..   A ○
+..     |
+..   O ●
+..
+
+Setup
+-----
+  $ . $TESTDIR/testlib/content-divergence-util.sh
+  $ setuprepos A.5
+  creating test repo for test case A.5
+  - upstream
+  - local
+  - other
+  cd into `local` and proceed with env setup
+
+initial
+
+  $ cd upstream
+  $ mkcommit A
+  $ mkcommit B
+  $ mkcommit C
+  $ cd ../local
+  $ hg pull -qu
+  $ hg rebase -r 'desc(C)' -d 'desc(A)'
+  rebasing 3:d90aa47aa5d3 tip "C"
+
+  $ cd ../other
+  $ hg pull -qu
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [2] B
+  $ echo newB > B
+  $ hg amend
+  1 new orphan changesets
+  $ hg next
+  move:[3] C
+  atop:[4] B
+  working directory is now at f085ae420789
+  $ hg push -q
+
+  $ cd ../local
+  $ hg push -fq
+  2 new content-divergent changesets
+  $ hg pull -q
+  2 new content-divergent changesets
+
+
+Actual test of resolution
+-------------------------
+
+Variant_a: when "local" is rebased backward
+-------------------------------------------
+  $ hg evolve -l
+  b80b2bbeb664: C
+    content-divergent: f085ae420789 (draft) (precursor d90aa47aa5d3)
+  
+  f085ae420789: C
+    content-divergent: b80b2bbeb664 (draft) (precursor d90aa47aa5d3)
+  
+  $ hg log -G
+  *  6:f085ae420789 (draft): C [content-divergent]
+  |
+  o  5:7db72af2e30d (draft): B
+  |
+  | @  4:b80b2bbeb664 (draft): C [content-divergent]
+  |/
+  o  1:f5bc6836db60 (draft): A
+  |
+  o  0:a9bdc8b26820 (public): O
+  
+  $ hg evolve --content-divergent
+  merge:[4] C
+  with: [6] C
+  base: [3] C
+  rebasing "divergent" content-divergent changeset b80b2bbeb664 on 7db72af2e30d
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 43fe36f524e4
+
+  $ hg log -G
+  @  8:43fe36f524e4 (draft): C
+  |
+  o  5:7db72af2e30d (draft): B
+  |
+  o  1:f5bc6836db60 (draft): A
+  |
+  o  0:a9bdc8b26820 (public): O
+  
+  $ hg evolve -l
+
+
+Variant_b: when "other" is rebased backward
+-------------------------------------------
+
+  $ cd ../other
+  $ hg pull -q
+  2 new content-divergent changesets
+  $ hg evolve -l
+  f085ae420789: C
+    content-divergent: b80b2bbeb664 (draft) (precursor d90aa47aa5d3)
+  
+  b80b2bbeb664: C
+    content-divergent: f085ae420789 (draft) (precursor d90aa47aa5d3)
+  
+  $ hg log -G
+  *  6:b80b2bbeb664 (draft): C [content-divergent]
+  |
+  | @  5:f085ae420789 (draft): C [content-divergent]
+  | |
+  | o  4:7db72af2e30d (draft): B
+  |/
+  o  1:f5bc6836db60 (draft): A
+  |
+  o  0:a9bdc8b26820 (public): O
+  
+  $ hg evolve --content-divergent
+  merge:[5] C
+  with: [6] C
+  base: [3] C
+  rebasing "other" content-divergent changeset b80b2bbeb664 on 7db72af2e30d
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 5844b6472deb
+
+  $ hg log -G
+  @  8:5844b6472deb (draft): C
+  |
+  o  4:7db72af2e30d (draft): B
+  |
+  o  1:f5bc6836db60 (draft): A
+  |
+  o  0:a9bdc8b26820 (public): O
+  
+  $ hg evolve -l