Show More
@@ -446,6 +446,7 b' def updatemq(repo, state, skipped, **opt' | |||||
446 | mqrebase = {} |
|
446 | mqrebase = {} | |
447 | mq = repo.mq |
|
447 | mq = repo.mq | |
448 | original_series = mq.fullseries[:] |
|
448 | original_series = mq.fullseries[:] | |
|
449 | skippedpatches = set() | |||
449 |
|
450 | |||
450 | for p in mq.applied: |
|
451 | for p in mq.applied: | |
451 | rev = repo[p.node].rev() |
|
452 | rev = repo[p.node].rev() | |
@@ -453,6 +454,9 b' def updatemq(repo, state, skipped, **opt' | |||||
453 | repo.ui.debug('revision %d is an mq patch (%s), finalize it.\n' % |
|
454 | repo.ui.debug('revision %d is an mq patch (%s), finalize it.\n' % | |
454 | (rev, p.name)) |
|
455 | (rev, p.name)) | |
455 | mqrebase[rev] = (p.name, isagitpatch(repo, p.name)) |
|
456 | mqrebase[rev] = (p.name, isagitpatch(repo, p.name)) | |
|
457 | else: | |||
|
458 | # Applied but not rebased, not sure this should happen | |||
|
459 | skippedpatches.add(p.name) | |||
456 |
|
460 | |||
457 | if mqrebase: |
|
461 | if mqrebase: | |
458 | mq.finish(repo, mqrebase.keys()) |
|
462 | mq.finish(repo, mqrebase.keys()) | |
@@ -464,14 +468,17 b' def updatemq(repo, state, skipped, **opt' | |||||
464 | repo.ui.debug('import mq patch %d (%s)\n' % (state[rev], name)) |
|
468 | repo.ui.debug('import mq patch %d (%s)\n' % (state[rev], name)) | |
465 | mq.qimport(repo, (), patchname=name, git=isgit, |
|
469 | mq.qimport(repo, (), patchname=name, git=isgit, | |
466 | rev=[str(state[rev])]) |
|
470 | rev=[str(state[rev])]) | |
|
471 | else: | |||
|
472 | # Rebased and skipped | |||
|
473 | skippedpatches.add(mqrebase[rev][0]) | |||
467 |
|
474 | |||
468 | # restore missing guards |
|
475 | # Patches were either applied and rebased and imported in | |
469 | for s in original_series: |
|
476 | # order, applied and removed or unapplied. Discard the removed | |
470 | pname = mq.guard_re.split(s, 1)[0] |
|
477 | # ones while preserving the original series order and guards. | |
471 | if pname in mq.fullseries: |
|
478 | newseries = [s for s in original_series | |
472 | repo.ui.debug('restoring guard for patch %s' % (pname)) |
|
479 | if mq.guard_re.split(s, 1)[0] not in skippedpatches] | |
473 | mq.fullseries[mq.fullseries.index(pname)] = s |
|
480 | mq.fullseries[:] = newseries | |
474 |
|
|
481 | mq.seriesdirty = True | |
475 | mq.savedirty() |
|
482 | mq.savedirty() | |
476 |
|
483 | |||
477 | def updatebookmarks(repo, nstate, originalbookmarks, **opts): |
|
484 | def updatebookmarks(repo, nstate, originalbookmarks, **opts): |
@@ -247,30 +247,41 b' Rebase with guards' | |||||
247 | Create mq repo with guarded patches foo and bar and empty patch: |
|
247 | Create mq repo with guarded patches foo and bar and empty patch: | |
248 |
|
248 | |||
249 | $ hg qinit |
|
249 | $ hg qinit | |
250 | $ hg qnew foo |
|
250 | $ echo guarded > guarded | |
251 |
$ hg |
|
251 | $ hg add guarded | |
|
252 | $ hg qnew guarded | |||
|
253 | $ hg qnew empty-important -m 'important commit message' | |||
|
254 | $ echo bar > bar | |||
|
255 | $ hg add bar | |||
|
256 | $ hg qnew bar | |||
252 | $ echo foo > foo |
|
257 | $ echo foo > foo | |
253 | $ hg add foo |
|
258 | $ hg add foo | |
254 |
$ hg q |
|
259 | $ hg qnew foo | |
255 | $ hg qpop |
|
260 | $ hg qpop -a | |
256 | popping foo |
|
261 | popping foo | |
|
262 | popping bar | |||
|
263 | popping empty-important | |||
|
264 | popping guarded | |||
257 | patch queue now empty |
|
265 | patch queue now empty | |
258 |
|
266 | $ hg qguard guarded +guarded | ||
259 | $ hg qnew empty-important -m 'important commit message' |
|
|||
260 |
|
||||
261 | $ hg qnew bar |
|
|||
262 | $ hg qguard bar +baz |
|
267 | $ hg qguard bar +baz | |
263 | $ echo bar > bar |
|
268 | $ hg qguard foo +baz | |
264 |
$ hg |
|
269 | $ hg qselect baz | |
265 | $ hg qref |
|
270 | number of unguarded, unapplied patches has changed from 1 to 3 | |
|
271 | $ hg qpush bar | |||
|
272 | applying empty-important | |||
|
273 | patch empty-important is empty | |||
|
274 | applying bar | |||
|
275 | now at: bar | |||
266 |
|
276 | |||
267 | $ hg qguard -l |
|
277 | $ hg qguard -l | |
|
278 | guarded: +guarded | |||
268 | empty-important: unguarded |
|
279 | empty-important: unguarded | |
269 | bar: +baz |
|
280 | bar: +baz | |
270 | foo: +baz |
|
281 | foo: +baz | |
271 |
|
282 | |||
272 | $ hg tglog |
|
283 | $ hg tglog | |
273 |
@ 2: ' |
|
284 | @ 2: 'imported patch bar' tags: bar qtip tip | |
274 | | |
|
285 | | | |
275 | o 1: 'important commit message' tags: empty-important qbase |
|
286 | o 1: 'important commit message' tags: empty-important qbase | |
276 | | |
|
287 | | | |
@@ -303,18 +314,21 b' Rebase bar (make sure series order is pr' | |||||
303 | removed from the series): |
|
314 | removed from the series): | |
304 |
|
315 | |||
305 | $ hg qseries |
|
316 | $ hg qseries | |
|
317 | guarded | |||
306 | empty-important |
|
318 | empty-important | |
307 | bar |
|
319 | bar | |
308 | foo |
|
320 | foo | |
309 | $ [ -f .hg/patches/empty-important ] |
|
321 | $ [ -f .hg/patches/empty-important ] | |
310 | $ hg -q rebase -d 2 |
|
322 | $ hg -q rebase -d 2 | |
311 | $ hg qseries |
|
323 | $ hg qseries | |
|
324 | guarded | |||
312 | bar |
|
325 | bar | |
313 | foo |
|
326 | foo | |
314 | $ [ -f .hg/patches/empty-important ] |
|
327 | $ [ -f .hg/patches/empty-important ] | |
315 | [1] |
|
328 | [1] | |
316 |
|
329 | |||
317 | $ hg qguard -l |
|
330 | $ hg qguard -l | |
|
331 | guarded: +guarded | |||
318 | bar: +baz |
|
332 | bar: +baz | |
319 | foo: +baz |
|
333 | foo: +baz | |
320 |
|
334 |
General Comments 0
You need to be logged in to leave comments.
Login now