Show More
@@ -2969,18 +2969,17 b' def select(ui, repo, *args, **opts):' | |||||
2969 |
|
2969 | |||
2970 | q = repo.mq |
|
2970 | q = repo.mq | |
2971 | guards = q.active() |
|
2971 | guards = q.active() | |
|
2972 | pushable = lambda i: q.pushable(q.applied[i].name)[0] | |||
2972 | if args or opts.get('none'): |
|
2973 | if args or opts.get('none'): | |
2973 | old_unapplied = q.unapplied(repo) |
|
2974 | old_unapplied = q.unapplied(repo) | |
2974 | old_guarded = [i for i in xrange(len(q.applied)) if |
|
2975 | old_guarded = [i for i in xrange(len(q.applied)) if not pushable(i)] | |
2975 | not q.pushable(i)[0]] |
|
|||
2976 | q.setactive(args) |
|
2976 | q.setactive(args) | |
2977 | q.savedirty() |
|
2977 | q.savedirty() | |
2978 | if not args: |
|
2978 | if not args: | |
2979 | ui.status(_('guards deactivated\n')) |
|
2979 | ui.status(_('guards deactivated\n')) | |
2980 | if not opts.get('pop') and not opts.get('reapply'): |
|
2980 | if not opts.get('pop') and not opts.get('reapply'): | |
2981 | unapplied = q.unapplied(repo) |
|
2981 | unapplied = q.unapplied(repo) | |
2982 | guarded = [i for i in xrange(len(q.applied)) |
|
2982 | guarded = [i for i in xrange(len(q.applied)) if not pushable(i)] | |
2983 | if not q.pushable(i)[0]] |
|
|||
2984 | if len(unapplied) != len(old_unapplied): |
|
2983 | if len(unapplied) != len(old_unapplied): | |
2985 | ui.status(_('number of unguarded, unapplied patches has ' |
|
2984 | ui.status(_('number of unguarded, unapplied patches has ' | |
2986 | 'changed from %d to %d\n') % |
|
2985 | 'changed from %d to %d\n') % |
@@ -388,7 +388,6 b' new.patch, b.patch: Guarded. c.patch: Ap' | |||||
388 | 3 G d.patch |
|
388 | 3 G d.patch | |
389 | $ hg qselect 2 |
|
389 | $ hg qselect 2 | |
390 | number of unguarded, unapplied patches has changed from 0 to 1 |
|
390 | number of unguarded, unapplied patches has changed from 0 to 1 | |
391 | number of guarded, applied patches has changed from 1 to 0 |
|
|||
392 | $ qappunappv |
|
391 | $ qappunappv | |
393 | % hg qapplied |
|
392 | % hg qapplied | |
394 | new.patch |
|
393 | new.patch | |
@@ -507,3 +506,31 b' excercise corner cases in "qselect --rea' | |||||
507 | 0 G new.patch |
|
506 | 0 G new.patch | |
508 | 1 A c.patch |
|
507 | 1 A c.patch | |
509 | 2 A d.patch |
|
508 | 2 A d.patch | |
|
509 | ||||
|
510 | test that qselect shows "number of guarded, applied patches" correctly | |||
|
511 | ||||
|
512 | $ hg qimport -q -e b.patch | |||
|
513 | adding b.patch to series file | |||
|
514 | $ hg qguard -- b.patch -not-b | |||
|
515 | $ hg qpop -a -q | |||
|
516 | patch queue now empty | |||
|
517 | $ hg qunapplied -v | |||
|
518 | 0 G new.patch | |||
|
519 | 1 U c.patch | |||
|
520 | 2 U d.patch | |||
|
521 | 3 U b.patch | |||
|
522 | $ hg qselect not-new not-c | |||
|
523 | number of unguarded, unapplied patches has changed from 3 to 2 | |||
|
524 | $ hg qpush -q -a | |||
|
525 | patch d.patch is empty | |||
|
526 | now at: b.patch | |||
|
527 | ||||
|
528 | $ hg qapplied -v | |||
|
529 | 0 G new.patch | |||
|
530 | 1 G c.patch | |||
|
531 | 2 A d.patch | |||
|
532 | 3 A b.patch | |||
|
533 | $ hg qselect --none | |||
|
534 | guards deactivated | |||
|
535 | $ hg qselect not-new not-c not-d | |||
|
536 | number of guarded, applied patches has changed from 0 to 1 |
@@ -131,8 +131,12 b' try to push and pop while a is guarded' | |||||
131 | now at: c |
|
131 | now at: c | |
132 |
|
132 | |||
133 | now try it when a is unguarded, and we're at the top of the queue |
|
133 | now try it when a is unguarded, and we're at the top of the queue | |
|
134 | ||||
|
135 | $ hg qapplied -v | |||
|
136 | 0 G a | |||
|
137 | 1 A b | |||
|
138 | 2 A c | |||
134 | $ hg qsel block |
|
139 | $ hg qsel block | |
135 | number of guarded, applied patches has changed from 1 to 0 |
|
|||
136 | $ hg qpush b |
|
140 | $ hg qpush b | |
137 | abort: cannot push to a previous patch: b |
|
141 | abort: cannot push to a previous patch: b | |
138 | [255] |
|
142 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now