##// END OF EJS Templates
mq: support qnew -I/-X and file name lists
Brendan Cully -
r4713:c29ee52e default
parent child Browse files
Show More
@@ -596,9 +596,16 b' class queue:'
596 596 else:
597 597 raise util.Abort(_("local changes found"))
598 598 return m, a, r, d
599 def new(self, repo, patch, msg=None, force=None):
599
600 def new(self, repo, patch, *pats, **opts):
601 msg = opts.get('msg')
602 force = opts.get('force')
600 603 if os.path.exists(self.join(patch)):
601 604 raise util.Abort(_('patch "%s" already exists') % patch)
605 if opts.get('include') or opts.get('exclude') or pats:
606 fns, match, anypats = cmdutil.matchpats(repo, pats, opts)
607 m, a, r, d = repo.status(files=fns, match=match)[:4]
608 else:
602 609 m, a, r, d = self.check_localchanges(repo, force)
603 610 commitfiles = m + a + r
604 611 self.check_toppatch(repo)
@@ -1546,13 +1553,15 b' def prev(ui, repo, **opts):'
1546 1553 return q.qseries(repo, start=l-2, length=1, status='A',
1547 1554 summary=opts.get('summary'))
1548 1555
1549 def new(ui, repo, patch, **opts):
1556 def new(ui, repo, patch, *args, **opts):
1550 1557 """create a new patch
1551 1558
1552 1559 qnew creates a new patch on top of the currently-applied patch
1553 1560 (if any). It will refuse to run if there are any outstanding
1554 1561 changes unless -f is specified, in which case the patch will
1555 be initialised with them.
1562 be initialised with them. You may also use -I, -X, and/or a list of
1563 files after the patch name to add only changes to matching files
1564 to the new patch, leaving the rest as uncommitted modifications.
1556 1565
1557 1566 -e, -m or -l set the patch header as well as the commit message.
1558 1567 If none is specified, the patch header is empty and the
@@ -1561,7 +1570,8 b' def new(ui, repo, patch, **opts):'
1561 1570 message = cmdutil.logmessage(opts)
1562 1571 if opts['edit']:
1563 1572 message = ui.edit(message, ui.username())
1564 q.new(repo, patch, msg=message, force=opts['force'])
1573 opts['msg'] = message
1574 q.new(repo, patch, *args, **opts)
1565 1575 q.save_dirty()
1566 1576 return 0
1567 1577
@@ -2124,9 +2134,11 b' cmdtable = {'
2124 2134 "qnew":
2125 2135 (new,
2126 2136 [('e', 'edit', None, _('edit commit message')),
2127 ('f', 'force', None, _('import uncommitted changes into patch'))
2137 ('f', 'force', None, _('import uncommitted changes into patch')),
2138 ('I', 'include', [], _('include names matching the given patterns')),
2139 ('X', 'exclude', [], _('exclude names matching the given patterns'))
2128 2140 ] + commands.commitopts,
2129 'hg qnew [-e] [-m TEXT] [-l FILE] [-f] PATCH'),
2141 'hg qnew [-e] [-m TEXT] [-l FILE] [-f] PATCH [FILE]...'),
2130 2142 "qnext": (next, [] + seriesopts, 'hg qnext [-s]'),
2131 2143 "qprev": (prev, [] + seriesopts, 'hg qprev [-s]'),
2132 2144 "^qpop":
General Comments 0
You need to be logged in to leave comments. Login now