Show More
@@ -1866,6 +1866,39 b' def series(ui, repo, **opts):' | |||||
1866 | repo.mq.qseries(repo, missing=opts['missing'], summary=opts['summary']) |
|
1866 | repo.mq.qseries(repo, missing=opts['missing'], summary=opts['summary']) | |
1867 | return 0 |
|
1867 | return 0 | |
1868 |
|
1868 | |||
|
1869 | def top(ui, repo, **opts): | |||
|
1870 | """print the name of the current patch""" | |||
|
1871 | q = repo.mq | |||
|
1872 | t = q.applied and q.series_end(True) or 0 | |||
|
1873 | if t: | |||
|
1874 | return q.qseries(repo, start=t-1, length=1, status='A', | |||
|
1875 | summary=opts.get('summary')) | |||
|
1876 | else: | |||
|
1877 | ui.write(_("no patches applied\n")) | |||
|
1878 | return 1 | |||
|
1879 | ||||
|
1880 | def next(ui, repo, **opts): | |||
|
1881 | """print the name of the next patch""" | |||
|
1882 | q = repo.mq | |||
|
1883 | end = q.series_end() | |||
|
1884 | if end == len(q.series): | |||
|
1885 | ui.write(_("all patches applied\n")) | |||
|
1886 | return 1 | |||
|
1887 | return q.qseries(repo, start=end, length=1, summary=opts.get('summary')) | |||
|
1888 | ||||
|
1889 | def prev(ui, repo, **opts): | |||
|
1890 | """print the name of the previous patch""" | |||
|
1891 | q = repo.mq | |||
|
1892 | l = len(q.applied) | |||
|
1893 | if l == 1: | |||
|
1894 | ui.write(_("only one patch applied\n")) | |||
|
1895 | return 1 | |||
|
1896 | if not l: | |||
|
1897 | ui.write(_("no patches applied\n")) | |||
|
1898 | return 1 | |||
|
1899 | return q.qseries(repo, start=l-2, length=1, status='A', | |||
|
1900 | summary=opts.get('summary')) | |||
|
1901 | ||||
1869 | def setupheaderopts(ui, opts): |
|
1902 | def setupheaderopts(ui, opts): | |
1870 | def do(opt, val): |
|
1903 | def do(opt, val): | |
1871 | if not opts[opt] and opts['current' + opt]: |
|
1904 | if not opts[opt] and opts['current' + opt]: | |
@@ -2580,6 +2613,8 b' cmdtable = {' | |||||
2580 | ('d', 'date', '', _('add "Date: <given date>" to patch')) |
|
2613 | ('d', 'date', '', _('add "Date: <given date>" to patch')) | |
2581 | ] + commands.walkopts + commands.commitopts, |
|
2614 | ] + commands.walkopts + commands.commitopts, | |
2582 | _('hg qnew [-e] [-m TEXT] [-l FILE] [-f] PATCH [FILE]...')), |
|
2615 | _('hg qnew [-e] [-m TEXT] [-l FILE] [-f] PATCH [FILE]...')), | |
|
2616 | "qnext": (next, [] + seriesopts, _('hg qnext [-s]')), | |||
|
2617 | "qprev": (prev, [] + seriesopts, _('hg qprev [-s]')), | |||
2583 | "^qpop": |
|
2618 | "^qpop": | |
2584 | (pop, |
|
2619 | (pop, | |
2585 | [('a', 'all', None, _('pop all patches')), |
|
2620 | [('a', 'all', None, _('pop all patches')), | |
@@ -2637,6 +2672,7 b' cmdtable = {' | |||||
2637 | ('b', 'backup', None, _('bundle unrelated changesets')), |
|
2672 | ('b', 'backup', None, _('bundle unrelated changesets')), | |
2638 | ('n', 'nobackup', None, _('no backups'))], |
|
2673 | ('n', 'nobackup', None, _('no backups'))], | |
2639 | _('hg strip [-f] [-b] [-n] REV')), |
|
2674 | _('hg strip [-f] [-b] [-n] REV')), | |
|
2675 | "qtop": (top, [] + seriesopts, _('hg qtop [-s]')), | |||
2640 | "qunapplied": |
|
2676 | "qunapplied": | |
2641 | (unapplied, |
|
2677 | (unapplied, | |
2642 | [('1', 'first', None, _('show only the first patch'))] + seriesopts, |
|
2678 | [('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 |
@@ -37,7 +37,9 b' list of commands:' | |||||
37 | qimport import a patch |
|
37 | qimport import a patch | |
38 | qinit init a new queue repository |
|
38 | qinit init a new queue repository | |
39 | qnew create a new patch |
|
39 | qnew create a new patch | |
|
40 | qnext print the name of the next patch | |||
40 | qpop pop the current patch off the stack |
|
41 | qpop pop the current patch off the stack | |
|
42 | qprev print the name of the previous patch | |||
41 | qpush push the next patch onto the stack |
|
43 | qpush push the next patch onto the stack | |
42 | qrefresh update the current patch |
|
44 | qrefresh update the current patch | |
43 | qrename rename a patch |
|
45 | qrename rename a patch | |
@@ -45,6 +47,7 b' list of commands:' | |||||
45 | qsave save current queue state |
|
47 | qsave save current queue state | |
46 | qselect set or print guarded patches to push |
|
48 | qselect set or print guarded patches to push | |
47 | qseries print the entire series file |
|
49 | qseries print the entire series file | |
|
50 | qtop print the name of the current patch | |||
48 | qunapplied print the patches not yet applied |
|
51 | qunapplied print the patches not yet applied | |
49 | strip strip a revision and all its descendants from the repository |
|
52 | strip strip a revision and all its descendants from the repository | |
50 |
|
53 | |||
@@ -141,6 +144,8 b' now at: test2.patch' | |||||
141 | % qapplied |
|
144 | % qapplied | |
142 | test.patch |
|
145 | test.patch | |
143 | test2.patch |
|
146 | test2.patch | |
|
147 | % qtop | |||
|
148 | test2.patch | |||
144 | % prev |
|
149 | % prev | |
145 | test.patch |
|
150 | test.patch | |
146 | % next |
|
151 | % next |
General Comments 0
You need to be logged in to leave comments.
Login now