evolve: add tests for the case when div csets has different users
authorSushil khanchi <sushilkhanchi97@gmail.com>
Sun, 05 May 2019 18:24:50 +0530
changeset 4635 ea9ae2d2095a
parent 4634 0b231ea2124b
child 4636 c0e9a3c01c44
evolve: add tests for the case when div csets has different users
tests/test-evolve-content-divergent-meta.t
--- a/tests/test-evolve-content-divergent-meta.t	Fri May 03 01:23:12 2019 +0200
+++ b/tests/test-evolve-content-divergent-meta.t	Sun May 05 18:24:50 2019 +0530
@@ -97,3 +97,63 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     added c e
   
+  $ cd ..
+
+Testing the three way merge logic for user of content divergent changesets
+--------------------------------------------------------------------------
+
+  $ hg init mergeusers
+  $ cd mergeusers
+  $ for ch in a b c; do
+  > touch $ch
+  > hg add $ch
+  > hg ci -m "added "$ch
+  > done;
+
+  $ hg amend -m "updated c"
+  $ hg up -r 'desc("added c")' --hidden -q
+  updated to hidden changeset 2b3c31fe982d
+  (hidden revision '2b3c31fe982d' was rewritten as: 464e35020fd0)
+  working directory parent is obsolete! (2b3c31fe982d)
+  $ echo coco > c
+
+1) when one user is different wrt base
+--------------------------------------
+
+Insert a diverging author name:
+  $ hg amend -u 'foouser'
+  2 new content-divergent changesets
+
+Run automatic evolution:
+  $ hg evolve --content-divergent
+  merge:[3] updated c
+  with: [4] added c
+  base: [2] added c
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 932d6ceb7672
+
+  $ hg log -r tip | grep "^user"
+  user:        foouser
+
+  $ hg strip . -q --config extensions.strip=
+  2 new content-divergent changesets
+
+2) when both the user are different wrt base
+--------------------------------------------
+
+  $ hg up -r 'max(desc("updated c"))'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg amend -u 'baruser'
+
+Run automatic evolution:
+  $ hg evolve --content-divergent
+  merge:[4] added c
+  with: [5] updated c
+  base: [2] added c
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 85c4e0b92028
+
+  $ hg log -r tip | grep "^user"
+  user:        baruser
+
+  $ cd ..