##// 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,10 +596,17 b' class queue:'
596 else:
596 else:
597 raise util.Abort(_("local changes found"))
597 raise util.Abort(_("local changes found"))
598 return m, a, r, d
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 if os.path.exists(self.join(patch)):
603 if os.path.exists(self.join(patch)):
601 raise util.Abort(_('patch "%s" already exists') % patch)
604 raise util.Abort(_('patch "%s" already exists') % patch)
602 m, a, r, d = self.check_localchanges(repo, force)
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:
609 m, a, r, d = self.check_localchanges(repo, force)
603 commitfiles = m + a + r
610 commitfiles = m + a + r
604 self.check_toppatch(repo)
611 self.check_toppatch(repo)
605 wlock = repo.wlock()
612 wlock = repo.wlock()
@@ -1546,13 +1553,15 b' def prev(ui, repo, **opts):'
1546 return q.qseries(repo, start=l-2, length=1, status='A',
1553 return q.qseries(repo, start=l-2, length=1, status='A',
1547 summary=opts.get('summary'))
1554 summary=opts.get('summary'))
1548
1555
1549 def new(ui, repo, patch, **opts):
1556 def new(ui, repo, patch, *args, **opts):
1550 """create a new patch
1557 """create a new patch
1551
1558
1552 qnew creates a new patch on top of the currently-applied patch
1559 qnew creates a new patch on top of the currently-applied patch
1553 (if any). It will refuse to run if there are any outstanding
1560 (if any). It will refuse to run if there are any outstanding
1554 changes unless -f is specified, in which case the patch will
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 -e, -m or -l set the patch header as well as the commit message.
1566 -e, -m or -l set the patch header as well as the commit message.
1558 If none is specified, the patch header is empty and the
1567 If none is specified, the patch header is empty and the
@@ -1561,7 +1570,8 b' def new(ui, repo, patch, **opts):'
1561 message = cmdutil.logmessage(opts)
1570 message = cmdutil.logmessage(opts)
1562 if opts['edit']:
1571 if opts['edit']:
1563 message = ui.edit(message, ui.username())
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 q.save_dirty()
1575 q.save_dirty()
1566 return 0
1576 return 0
1567
1577
@@ -2124,9 +2134,11 b' cmdtable = {'
2124 "qnew":
2134 "qnew":
2125 (new,
2135 (new,
2126 [('e', 'edit', None, _('edit commit message')),
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 ] + commands.commitopts,
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 "qnext": (next, [] + seriesopts, 'hg qnext [-s]'),
2142 "qnext": (next, [] + seriesopts, 'hg qnext [-s]'),
2131 "qprev": (prev, [] + seriesopts, 'hg qprev [-s]'),
2143 "qprev": (prev, [] + seriesopts, 'hg qprev [-s]'),
2132 "^qpop":
2144 "^qpop":
General Comments 0
You need to be logged in to leave comments. Login now