Show More
@@ -1865,6 +1865,39 b' def series(ui, repo, **opts):' | |||||
1865 | repo.mq.qseries(repo, missing=opts['missing'], summary=opts['summary']) |
|
1865 | repo.mq.qseries(repo, missing=opts['missing'], summary=opts['summary']) | |
1866 | return 0 |
|
1866 | return 0 | |
1867 |
|
1867 | |||
|
1868 | def top(ui, repo, **opts): | |||
|
1869 | """print the name of the current patch""" | |||
|
1870 | q = repo.mq | |||
|
1871 | t = q.applied and q.series_end(True) or 0 | |||
|
1872 | if t: | |||
|
1873 | return q.qseries(repo, start=t-1, length=1, status='A', | |||
|
1874 | summary=opts.get('summary')) | |||
|
1875 | else: | |||
|
1876 | ui.write(_("no patches applied\n")) | |||
|
1877 | return 1 | |||
|
1878 | ||||
|
1879 | def next(ui, repo, **opts): | |||
|
1880 | """print the name of the next patch""" | |||
|
1881 | q = repo.mq | |||
|
1882 | end = q.series_end() | |||
|
1883 | if end == len(q.series): | |||
|
1884 | ui.write(_("all patches applied\n")) | |||
|
1885 | return 1 | |||
|
1886 | return q.qseries(repo, start=end, length=1, summary=opts.get('summary')) | |||
|
1887 | ||||
|
1888 | def prev(ui, repo, **opts): | |||
|
1889 | """print the name of the previous patch""" | |||
|
1890 | q = repo.mq | |||
|
1891 | l = len(q.applied) | |||
|
1892 | if l == 1: | |||
|
1893 | ui.write(_("only one patch applied\n")) | |||
|
1894 | return 1 | |||
|
1895 | if not l: | |||
|
1896 | ui.write(_("no patches applied\n")) | |||
|
1897 | return 1 | |||
|
1898 | return q.qseries(repo, start=l-2, length=1, status='A', | |||
|
1899 | summary=opts.get('summary')) | |||
|
1900 | ||||
1868 | def setupheaderopts(ui, opts): |
|
1901 | def setupheaderopts(ui, opts): | |
1869 | def do(opt, val): |
|
1902 | def do(opt, val): | |
1870 | if not opts[opt] and opts['current' + opt]: |
|
1903 | if not opts[opt] and opts['current' + opt]: | |
@@ -2579,6 +2612,8 b' cmdtable = {' | |||||
2579 | ('d', 'date', '', _('add "Date: <given date>" to patch')) |
|
2612 | ('d', 'date', '', _('add "Date: <given date>" to patch')) | |
2580 | ] + commands.walkopts + commands.commitopts, |
|
2613 | ] + commands.walkopts + commands.commitopts, | |
2581 | _('hg qnew [-e] [-m TEXT] [-l FILE] [-f] PATCH [FILE]...')), |
|
2614 | _('hg qnew [-e] [-m TEXT] [-l FILE] [-f] PATCH [FILE]...')), | |
|
2615 | "qnext": (next, [] + seriesopts, _('hg qnext [-s]')), | |||
|
2616 | "qprev": (prev, [] + seriesopts, _('hg qprev [-s]')), | |||
2582 | "^qpop": |
|
2617 | "^qpop": | |
2583 | (pop, |
|
2618 | (pop, | |
2584 | [('a', 'all', None, _('pop all patches')), |
|
2619 | [('a', 'all', None, _('pop all patches')), | |
@@ -2636,6 +2671,7 b' cmdtable = {' | |||||
2636 | ('b', 'backup', None, _('bundle unrelated changesets')), |
|
2671 | ('b', 'backup', None, _('bundle unrelated changesets')), | |
2637 | ('n', 'nobackup', None, _('no backups'))], |
|
2672 | ('n', 'nobackup', None, _('no backups'))], | |
2638 | _('hg strip [-f] [-b] [-n] REV')), |
|
2673 | _('hg strip [-f] [-b] [-n] REV')), | |
|
2674 | "qtop": (top, [] + seriesopts, _('hg qtop [-s]')), | |||
2639 | "qunapplied": |
|
2675 | "qunapplied": | |
2640 | (unapplied, |
|
2676 | (unapplied, | |
2641 | [('1', 'first', None, _('show only the first patch'))] + seriesopts, |
|
2677 | [('1', 'first', None, _('show only the first patch'))] + seriesopts, |
@@ -152,6 +152,9 b' hg qpush' | |||||
152 | echo % qapplied |
|
152 | echo % qapplied | |
153 | hg qapplied |
|
153 | hg qapplied | |
154 |
|
154 | |||
|
155 | echo % qtop | |||
|
156 | hg qtop | |||
|
157 | ||||
155 | echo % prev |
|
158 | echo % prev | |
156 | hg qapp -1 |
|
159 | hg qapp -1 | |
157 |
|
160 |
@@ -59,6 +59,8 b' hg qguard c.patch' | |||||
59 |
|
59 | |||
60 | echo % should skip c.patch |
|
60 | echo % should skip c.patch | |
61 | hg qpush -a |
|
61 | hg qpush -a | |
|
62 | echo % should display b.patch | |||
|
63 | hg qtop | |||
62 |
|
64 | |||
63 | hg qguard -n c.patch |
|
65 | hg qguard -n c.patch | |
64 | echo % should push c.patch |
|
66 | echo % should push c.patch | |
@@ -82,6 +84,9 b' hg qselect 2' | |||||
82 | echo % should push b.patch |
|
84 | echo % should push b.patch | |
83 | hg qpush |
|
85 | hg qpush | |
84 | hg qpush -a |
|
86 | hg qpush -a | |
|
87 | # Used to be an issue with holes in the patch sequence | |||
|
88 | # So, put one hole on the base and ask for topmost patch. | |||
|
89 | hg qtop | |||
85 | hg qpop -a |
|
90 | hg qpop -a | |
86 |
|
91 | |||
87 | hg qselect 1 2 |
|
92 | hg qselect 1 2 |
@@ -34,6 +34,8 b' c.patch: -a' | |||||
34 | applying b.patch |
|
34 | applying b.patch | |
35 | skipping c.patch - guarded by '-a' |
|
35 | skipping c.patch - guarded by '-a' | |
36 | now at: b.patch |
|
36 | now at: b.patch | |
|
37 | % should display b.patch | |||
|
38 | b.patch | |||
37 | % should push c.patch |
|
39 | % should push c.patch | |
38 | applying c.patch |
|
40 | applying c.patch | |
39 | now at: c.patch |
|
41 | now at: c.patch | |
@@ -64,6 +66,7 b' applying b.patch' | |||||
64 | now at: b.patch |
|
66 | now at: b.patch | |
65 | applying c.patch |
|
67 | applying c.patch | |
66 | now at: c.patch |
|
68 | now at: c.patch | |
|
69 | c.patch | |||
67 | popping c.patch |
|
70 | popping c.patch | |
68 | popping b.patch |
|
71 | popping b.patch | |
69 | patch queue now empty |
|
72 | patch queue now empty |
@@ -36,7 +36,9 b' list of commands:' | |||||
36 | qimport import a patch |
|
36 | qimport import a patch | |
37 | qinit init a new queue repository |
|
37 | qinit init a new queue repository | |
38 | qnew create a new patch |
|
38 | qnew create a new patch | |
|
39 | qnext print the name of the next patch | |||
39 | qpop pop the current patch off the stack |
|
40 | qpop pop the current patch off the stack | |
|
41 | qprev print the name of the previous patch | |||
40 | qpush push the next patch onto the stack |
|
42 | qpush push the next patch onto the stack | |
41 | qrefresh update the current patch |
|
43 | qrefresh update the current patch | |
42 | qrename rename a patch |
|
44 | qrename rename a patch | |
@@ -44,6 +46,7 b' list of commands:' | |||||
44 | qsave save current queue state |
|
46 | qsave save current queue state | |
45 | qselect set or print guarded patches to push |
|
47 | qselect set or print guarded patches to push | |
46 | qseries print the entire series file |
|
48 | qseries print the entire series file | |
|
49 | qtop print the name of the current patch | |||
47 | qunapplied print the patches not yet applied |
|
50 | qunapplied print the patches not yet applied | |
48 | strip strip a revision and all its descendants from the repository |
|
51 | strip strip a revision and all its descendants from the repository | |
49 |
|
52 | |||
@@ -140,6 +143,8 b' now at: test2.patch' | |||||
140 | % qapplied |
|
143 | % qapplied | |
141 | test.patch |
|
144 | test.patch | |
142 | test2.patch |
|
145 | test2.patch | |
|
146 | % qtop | |||
|
147 | test2.patch | |||
143 | % prev |
|
148 | % prev | |
144 | test.patch |
|
149 | test.patch | |
145 | % next |
|
150 | % next |
General Comments 0
You need to be logged in to leave comments.
Login now