diff tests/test-prune.t @ 4772:c6fc1000af1e mercurial-4.6

test-compat: merge mercurial-4.7 into mercurial-4.6
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 29 Jul 2019 11:40:22 +0200
parents fcecbb1261f2
children 7fe0be34f662 769b907e644e
line wrap: on
line diff
--- a/tests/test-prune.t	Wed Jun 05 17:45:45 2019 +0200
+++ b/tests/test-prune.t	Mon Jul 29 11:40:22 2019 +0200
@@ -229,17 +229,18 @@
   814c38b95e72dfe2cbf675b1649ea9d780c89a80 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'prune', 'user': 'test'}
   354011cd103f58bbbd9091a3cee6d6a6bd0dddf7 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
 
-two old, two new with --pair
+two old, two new with --pair (also test bookmark move)
 
   $ hg up 0
   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  $ hg bookmark prune-pair-book
   $ mkcommit n1
   created new head
   $ mkcommit n2
 
   $ hg prune 'desc("add n1")::desc("add n2")' -s 'desc("add nD")::desc("add nE")' --pair
-  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  working directory is now at 1f0dee641bb7
+  4 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  working directory is now at 6e8148413dd5
   2 changesets pruned
   $ hg debugobsolete
   9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'blah'}
@@ -252,11 +253,15 @@
   354011cd103f58bbbd9091a3cee6d6a6bd0dddf7 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
   cb7f8f706a6532967b98cf8583a81baab79a0fa7 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
   21b6f2f1cece8c10326e575dd38239189d467190 6e8148413dd541855b72a920a90c06fca127c7e7 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
+  $ hg log --hidden -r 'desc("add n2") + desc("add nE") + bookmark("prune-pair-book")'
+  14:21b6f2f1cece[] (obsolete/draft) add n2
+  12:6e8148413dd5[prune-pair-book] (draft) add nE
 
 test hg strip replacement
 
   $ hg up 10
-  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  (leaving bookmark prune-pair-book)
   $ mkcommit n1
   created new head
   $ mkcommit n2
@@ -454,3 +459,45 @@
      r10                       8:d62d843c9a01
      rg                        15:cd0038e05e1b
 
+  $ cd ..
+
+Test that prune doesn't update off when pruning unrelated commit (issue6137)
+----------------------------------------------------------------------------
+
+  $ hg init issue6137
+  $ cd issue6137
+  $ echo a > a
+  $ hg ci -Aqm "added a"
+  $ echo b > b
+  $ hg ci -Aqm "added b"
+
+  $ hg prune .
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  working directory is now at 9092f1db7931
+  1 changesets pruned
+
+  $ echo c > c
+  $ hg ci -Aqm "added c"
+
+update to obsoleted revision and perform prune on unrelated revision:
+  $ hg up -r "desc('added b')" --hidden -q
+  updating to a hidden changeset 5f6d8a4bf34a
+  (hidden revision '5f6d8a4bf34a' is pruned)
+  working directory parent is obsolete! (5f6d8a4bf34a)
+
+  $ hg log -G
+  o  2:29edef26570b[] (draft) added c
+  |
+  | @  1:5f6d8a4bf34a[] (obsolete/draft) added b
+  |/
+  o  0:9092f1db7931[] (draft) added a
+  
+  $ hg prune -r "desc('added c')"
+  1 changesets pruned
+
+  $ hg par
+  1:5f6d8a4bf34a[] (obsolete/draft) added b
+  working directory parent is obsolete! (5f6d8a4bf34a)
+  (use 'hg evolve' to update to its parent successor)
+
+  $ cd ..