comparison tests/test-prune.t @ 685:7398f9729821 stable

prune: add test and more robusness
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Mon, 04 Feb 2013 18:42:50 +0100
parents
children d15f8a00e4ce
comparison
equal deleted inserted replaced
684:19a1a8f93c07 685:7398f9729821
1 $ cat >> $HGRCPATH <<EOF
2 > [ui]
3 > logtemplate={rev}:{node|short}@{branch}({obsolete}/{phase}) {desc|firstline}\n
4 > [extensions]
5 > hgext.rebase=
6 > EOF
7 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
8
9 $ mkcommit() {
10 > echo "$1" > "$1"
11 > hg add "$1"
12 > hg ci -m "add $1"
13 > }
14
15 $ hg init repo
16 $ cd repo
17 $ mkcommit a
18 $ mkcommit b
19 $ mkcommit c
20 $ mkcommit d
21 $ mkcommit e
22 $ hg log -G
23 @ 4:9d206ffc875e@default(stable/draft) add e
24 |
25 o 3:47d2a3944de8@default(stable/draft) add d
26 |
27 o 2:4538525df7e2@default(stable/draft) add c
28 |
29 o 1:7c3bad9141dc@default(stable/draft) add b
30 |
31 o 0:1f0dee641bb7@default(stable/draft) add a
32
33
34 Check simple case
35 ----------------------------
36
37 prune current and tip changeset
38
39 $ hg prune .
40 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
41 working directory now at 47d2a3944de8
42 $ hg debugobsolete
43 9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '*', 'user': 'test'} (glob)
44
45 prune leaving unstability behind
46
47 $ hg prune 1
48 2 new unstable changesets
49 $ hg debugobsolete
50 9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '*', 'user': 'test'} (glob)
51 7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {'date': '*', 'user': 'test'} (glob)
52
53 pruning multiple changeset at once
54
55 $ hg prune 2:
56 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
57 working directory now at 1f0dee641bb7
58 $ hg debugobsolete
59 9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '*', 'user': 'test'} (glob)
60 7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {'date': '*', 'user': 'test'} (glob)
61 4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {'date': '*', 'user': 'test'} (glob)
62 47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {'date': '*', 'user': 'test'} (glob)
63
64 Check successors addition
65 ----------------------------
66
67 $ mkcommit bb
68 $ mkcommit cc
69 $ mkcommit dd
70 $ mkcommit ee
71 $ hg up 0
72 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
73 $ mkcommit nB
74 created new head
75 $ mkcommit nC
76 $ mkcommit nD
77 $ mkcommit nE
78
79 $ hg log -G
80 @ 12:6e8148413dd5@default(stable/draft) add nE
81 |
82 o 11:8ee176ff1d4b@default(stable/draft) add nD
83 |
84 o 10:aa96dc3f04c2@default(stable/draft) add nC
85 |
86 o 9:6f6f25e4f748@default(stable/draft) add nB
87 |
88 | o 8:bb5e90a7ea1f@default(stable/draft) add ee
89 | |
90 | o 7:00ded550b1e2@default(stable/draft) add dd
91 | |
92 | o 6:354011cd103f@default(stable/draft) add cc
93 | |
94 | o 5:814c38b95e72@default(stable/draft) add bb
95 |/
96 o 0:1f0dee641bb7@default(stable/draft) add a
97
98
99 one old, one new
100
101 $ hg prune 'desc("add ee")' -s 'desc("add nE")'
102 $ hg debugobsolete
103 9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '*', 'user': 'test'} (glob)
104 7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {'date': '*', 'user': 'test'} (glob)
105 4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {'date': '*', 'user': 'test'} (glob)
106 47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {'date': '*', 'user': 'test'} (glob)
107 bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 {'date': '*', 'user': 'test'} (glob)
108 $ hg log -G
109 @ 12:6e8148413dd5@default(stable/draft) add nE
110 |
111 o 11:8ee176ff1d4b@default(stable/draft) add nD
112 |
113 o 10:aa96dc3f04c2@default(stable/draft) add nC
114 |
115 o 9:6f6f25e4f748@default(stable/draft) add nB
116 |
117 | o 7:00ded550b1e2@default(stable/draft) add dd
118 | |
119 | o 6:354011cd103f@default(stable/draft) add cc
120 | |
121 | o 5:814c38b95e72@default(stable/draft) add bb
122 |/
123 o 0:1f0dee641bb7@default(stable/draft) add a
124
125
126 one old, two new
127
128 $ hg prune 'desc("add dd")' -s 'desc("add nD")' -s 'desc("add nC")'
129 $ hg debugobsolete
130 9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '*', 'user': 'test'} (glob)
131 7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {'date': '*', 'user': 'test'} (glob)
132 4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {'date': '*', 'user': 'test'} (glob)
133 47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {'date': '*', 'user': 'test'} (glob)
134 bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 {'date': '*', 'user': 'test'} (glob)
135 00ded550b1e28bba454bd34cec1269d22cf3ef25 aa96dc3f04c2c2341fe6880aeb6dc9fbffff9ef9 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 {'date': '**', 'user': 'test'} (glob)
136 $ hg log -G
137 @ 12:6e8148413dd5@default(stable/draft) add nE
138 |
139 o 11:8ee176ff1d4b@default(stable/draft) add nD
140 |
141 o 10:aa96dc3f04c2@default(stable/draft) add nC
142 |
143 o 9:6f6f25e4f748@default(stable/draft) add nB
144 |
145 | o 6:354011cd103f@default(stable/draft) add cc
146 | |
147 | o 5:814c38b95e72@default(stable/draft) add bb
148 |/
149 o 0:1f0dee641bb7@default(stable/draft) add a
150
151
152 two old, two new (should be denied)
153
154 $ hg prune 'desc("add cc")' 'desc("add bb")' -s 'desc("add nD")' -s 'desc("add nC")'
155 abort: Can't use multiple successors for multiple precursors
156 [255]
157 $ hg debugobsolete
158 9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '*', 'user': 'test'} (glob)
159 7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {'date': '*', 'user': 'test'} (glob)
160 4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {'date': '*', 'user': 'test'} (glob)
161 47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {'date': '*', 'user': 'test'} (glob)
162 bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 {'date': '*', 'user': 'test'} (glob)
163 00ded550b1e28bba454bd34cec1269d22cf3ef25 aa96dc3f04c2c2341fe6880aeb6dc9fbffff9ef9 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 {'date': '**', 'user': 'test'} (glob)
164
165 two old, one new:
166
167 $ hg prune 'desc("add cc")' 'desc("add bb")' -s 'desc("add nB")'
168 $ hg debugobsolete
169 9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '*', 'user': 'test'} (glob)
170 7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {'date': '*', 'user': 'test'} (glob)
171 4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {'date': '*', 'user': 'test'} (glob)
172 47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {'date': '*', 'user': 'test'} (glob)
173 bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 {'date': '*', 'user': 'test'} (glob)
174 00ded550b1e28bba454bd34cec1269d22cf3ef25 aa96dc3f04c2c2341fe6880aeb6dc9fbffff9ef9 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 {'date': '**', 'user': 'test'} (glob)
175 814c38b95e72dfe2cbf675b1649ea9d780c89a80 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 {'date': '*', 'user': 'test'} (glob)
176 354011cd103f58bbbd9091a3cee6d6a6bd0dddf7 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 {'date': '*', 'user': 'test'} (glob)