# HG changeset patch # User Bryan O'Sullivan # Date 1178655027 25200 # Node ID 905397be7688d6ce6ecace03913efe10263d1e42 # Parent 8014159074a98f6002097bed063ebf78f61aebb8 mq: add qgoto command. diff -r 8014159074a9 -r 905397be7688 hgext/mq.py --- a/hgext/mq.py Tue May 08 11:51:16 2007 -0700 +++ b/hgext/mq.py Tue May 08 13:10:27 2007 -0700 @@ -1762,6 +1762,17 @@ q.delete(repo, patches, opts) q.save_dirty() +def goto(ui, repo, patch, **opts): + '''push or pop patches until named patch is at top of stack''' + q = repo.mq + patch = q.lookup(patch) + if q.isapplied(patch): + ret = q.pop(repo, patch, force=opts['force']) + else: + ret = q.push(repo, patch, force=opts['force']) + q.save_dirty() + return ret + def guard(ui, repo, *args, **opts): '''set or print guards for a patch @@ -2202,6 +2213,8 @@ ('k', 'keep', None, _('keep folded patch files')) ] + commands.commitopts, 'hg qfold [-e] [-m ] [-l > $HGRCPATH +echo "mq=" >> $HGRCPATH + +hg init a +cd a +echo a > a +hg ci -Ama + +hg qnew a.patch +echo a >> a +hg qrefresh + +hg qnew b.patch +echo b > b +hg add b +hg qrefresh + +hg qnew c.patch +echo c > c +hg add c +hg qrefresh + +hg qgoto a.patch +hg qgoto c.patch +hg qgoto b.patch diff -r 8014159074a9 -r 905397be7688 tests/test-mq-qgoto.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-qgoto.out Tue May 08 13:10:27 2007 -0700 @@ -0,0 +1,6 @@ +adding a +Now at: a.patch +applying b.patch +applying c.patch +Now at: c.patch +Now at: b.patch diff -r 8014159074a9 -r 905397be7688 tests/test-mq.out --- a/tests/test-mq.out Tue May 08 11:51:16 2007 -0700 +++ b/tests/test-mq.out Tue May 08 13:10:27 2007 -0700 @@ -30,6 +30,7 @@ qdelete remove patches from queue qdiff diff of the current patch qfold fold the named patches into the current patch + qgoto push or pop patches until named patch is at top of stack qguard set or print guards for a patch qheader Print the header of the topmost or specified patch qimport import a patch