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