tests/test-prune.t
branchstable
changeset 685 7398f9729821
child 686 d15f8a00e4ce
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-prune.t	Mon Feb 04 18:42:50 2013 +0100
@@ -0,0 +1,176 @@
+  $ cat >> $HGRCPATH <<EOF
+  > [ui]
+  > logtemplate={rev}:{node|short}@{branch}({obsolete}/{phase}) {desc|firstline}\n
+  > [extensions]
+  > hgext.rebase=
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
+
+  $ mkcommit() {
+  >    echo "$1" > "$1"
+  >    hg add "$1"
+  >    hg ci -m "add $1"
+  > }
+
+  $ hg init repo
+  $ cd repo
+  $ mkcommit a
+  $ mkcommit b
+  $ mkcommit c
+  $ mkcommit d
+  $ mkcommit e
+  $ hg log -G
+  @  4:9d206ffc875e@default(stable/draft) add e
+  |
+  o  3:47d2a3944de8@default(stable/draft) add d
+  |
+  o  2:4538525df7e2@default(stable/draft) add c
+  |
+  o  1:7c3bad9141dc@default(stable/draft) add b
+  |
+  o  0:1f0dee641bb7@default(stable/draft) add a
+  
+
+Check simple case
+----------------------------
+
+prune current and tip changeset
+
+  $ hg prune .
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  working directory now at 47d2a3944de8
+  $ hg debugobsolete
+  9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '*', 'user': 'test'} (glob)
+
+prune leaving unstability behind
+
+  $ hg prune 1
+  2 new unstable changesets
+  $ hg debugobsolete
+  9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '*', 'user': 'test'} (glob)
+  7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {'date': '*', 'user': 'test'} (glob)
+
+pruning multiple changeset at once
+
+  $ hg prune 2:
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  working directory now at 1f0dee641bb7
+  $ hg debugobsolete
+  9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '*', 'user': 'test'} (glob)
+  7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {'date': '*', 'user': 'test'} (glob)
+  4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {'date': '*', 'user': 'test'} (glob)
+  47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {'date': '*', 'user': 'test'} (glob)
+
+Check successors addition
+----------------------------
+
+  $ mkcommit bb
+  $ mkcommit cc
+  $ mkcommit dd
+  $ mkcommit ee
+  $ hg up 0
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  $ mkcommit nB
+  created new head
+  $ mkcommit nC
+  $ mkcommit nD
+  $ mkcommit nE
+
+  $ hg log -G
+  @  12:6e8148413dd5@default(stable/draft) add nE
+  |
+  o  11:8ee176ff1d4b@default(stable/draft) add nD
+  |
+  o  10:aa96dc3f04c2@default(stable/draft) add nC
+  |
+  o  9:6f6f25e4f748@default(stable/draft) add nB
+  |
+  | o  8:bb5e90a7ea1f@default(stable/draft) add ee
+  | |
+  | o  7:00ded550b1e2@default(stable/draft) add dd
+  | |
+  | o  6:354011cd103f@default(stable/draft) add cc
+  | |
+  | o  5:814c38b95e72@default(stable/draft) add bb
+  |/
+  o  0:1f0dee641bb7@default(stable/draft) add a
+  
+
+one old, one new
+
+  $ hg prune 'desc("add ee")' -s 'desc("add nE")'
+  $ hg debugobsolete
+  9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '*', 'user': 'test'} (glob)
+  7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {'date': '*', 'user': 'test'} (glob)
+  4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {'date': '*', 'user': 'test'} (glob)
+  47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {'date': '*', 'user': 'test'} (glob)
+  bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 {'date': '*', 'user': 'test'} (glob)
+  $ hg log -G
+  @  12:6e8148413dd5@default(stable/draft) add nE
+  |
+  o  11:8ee176ff1d4b@default(stable/draft) add nD
+  |
+  o  10:aa96dc3f04c2@default(stable/draft) add nC
+  |
+  o  9:6f6f25e4f748@default(stable/draft) add nB
+  |
+  | o  7:00ded550b1e2@default(stable/draft) add dd
+  | |
+  | o  6:354011cd103f@default(stable/draft) add cc
+  | |
+  | o  5:814c38b95e72@default(stable/draft) add bb
+  |/
+  o  0:1f0dee641bb7@default(stable/draft) add a
+  
+
+one old, two new
+
+  $ hg prune 'desc("add dd")' -s 'desc("add nD")' -s 'desc("add nC")'
+  $ hg debugobsolete
+  9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '*', 'user': 'test'} (glob)
+  7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {'date': '*', 'user': 'test'} (glob)
+  4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {'date': '*', 'user': 'test'} (glob)
+  47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {'date': '*', 'user': 'test'} (glob)
+  bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 {'date': '*', 'user': 'test'} (glob)
+  00ded550b1e28bba454bd34cec1269d22cf3ef25 aa96dc3f04c2c2341fe6880aeb6dc9fbffff9ef9 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 {'date': '**', 'user': 'test'} (glob)
+  $ hg log -G
+  @  12:6e8148413dd5@default(stable/draft) add nE
+  |
+  o  11:8ee176ff1d4b@default(stable/draft) add nD
+  |
+  o  10:aa96dc3f04c2@default(stable/draft) add nC
+  |
+  o  9:6f6f25e4f748@default(stable/draft) add nB
+  |
+  | o  6:354011cd103f@default(stable/draft) add cc
+  | |
+  | o  5:814c38b95e72@default(stable/draft) add bb
+  |/
+  o  0:1f0dee641bb7@default(stable/draft) add a
+  
+
+two old, two new (should be denied)
+
+  $ hg prune 'desc("add cc")' 'desc("add bb")' -s 'desc("add nD")' -s 'desc("add nC")'
+  abort: Can't use multiple successors for multiple precursors
+  [255]
+  $ hg debugobsolete
+  9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '*', 'user': 'test'} (glob)
+  7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {'date': '*', 'user': 'test'} (glob)
+  4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {'date': '*', 'user': 'test'} (glob)
+  47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {'date': '*', 'user': 'test'} (glob)
+  bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 {'date': '*', 'user': 'test'} (glob)
+  00ded550b1e28bba454bd34cec1269d22cf3ef25 aa96dc3f04c2c2341fe6880aeb6dc9fbffff9ef9 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 {'date': '**', 'user': 'test'} (glob)
+
+two old, one new:
+
+  $ hg prune 'desc("add cc")' 'desc("add bb")' -s 'desc("add nB")'
+  $ hg debugobsolete
+  9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '*', 'user': 'test'} (glob)
+  7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {'date': '*', 'user': 'test'} (glob)
+  4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {'date': '*', 'user': 'test'} (glob)
+  47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {'date': '*', 'user': 'test'} (glob)
+  bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 {'date': '*', 'user': 'test'} (glob)
+  00ded550b1e28bba454bd34cec1269d22cf3ef25 aa96dc3f04c2c2341fe6880aeb6dc9fbffff9ef9 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 {'date': '**', 'user': 'test'} (glob)
+  814c38b95e72dfe2cbf675b1649ea9d780c89a80 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 {'date': '*', 'user': 'test'} (glob)
+  354011cd103f58bbbd9091a3cee6d6a6bd0dddf7 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 {'date': '*', 'user': 'test'} (glob)