Show More
@@ -0,0 +1,290 b'' | |||||
|
1 | $ echo "[extensions]" >> $HGRCPATH | |||
|
2 | $ echo "mq=" >> $HGRCPATH | |||
|
3 | $ echo "graphlog=" >> $HGRCPATH | |||
|
4 | ||||
|
5 | make a test repository that looks like this: | |||
|
6 | ||||
|
7 | o 2:28bc7b1afd6a | |||
|
8 | | | |||
|
9 | | @ 1:d7fe2034f71b | |||
|
10 | |/ | |||
|
11 | o 0/62ecad8b70e5 | |||
|
12 | ||||
|
13 | $ hg init r0 | |||
|
14 | $ cd r0 | |||
|
15 | $ touch f0 | |||
|
16 | $ hg ci -m0 -Aq | |||
|
17 | $ touch f1 | |||
|
18 | $ hg ci -m1 -Aq | |||
|
19 | ||||
|
20 | $ hg update 0 -q | |||
|
21 | $ touch f2 | |||
|
22 | $ hg ci -m2 -Aq | |||
|
23 | $ hg update 1 -q | |||
|
24 | ||||
|
25 | make some patches with a parent: 1:d7fe2034f71b -> p0 -> p1 | |||
|
26 | ||||
|
27 | $ echo cp0 >> fp0 | |||
|
28 | $ hg add fp0 | |||
|
29 | $ hg qnew p0 -d "0 0" | |||
|
30 | ||||
|
31 | $ echo cp1 >> fp1 | |||
|
32 | $ hg add fp1 | |||
|
33 | $ hg qnew p1 -d "0 0" | |||
|
34 | ||||
|
35 | $ hg qpop -aq | |||
|
36 | patch queue now empty | |||
|
37 | ||||
|
38 | qpush --exact when at the parent | |||
|
39 | ||||
|
40 | $ hg update 1 -q | |||
|
41 | $ hg qpush -e | |||
|
42 | applying p0 | |||
|
43 | now at: p0 | |||
|
44 | $ hg parents -qr qbase | |||
|
45 | 1:d7fe2034f71b | |||
|
46 | $ hg qpop -aq | |||
|
47 | patch queue now empty | |||
|
48 | ||||
|
49 | $ hg qpush -e p0 | |||
|
50 | applying p0 | |||
|
51 | now at: p0 | |||
|
52 | $ hg parents -qr qbase | |||
|
53 | 1:d7fe2034f71b | |||
|
54 | $ hg qpop -aq | |||
|
55 | patch queue now empty | |||
|
56 | ||||
|
57 | $ hg qpush -e p1 | |||
|
58 | applying p0 | |||
|
59 | applying p1 | |||
|
60 | now at: p1 | |||
|
61 | $ hg parents -qr qbase | |||
|
62 | 1:d7fe2034f71b | |||
|
63 | $ hg qpop -aq | |||
|
64 | patch queue now empty | |||
|
65 | ||||
|
66 | $ hg qpush -ea | |||
|
67 | applying p0 | |||
|
68 | applying p1 | |||
|
69 | now at: p1 | |||
|
70 | $ hg parents -qr qbase | |||
|
71 | 1:d7fe2034f71b | |||
|
72 | $ hg qpop -aq | |||
|
73 | patch queue now empty | |||
|
74 | ||||
|
75 | qpush --exact when at another rev | |||
|
76 | ||||
|
77 | $ hg update 0 -q | |||
|
78 | $ hg qpush -e | |||
|
79 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
80 | applying p0 | |||
|
81 | now at: p0 | |||
|
82 | $ hg parents -qr qbase | |||
|
83 | 1:d7fe2034f71b | |||
|
84 | $ hg qpop -aq | |||
|
85 | patch queue now empty | |||
|
86 | ||||
|
87 | $ hg update 0 -q | |||
|
88 | $ hg qpush -e p0 | |||
|
89 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
90 | applying p0 | |||
|
91 | now at: p0 | |||
|
92 | $ hg parents -qr qbase | |||
|
93 | 1:d7fe2034f71b | |||
|
94 | $ hg qpop -aq | |||
|
95 | patch queue now empty | |||
|
96 | ||||
|
97 | $ hg update 0 -q | |||
|
98 | $ hg qpush -e p1 | |||
|
99 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
100 | applying p0 | |||
|
101 | applying p1 | |||
|
102 | now at: p1 | |||
|
103 | $ hg parents -qr qbase | |||
|
104 | 1:d7fe2034f71b | |||
|
105 | $ hg qpop -aq | |||
|
106 | patch queue now empty | |||
|
107 | ||||
|
108 | $ hg update 0 -q | |||
|
109 | $ hg qpush -ea | |||
|
110 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
111 | applying p0 | |||
|
112 | applying p1 | |||
|
113 | now at: p1 | |||
|
114 | $ hg parents -qr qbase | |||
|
115 | 1:d7fe2034f71b | |||
|
116 | $ hg qpop -aq | |||
|
117 | patch queue now empty | |||
|
118 | ||||
|
119 | qpush --exact while crossing branches | |||
|
120 | ||||
|
121 | $ hg update 2 -q | |||
|
122 | $ hg qpush -e | |||
|
123 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
124 | applying p0 | |||
|
125 | now at: p0 | |||
|
126 | $ hg parents -qr qbase | |||
|
127 | 1:d7fe2034f71b | |||
|
128 | $ hg qpop -aq | |||
|
129 | patch queue now empty | |||
|
130 | ||||
|
131 | $ hg update 2 -q | |||
|
132 | $ hg qpush -e p0 | |||
|
133 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
134 | applying p0 | |||
|
135 | now at: p0 | |||
|
136 | $ hg parents -qr qbase | |||
|
137 | 1:d7fe2034f71b | |||
|
138 | $ hg qpop -aq | |||
|
139 | patch queue now empty | |||
|
140 | ||||
|
141 | $ hg update 2 -q | |||
|
142 | $ hg qpush -e p1 | |||
|
143 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
144 | applying p0 | |||
|
145 | applying p1 | |||
|
146 | now at: p1 | |||
|
147 | $ hg parents -qr qbase | |||
|
148 | 1:d7fe2034f71b | |||
|
149 | $ hg qpop -aq | |||
|
150 | patch queue now empty | |||
|
151 | ||||
|
152 | $ hg update 2 -q | |||
|
153 | $ hg qpush -ea | |||
|
154 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
155 | applying p0 | |||
|
156 | applying p1 | |||
|
157 | now at: p1 | |||
|
158 | $ hg parents -qr qbase | |||
|
159 | 1:d7fe2034f71b | |||
|
160 | $ hg qpop -aq | |||
|
161 | patch queue now empty | |||
|
162 | ||||
|
163 | qpush --exact --force with changes to an unpatched file | |||
|
164 | ||||
|
165 | $ hg update 1 -q | |||
|
166 | $ echo c0 >> f0 | |||
|
167 | $ hg qpush -e | |||
|
168 | abort: local changes found, refresh first | |||
|
169 | [255] | |||
|
170 | $ hg qpush -ef | |||
|
171 | applying p0 | |||
|
172 | now at: p0 | |||
|
173 | $ cat f0 | |||
|
174 | c0 | |||
|
175 | $ rm f0 | |||
|
176 | $ touch f0 | |||
|
177 | $ hg qpop -aq | |||
|
178 | patch queue now empty | |||
|
179 | ||||
|
180 | $ hg update 1 -q | |||
|
181 | $ echo c0 >> f0 | |||
|
182 | $ hg qpush -e p1 | |||
|
183 | abort: local changes found, refresh first | |||
|
184 | [255] | |||
|
185 | $ hg qpush -e p1 -f | |||
|
186 | applying p0 | |||
|
187 | applying p1 | |||
|
188 | now at: p1 | |||
|
189 | $ cat f0 | |||
|
190 | c0 | |||
|
191 | $ rm f0 | |||
|
192 | $ touch f0 | |||
|
193 | $ hg qpop -aq | |||
|
194 | patch queue now empty | |||
|
195 | ||||
|
196 | qpush --exact --force with changes to a patched file | |||
|
197 | ||||
|
198 | $ hg update 1 -q | |||
|
199 | $ echo cp0-bad >> fp0 | |||
|
200 | $ hg add fp0 | |||
|
201 | $ hg qpush -e | |||
|
202 | abort: local changes found, refresh first | |||
|
203 | [255] | |||
|
204 | $ hg qpush -ef | |||
|
205 | applying p0 | |||
|
206 | file fp0 already exists | |||
|
207 | 1 out of 1 hunks FAILED -- saving rejects to file fp0.rej | |||
|
208 | patch failed, unable to continue (try -v) | |||
|
209 | patch failed, rejects left in working dir | |||
|
210 | errors during apply, please fix and refresh p0 | |||
|
211 | [2] | |||
|
212 | $ cat fp0 | |||
|
213 | cp0-bad | |||
|
214 | $ cat fp0.rej | |||
|
215 | --- fp0 | |||
|
216 | +++ fp0 | |||
|
217 | @@ -0,0 +1,1 @@ | |||
|
218 | +cp0 | |||
|
219 | $ hg qpop -aqf | |||
|
220 | patch queue now empty | |||
|
221 | $ rm fp0 | |||
|
222 | $ rm fp0.rej | |||
|
223 | ||||
|
224 | $ hg update 1 -q | |||
|
225 | $ echo cp1-bad >> fp1 | |||
|
226 | $ hg add fp1 | |||
|
227 | $ hg qpush -e p1 | |||
|
228 | abort: local changes found, refresh first | |||
|
229 | [255] | |||
|
230 | $ hg qpush -e p1 -f | |||
|
231 | applying p0 | |||
|
232 | applying p1 | |||
|
233 | file fp1 already exists | |||
|
234 | 1 out of 1 hunks FAILED -- saving rejects to file fp1.rej | |||
|
235 | patch failed, unable to continue (try -v) | |||
|
236 | patch failed, rejects left in working dir | |||
|
237 | errors during apply, please fix and refresh p1 | |||
|
238 | [2] | |||
|
239 | $ cat fp1 | |||
|
240 | cp1-bad | |||
|
241 | $ cat fp1.rej | |||
|
242 | --- fp1 | |||
|
243 | +++ fp1 | |||
|
244 | @@ -0,0 +1,1 @@ | |||
|
245 | +cp1 | |||
|
246 | $ hg qpop -aqf | |||
|
247 | patch queue now empty | |||
|
248 | $ rm fp1 | |||
|
249 | $ rm fp1.rej | |||
|
250 | ||||
|
251 | qpush --exact when already at a patch | |||
|
252 | ||||
|
253 | $ hg update 1 | |||
|
254 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
255 | $ hg qpush -e p0 | |||
|
256 | applying p0 | |||
|
257 | now at: p0 | |||
|
258 | $ hg qpush -e p1 | |||
|
259 | abort: cannot push --exact with applied patches | |||
|
260 | [255] | |||
|
261 | $ hg qpop -aq | |||
|
262 | patch queue now empty | |||
|
263 | ||||
|
264 | qpush --exact --move should fail | |||
|
265 | ||||
|
266 | $ hg qpush -e --move p1 | |||
|
267 | abort: cannot use --exact and --move together | |||
|
268 | [255] | |||
|
269 | ||||
|
270 | qpush --exact a patch without a parent recorded | |||
|
271 | ||||
|
272 | $ hg qpush -q | |||
|
273 | now at: p0 | |||
|
274 | $ grep -v '# Parent' .hg/patches/p0 > p0.new | |||
|
275 | $ mv p0.new .hg/patches/p0 | |||
|
276 | $ hg qpop -aq | |||
|
277 | patch queue now empty | |||
|
278 | $ hg qpush -e | |||
|
279 | abort: p0 does not have a parent recorded | |||
|
280 | [255] | |||
|
281 | $ hg qpush -e p0 | |||
|
282 | abort: p0 does not have a parent recorded | |||
|
283 | [255] | |||
|
284 | $ hg qpush -e p1 | |||
|
285 | abort: p0 does not have a parent recorded | |||
|
286 | [255] | |||
|
287 | $ hg qpush -ea | |||
|
288 | abort: p0 does not have a parent recorded | |||
|
289 | [255] | |||
|
290 |
@@ -1006,7 +1006,7 b' class queue(object):' | |||||
1006 | raise util.Abort(_("patch %s not in series") % patch) |
|
1006 | raise util.Abort(_("patch %s not in series") % patch) | |
1007 |
|
1007 | |||
1008 | def push(self, repo, patch=None, force=False, list=False, |
|
1008 | def push(self, repo, patch=None, force=False, list=False, | |
1009 | mergeq=None, all=False, move=False): |
|
1009 | mergeq=None, all=False, move=False, exact=False): | |
1010 | diffopts = self.diffopts() |
|
1010 | diffopts = self.diffopts() | |
1011 | wlock = repo.wlock() |
|
1011 | wlock = repo.wlock() | |
1012 | try: |
|
1012 | try: | |
@@ -1015,7 +1015,7 b' class queue(object):' | |||||
1015 | heads += ls |
|
1015 | heads += ls | |
1016 | if not heads: |
|
1016 | if not heads: | |
1017 | heads = [nullid] |
|
1017 | heads = [nullid] | |
1018 | if repo.dirstate.parents()[0] not in heads: |
|
1018 | if repo.dirstate.parents()[0] not in heads and not exact: | |
1019 | self.ui.status(_("(working directory not at a head)\n")) |
|
1019 | self.ui.status(_("(working directory not at a head)\n")) | |
1020 |
|
1020 | |||
1021 | if not self.series: |
|
1021 | if not self.series: | |
@@ -1062,6 +1062,18 b' class queue(object):' | |||||
1062 | if not force: |
|
1062 | if not force: | |
1063 | self.check_localchanges(repo) |
|
1063 | self.check_localchanges(repo) | |
1064 |
|
1064 | |||
|
1065 | if exact: | |||
|
1066 | if move: | |||
|
1067 | raise util.Abort(_("cannot use --exact and --move together")) | |||
|
1068 | if self.applied: | |||
|
1069 | raise util.Abort(_("cannot push --exact with applied patches")) | |||
|
1070 | root = self.series[start] | |||
|
1071 | target = patchheader(self.join(root), self.plainmode).parent | |||
|
1072 | if not target: | |||
|
1073 | raise util.Abort(_("%s does not have a parent recorded" % root)) | |||
|
1074 | if not repo[target] == repo['.']: | |||
|
1075 | hg.update(repo, target) | |||
|
1076 | ||||
1065 | if move: |
|
1077 | if move: | |
1066 | if not patch: |
|
1078 | if not patch: | |
1067 | raise util.Abort(_("please specify the patch to move")) |
|
1079 | raise util.Abort(_("please specify the patch to move")) | |
@@ -2338,7 +2350,8 b' def push(ui, repo, patch=None, **opts):' | |||||
2338 | mergeq = queue(ui, repo.join(""), newpath) |
|
2350 | mergeq = queue(ui, repo.join(""), newpath) | |
2339 | ui.warn(_("merging with queue at: %s\n") % mergeq.path) |
|
2351 | ui.warn(_("merging with queue at: %s\n") % mergeq.path) | |
2340 | ret = q.push(repo, patch, force=opts.get('force'), list=opts.get('list'), |
|
2352 | ret = q.push(repo, patch, force=opts.get('force'), list=opts.get('list'), | |
2341 |
mergeq=mergeq, all=opts.get('all'), move=opts.get('move') |
|
2353 | mergeq=mergeq, all=opts.get('all'), move=opts.get('move'), | |
|
2354 | exact=opts.get('exact')) | |||
2342 | return ret |
|
2355 | return ret | |
2343 |
|
2356 | |||
2344 | def pop(ui, repo, patch=None, **opts): |
|
2357 | def pop(ui, repo, patch=None, **opts): | |
@@ -3114,6 +3127,7 b' cmdtable = {' | |||||
3114 | "^qpush": |
|
3127 | "^qpush": | |
3115 | (push, |
|
3128 | (push, | |
3116 | [('f', 'force', None, _('apply on top of local changes')), |
|
3129 | [('f', 'force', None, _('apply on top of local changes')), | |
|
3130 | ('e', 'exact', None, _('apply the target patch to its recorded parent')), | |||
3117 | ('l', 'list', None, _('list patch name in commit text')), |
|
3131 | ('l', 'list', None, _('list patch name in commit text')), | |
3118 | ('a', 'all', None, _('apply all patches')), |
|
3132 | ('a', 'all', None, _('apply all patches')), | |
3119 | ('m', 'merge', None, _('merge from another queue (DEPRECATED)')), |
|
3133 | ('m', 'merge', None, _('merge from another queue (DEPRECATED)')), |
General Comments 0
You need to be logged in to leave comments.
Login now