comparison tests/test-uncommit.t @ 312:a7b5989d1d92

evolve: add uncommit command
author Patrick Mezard <patrick@mezard.eu>
date Tue, 26 Jun 2012 18:12:31 +0200
parents
children 47d10459fa24
comparison
equal deleted inserted replaced
311:5eecfda0a5c7 312:a7b5989d1d92
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
3 > hgext.rebase=
4 > hgext.graphlog=
5 > EOF
6 $ echo "obsolete=$(echo $(dirname $TESTDIR))/hgext/obsolete.py" >> $HGRCPATH
7 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
8
9 $ glog() {
10 > hg glog --template '{rev}:{node|short}@{branch}({obsolete}/{phase}) {desc|firstline}\n' "$@"
11 > }
12
13 $ hg init repo
14 $ cd repo
15
16 Cannot uncommit null changeset
17
18 $ hg uncommit
19 abort: cannot rewrite immutable changeset
20 [255]
21
22 Cannot uncommit public changeset
23
24 $ echo a > a
25 $ hg ci -Am adda a
26 $ hg phase --public .
27 $ hg uncommit
28 abort: cannot rewrite immutable changeset
29 [255]
30 $ hg phase --force --draft .
31
32 Cannot uncommit merge
33
34 $ hg up -q null
35 $ echo b > b
36 $ echo c > c
37 $ echo d > d
38 $ echo f > f
39 $ echo g > g
40 $ echo j > j
41 $ echo m > m
42 $ echo n > n
43 $ echo o > o
44 $ hg ci -Am addmore
45 adding b
46 adding c
47 adding d
48 adding f
49 adding g
50 adding j
51 adding m
52 adding n
53 adding o
54 created new head
55 $ hg merge
56 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
57 (branch merge, don't forget to commit)
58 $ hg uncommit
59 abort: cannot uncommit while merging
60 [255]
61 $ hg ci -m merge
62 $ hg uncommit
63 abort: cannot uncommit merge changeset
64 [255]
65
66 Prepare complicated changeset
67
68 $ hg branch bar
69 marked working directory as branch bar
70 (branches are permanent and global, did you want a bookmark?)
71 $ hg cp a aa
72 $ echo b >> b
73 $ hg rm c
74 $ echo d >> d
75 $ echo e > e
76 $ hg mv f ff
77 $ hg mv g h
78 $ echo j >> j
79 $ echo k > k
80 $ echo l > l
81 $ hg rm m
82 $ hg rm n
83 $ echo o >> o
84 $ hg ci -Am touncommit
85 adding e
86 adding k
87 adding l
88 $ hg st --copies --change .
89 M b
90 M d
91 M j
92 M o
93 A aa
94 a
95 A e
96 A ff
97 f
98 A h
99 g
100 A k
101 A l
102 R c
103 R f
104 R g
105 R m
106 R n
107 $ hg man -r .
108 a
109 aa
110 b
111 d
112 e
113 ff
114 h
115 j
116 k
117 l
118 o
119
120 Prepare complicated working directory
121
122 $ hg branch foo
123 marked working directory as branch foo
124 (branches are permanent and global, did you want a bookmark?)
125 $ hg mv ff f
126 $ hg mv h i
127 $ hg rm j
128 $ hg rm k
129 $ echo l >> l
130 $ echo m > m
131 $ echo o > o
132
133 Test uncommit without argument, should be a no-op
134
135 $ hg uncommit
136 abort: nothing to uncommit
137 [255]
138
139 Test no matches
140
141 $ hg uncommit --include nothere
142 abort: nothing to uncommit
143 [255]
144
145 Enjoy uncommit
146
147 $ hg uncommit aa b c f ff g h j k l m o
148 $ hg branch
149 foo
150 $ hg st --copies
151 M b
152 A aa
153 a
154 A i
155 g
156 A l
157 R c
158 R g
159 R j
160 R m
161 $ cat aa
162 a
163 $ cat b
164 b
165 b
166 $ cat l
167 l
168 l
169 $ cat m
170 m
171 $ test -f c && echo 'error: c was removed!'
172 [1]
173 $ test -f j && echo 'error: j was removed!'
174 [1]
175 $ test -f k && echo 'error: k was removed!'
176 [1]
177 $ hg st --copies --change .
178 M d
179 A e
180 R n
181 $ hg man -r .
182 a
183 b
184 c
185 d
186 e
187 f
188 g
189 j
190 m
191 o
192 $ hg cat -r . d
193 d
194 d
195 $ hg cat -r . e
196 e
197 $ glog --hidden
198 @ 4:e8db4aa611f6@bar(stable/draft) touncommit
199 |
200 | o 3:5eb72dbe0cb4@bar(extinct/secret) touncommit
201 |/
202 o 2:f63b90038565@default(stable/draft) merge
203 |\
204 | o 1:f15c744d48e8@default(stable/draft) addmore
205 |
206 o 0:07f494440405@default(stable/draft) adda
207
208 $ hg debugsuccessors
209 5eb72dbe0cb4 e8db4aa611f6
210
211 Test phase is preserved, no local changes
212
213 $ hg up -C 3
214 8 files updated, 0 files merged, 1 files removed, 0 files unresolved
215 Working directory parent is obsolete
216 $ hg --config extensions.purge= purge
217 $ hg uncommit -I 'set:added() and e'
218 $ hg st --copies
219 A e
220 $ hg st --copies --change .
221 M b
222 M d
223 M j
224 M o
225 A aa
226 A ff
227 f
228 A h
229 g
230 A k
231 A l
232 R c
233 R f
234 R g
235 R m
236 R n
237 $ glog --hidden
238 @ 5:c706fe2c12f8@bar(stable/secret) touncommit
239 |
240 | o 4:e8db4aa611f6@bar(stable/draft) touncommit
241 |/
242 | o 3:5eb72dbe0cb4@bar(extinct/secret) touncommit
243 |/
244 o 2:f63b90038565@default(stable/draft) merge
245 |\
246 | o 1:f15c744d48e8@default(stable/draft) addmore
247 |
248 o 0:07f494440405@default(stable/draft) adda
249
250 $ hg debugsuccessors
251 5eb72dbe0cb4 c706fe2c12f8
252 5eb72dbe0cb4 e8db4aa611f6