comparison hgext/mq.py @ 4549:0c61124ad877

dispatch: move dispatching code to cmdutil
author Matt Mackall <mpm@selenic.com>
date Mon, 11 Jun 2007 21:09:24 -0500
parents 4ef8fdf57e39
children eb403f295ff1
comparison
equal deleted inserted replaced
4548:c9fcebbfc422 4549:0c61124ad877
1577 before that it has no patches applied. 1577 before that it has no patches applied.
1578 1578
1579 Source patch repository is looked for in <src>/.hg/patches by 1579 Source patch repository is looked for in <src>/.hg/patches by
1580 default. Use -p <url> to change. 1580 default. Use -p <url> to change.
1581 ''' 1581 '''
1582 commands.setremoteconfig(ui, opts) 1582 cmdutil.setremoteconfig(ui, opts)
1583 if dest is None: 1583 if dest is None:
1584 dest = hg.defaultdest(source) 1584 dest = hg.defaultdest(source)
1585 sr = hg.repository(ui, ui.expandpath(source)) 1585 sr = hg.repository(ui, ui.expandpath(source))
1586 qbase, destrev = None, None 1586 qbase, destrev = None, None
1587 if sr.local(): 1587 if sr.local():
1668 1668
1669 -e, -m or -l set the patch header as well as the commit message. 1669 -e, -m or -l set the patch header as well as the commit message.
1670 If none is specified, the patch header is empty and the 1670 If none is specified, the patch header is empty and the
1671 commit message is 'New patch: PATCH'""" 1671 commit message is 'New patch: PATCH'"""
1672 q = repo.mq 1672 q = repo.mq
1673 message = commands.logmessage(opts) 1673 message = cmdutil.logmessage(opts)
1674 if opts['edit']: 1674 if opts['edit']:
1675 message = ui.edit(message, ui.username()) 1675 message = ui.edit(message, ui.username())
1676 q.new(repo, patch, msg=message, force=opts['force']) 1676 q.new(repo, patch, msg=message, force=opts['force'])
1677 q.save_dirty() 1677 q.save_dirty()
1678 return 0 1678 return 0
1686 1686
1687 hg add/remove/copy/rename work as usual, though you might want to use 1687 hg add/remove/copy/rename work as usual, though you might want to use
1688 git-style patches (--git or [diff] git=1) to track copies and renames. 1688 git-style patches (--git or [diff] git=1) to track copies and renames.
1689 """ 1689 """
1690 q = repo.mq 1690 q = repo.mq
1691 message = commands.logmessage(opts) 1691 message = cmdutil.logmessage(opts)
1692 if opts['edit']: 1692 if opts['edit']:
1693 if message: 1693 if message:
1694 raise util.Abort(_('option "-e" incompatible with "-m" or "-l"')) 1694 raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
1695 patch = q.applied[-1].name 1695 patch = q.applied[-1].name
1696 (message, comment, user, date, hasdiff) = q.readheaders(patch) 1696 (message, comment, user, date, hasdiff) = q.readheaders(patch)
1722 if not files: 1722 if not files:
1723 raise util.Abort(_('qfold requires at least one patch name')) 1723 raise util.Abort(_('qfold requires at least one patch name'))
1724 if not q.check_toppatch(repo): 1724 if not q.check_toppatch(repo):
1725 raise util.Abort(_('No patches applied')) 1725 raise util.Abort(_('No patches applied'))
1726 1726
1727 message = commands.logmessage(opts) 1727 message = cmdutil.logmessage(opts)
1728 if opts['edit']: 1728 if opts['edit']:
1729 if message: 1729 if message:
1730 raise util.Abort(_('option "-e" incompatible with "-m" or "-l"')) 1730 raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
1731 1731
1732 parent = q.lookup('qtip') 1732 parent = q.lookup('qtip')
1962 return 0 1962 return 0
1963 1963
1964 def save(ui, repo, **opts): 1964 def save(ui, repo, **opts):
1965 """save current queue state""" 1965 """save current queue state"""
1966 q = repo.mq 1966 q = repo.mq
1967 message = commands.logmessage(opts) 1967 message = cmdutil.logmessage(opts)
1968 ret = q.save(repo, msg=message) 1968 ret = q.save(repo, msg=message)
1969 if ret: 1969 if ret:
1970 return ret 1970 return ret
1971 q.save_dirty() 1971 q.save_dirty()
1972 if opts['copy']: 1972 if opts['copy']: