Debian Codegraph @

tests/test-mq-qpush-exact.t

raw
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
3
4 make a test repository that looks like this:
5
6 o 2:28bc7b1afd6a
7 |
8 | @ 1:d7fe2034f71b
9 |/
10 o 0/62ecad8b70e5
11
12 $ hg init r0
13 $ cd r0
14 $ touch f0
15 $ hg ci -m0 -Aq
16 $ touch f1
17 $ hg ci -m1 -Aq
18
19 $ hg update 0 -q
20 $ touch f2
21 $ hg ci -m2 -Aq
22 $ hg update 1 -q
23
24 make some patches with a parent: 1:d7fe2034f71b -> p0 -> p1
25
26 $ echo cp0 >> fp0
27 $ hg add fp0
28 $ hg ci -m p0 -d "0 0"
29 $ hg export -r. > p0
30 $ hg strip -qn .
31 $ hg qimport p0
32 adding p0 to series file
33 $ hg qpush
34 applying p0
35 now at: p0
36
37 $ echo cp1 >> fp1
38 $ hg add fp1
39 $ hg qnew p1 -d "0 0"
40
41 $ hg qpop -aq
42 patch queue now empty
43
44 qpush --exact when at the parent
45
46 $ hg update 1 -q
47 $ hg qpush -e
48 applying p0
49 now at: p0
50 $ hg parents -qr qbase
51 1:d7fe2034f71b
52 $ hg qpop -aq
53 patch queue now empty
54
55 $ hg qpush -e p0
56 applying p0
57 now at: p0
58 $ hg parents -qr qbase
59 1:d7fe2034f71b
60 $ hg qpop -aq
61 patch queue now empty
62
63 $ hg qpush -e p1
64 applying p0
65 applying p1
66 now at: p1
67 $ hg parents -qr qbase
68 1:d7fe2034f71b
69 $ hg qpop -aq
70 patch queue now empty
71
72 qpush --exact when at another rev
73
74 $ hg update 0 -q
75 $ hg qpush -e
76 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
77 applying p0
78 now at: p0
79 $ hg parents -qr qbase
80 1:d7fe2034f71b
81 $ hg qpop -aq
82 patch queue now empty
83
84 $ hg update 0 -q
85 $ hg qpush -e p0
86 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
87 applying p0
88 now at: p0
89 $ hg parents -qr qbase
90 1:d7fe2034f71b
91 $ hg qpop -aq
92 patch queue now empty
93
94 $ hg update 0 -q
95 $ hg qpush -e p1
96 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 applying p0
98 applying p1
99 now at: p1
100 $ hg parents -qr qbase
101 1:d7fe2034f71b
102 $ hg qpop -aq
103 patch queue now empty
104
105 $ hg update 0 -q
106 $ hg qpush -ea
107 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 applying p0
109 applying p1
110 now at: p1
111 $ hg parents -qr qbase
112 1:d7fe2034f71b
113 $ hg qpop -aq
114 patch queue now empty
115
116 qpush --exact while crossing branches
117
118 $ hg update 2 -q
119 $ hg qpush -e
120 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
121 applying p0
122 now at: p0
123 $ hg parents -qr qbase
124 1:d7fe2034f71b
125 $ hg qpop -aq
126 patch queue now empty
127
128 $ hg update 2 -q
129 $ hg qpush -e p0
130 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
131 applying p0
132 now at: p0
133 $ hg parents -qr qbase
134 1:d7fe2034f71b
135 $ hg qpop -aq
136 patch queue now empty
137
138 $ hg update 2 -q
139 $ hg qpush -e p1
140 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
141 applying p0
142 applying p1
143 now at: p1
144 $ hg parents -qr qbase
145 1:d7fe2034f71b
146 $ hg qpop -aq
147 patch queue now empty
148
149 $ hg update 2 -q
150 $ hg qpush -ea
151 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
152 applying p0
153 applying p1
154 now at: p1
155 $ hg parents -qr qbase
156 1:d7fe2034f71b
157 $ hg qpop -aq
158 patch queue now empty
159
160 qpush --exact --force with changes to an unpatched file
161
162 $ hg update 1 -q
163 $ echo c0 >> f0
164 $ hg qpush -e
165 abort: local changes found
166 [255]
167 $ hg qpush -ef
168 applying p0
169 now at: p0
170 $ cat f0
171 c0
172 $ rm f0
173 $ touch f0
174 $ hg qpop -aq
175 patch queue now empty
176
177 $ hg update 1 -q
178 $ echo c0 >> f0
179 $ hg qpush -e p1
180 abort: local changes found
181 [255]
182 $ hg qpush -e p1 -f
183 applying p0
184 applying p1
185 now at: p1
186 $ cat f0
187 c0
188 $ rm f0
189 $ touch f0
190 $ hg qpop -aq
191 patch queue now empty
192
193 qpush --exact --force with changes to a patched file
194
195 $ hg update 1 -q
196 $ echo cp0-bad >> fp0
197 $ hg add fp0
198 $ hg qpush -e
199 abort: local changes found
200 [255]
201 $ hg qpush -ef
202 applying p0
203 file fp0 already exists
204 1 out of 1 hunks FAILED -- saving rejects to file fp0.rej
205 patch failed, unable to continue (try -v)
206 patch failed, rejects left in working directory
207 errors during apply, please fix and qrefresh p0
208 [2]
209 $ cat fp0
210 cp0-bad
211 $ cat fp0.rej
212 --- fp0
213 +++ fp0
214 @@ -0,0 +1,1 @@
215 +cp0
216 $ hg qpop -aqf
217 patch queue now empty
218 $ rm fp0
219 $ rm fp0.rej
220
221 $ hg update 1 -q
222 $ echo cp1-bad >> fp1
223 $ hg add fp1
224 $ hg qpush -e p1
225 abort: local changes found
226 [255]
227 $ hg qpush -e p1 -f
228 applying p0
229 applying p1
230 file fp1 already exists
231 1 out of 1 hunks FAILED -- saving rejects to file fp1.rej
232 patch failed, unable to continue (try -v)
233 patch failed, rejects left in working directory
234 errors during apply, please fix and qrefresh p1
235 [2]
236 $ cat fp1
237 cp1-bad
238 $ cat fp1.rej
239 --- fp1
240 +++ fp1
241 @@ -0,0 +1,1 @@
242 +cp1
243 $ hg qpop -aqf
244 patch queue now empty
245 $ hg forget fp1
246 $ rm fp1
247 $ rm fp1.rej
248
249 qpush --exact when already at a patch
250
251 $ hg update 1
252 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
253 $ hg qpush -e p0
254 applying p0
255 now at: p0
256 $ hg qpush -e p1
257 abort: cannot push --exact with applied patches
258 [255]
259 $ hg qpop -aq
260 patch queue now empty
261
262 qpush --exact --move should fail
263
264 $ hg qpush -e --move p1
265 abort: cannot use --exact and --move together
266 [255]
267
268 qpush --exact a patch without a parent recorded
269
270 $ hg qpush -q
271 now at: p0
272 $ grep -v '# Parent' .hg/patches/p0 > p0.new
273 $ mv p0.new .hg/patches/p0
274 $ hg qpop -aq
275 patch queue now empty
276 $ hg qpush -e
277 abort: p0 does not have a parent recorded
278 [255]
279 $ hg qpush -e p0
280 abort: p0 does not have a parent recorded
281 [255]
282 $ hg qpush -e p1
283 abort: p0 does not have a parent recorded
284 [255]
285 $ hg qpush -ea
286 abort: p0 does not have a parent recorded
287 [255]
288
289 $ cd ..