comparison hgext/mq.py @ 9439:f2acc0c00bec

Backed out premature qprev/qnext removal
author Matt Mackall <mpm@selenic.com>
date Mon, 14 Sep 2009 16:39:24 -0500
parents b8dc3eba4f9d
children cd67bfcfabbe
comparison
equal deleted inserted replaced
9365:b8dc3eba4f9d 9439:f2acc0c00bec
1863 1863
1864 def series(ui, repo, **opts): 1864 def series(ui, repo, **opts):
1865 """print the entire series file""" 1865 """print the entire series file"""
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
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'))
1868 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]:
1872 opts[opt] = val 1905 opts[opt] = val
2578 ('u', 'user', '', _('add "From: <given user>" to patch')), 2611 ('u', 'user', '', _('add "From: <given user>" to patch')),
2579 ('D', 'currentdate', None, _('add "Date: <current date>" to patch')), 2612 ('D', 'currentdate', None, _('add "Date: <current date>" to patch')),
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')),
2586 ('n', 'name', '', _('queue name to pop')), 2621 ('n', 'name', '', _('queue name to pop')),
2587 ('f', 'force', None, _('forget any local changes'))], 2622 ('f', 'force', None, _('forget any local changes'))],
2635 (strip, 2670 (strip,
2636 [('f', 'force', None, _('force removal with local changes')), 2671 [('f', 'force', None, _('force removal with local changes')),
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,
2643 _('hg qunapplied [-s] [PATCH]')), 2679 _('hg qunapplied [-s] [PATCH]')),
2644 "qfinish": 2680 "qfinish":