changeset 5439:272094174185 stable

test-obsolete: move a divergence related test from the main test Adding a new test file for test cases of evolution from an obsolete working directory parent. So this patch moves one divergence related case from test-obsolete.t to newly added test-evolve-obsolete.t and add few new cases as well. The new cases are probably there in other files, but not at the same place and I think having these cases in a single file make more sense. We can remove those duplicated tests from others file, let's see. In new test file there is one TODO (split case) which is yet to be written. I plan to add that after this, if that's not a blocker. Co-authored By: Pierre-Yves David <pierre-yves.david@octobus.net>
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Wed, 22 Jul 2020 14:23:58 +0200
parents 2aba2e371162
children d55e83faeaf8
files tests/test-evolve-wdir.t tests/test-obsolete.t
diffstat 2 files changed, 115 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-wdir.t	Wed Jul 22 14:23:58 2020 +0200
@@ -0,0 +1,114 @@
+===============================================
+Testing evolution of obsolete working directory
+===============================================
+
+Pulling changes from other repos can make your working directory parent (wdir)
+obsolete, most probably because now it has a new successor. But there are
+other cases as well where it might be pruned with no successors or split
+in multiple changesets etc.
+
+This test file deals with all the possible cases for the evolution from an
+obsolete working directory parent.
+
+.. Case A: obsolete wdp with single successor
+..     Resolution : simply update to the successor
+..
+.. Case B: obsolete wdp with no successor (simply pruned)
+..     Resolution : update to a not-dead ancestor
+..
+.. Case C: obsolete wdp with multiple successor (divergence rewriting)
+..     Resolution : #TODO: not handled yet
+..
+.. Case D: obsolete wdp with multiple successor (split rewriting)
+..     Resolution : #TODO: not handled yet
+
+A. Obsolete wdp with single successor
+-------------------------------------
+
+Setup
+  $ . $TESTDIR/testlib/common.sh
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > evolve=
+  > rebase=
+  > [alias]
+  > glog = log --graph --template "{rev}:{node|short} ({phase}): {desc|firstline} {if(troubles, '[{troubles}]')}\n"
+  > EOF
+
+  $ hg init repo
+  $ cd repo
+  $ mkcommit c_A
+  $ mkcommit c_B
+  $ hg amend -m "u_B"
+  $ hg up -r 'desc(c_B)' --hidden
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset 707ee88b2870
+  (hidden revision '707ee88b2870' was rewritten as: 9bf151312dec)
+  working directory parent is obsolete! (707ee88b2870)
+  (use 'hg evolve' to update to its successor: 9bf151312dec)
+
+  $ hg evolve
+  update:[2] u_B
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 9bf151312dec
+  $ hg glog
+  @  2:9bf151312dec (draft): u_B
+  |
+  o  0:9f0188af4c58 (draft): c_A
+  
+
+B. Obsolete wdp with no successor
+---------------------------------
+
+  $ hg prune .
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  working directory is now at 9f0188af4c58
+  1 changesets pruned
+  $ hg up -r 'desc(c_B)' --hidden
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset 707ee88b2870
+  (hidden revision '707ee88b2870' is pruned)
+  working directory parent is obsolete! (707ee88b2870)
+  (use 'hg evolve' to update to its parent successor)
+
+  $ hg evolve
+  update:[0] c_A
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  working directory is now at 9f0188af4c58
+  $ hg glog
+  @  0:9f0188af4c58 (draft): c_A
+  
+
+C. Obsolete wdp with multiple successor (divergence rewriting)
+---------------------------------------------------------------
+
+  $ hg metaedit -r 'desc(u_B)' -d '0 1' --hidden
+  $ hg metaedit -r 'desc(c_B)' -d '0 1' --hidden
+  2 new content-divergent changesets
+  $ hg up -r 'min(desc(c_B))' --hidden
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset 707ee88b2870
+  (hidden revision '707ee88b2870' has diverged)
+  working directory parent is obsolete! (707ee88b2870)
+  (707ee88b2870 has diverged, use 'hg evolve --list --content-divergent' to resolve the issue)
+
+  $ hg evolve
+  parent is obsolete with multiple successors:
+  [3] u_B
+  [4] c_B
+  [2]
+
+  $ hg glog
+  *  4:39e54eb7aa3c (draft): c_B [content-divergent]
+  |
+  | *  3:90624b574289 (draft): u_B [content-divergent]
+  |/
+  | @  1:707ee88b2870 (draft): c_B
+  |/
+  o  0:9f0188af4c58 (draft): c_A
+  
+
+D. Obsolete wdp with multiple successor (split rewriting)
+----------------------------------------------------------
+
+#TODO: yet to write tests for this case
--- a/tests/test-obsolete.t	Wed Jul 22 14:48:09 2020 +0200
+++ b/tests/test-obsolete.t	Wed Jul 22 14:23:58 2020 +0200
@@ -712,32 +712,10 @@
   summary:     add obsolet_conflicting_d
   
 
-  $ hg up --hidden 'min(desc("re:^add obsol_c$"))' -q
-  updated to hidden changeset 0d3f46688ccc
-  (hidden revision '0d3f46688ccc' has diverged)
-  working directory parent is obsolete! (0d3f46688ccc)
-  $ hg evolve
-  parent is obsolete with multiple successors:
-  [4] add obsol_c'
-  [10] add obsol_c
-  [2]
-  $ hg olog -a
-  o  2033b4e49474 (10) add obsol_c
-  |    rebased(parent) from 0d3f46688ccc using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
-  |
-  | o  725c380fe99b (4) add obsol_c'
-  |/     rewritten from 0d3f46688ccc by test (Thu Jan 01 00:00:00 1970 +0000)
-  |
-  @  0d3f46688ccc (3) add obsol_c
-  |    rewritten from 4538525df7e2 by test (Thu Jan 01 00:00:00 1970 +0000)
-  |
-  x  4538525df7e2 (2) add c
-  
-
 Check import reports new unstable changeset:
 
   $ hg up --hidden 'desc("re:^add c$")'
-  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  1 files updated, 0 files merged, 4 files removed, 0 files unresolved
   updated to hidden changeset 4538525df7e2
   (hidden revision '4538525df7e2' has diverged)
   working directory parent is obsolete! (4538525df7e2)