Mercurial > hg
comparison hgext/mq.py @ 4713:c29ee52e0b68
mq: support qnew -I/-X and file name lists
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Mon, 25 Jun 2007 11:13:27 -0700 |
parents | f49fcbb325bc |
children | 487943b52a6c |
comparison
equal
deleted
inserted
replaced
4712:f49fcbb325bc | 4713:c29ee52e0b68 |
---|---|
594 if refresh: | 594 if refresh: |
595 raise util.Abort(_("local changes found, refresh first")) | 595 raise util.Abort(_("local changes found, refresh first")) |
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() |
606 insert = self.full_series_end() | 613 insert = self.full_series_end() |
607 if msg: | 614 if msg: |
1544 ui.write("No patches applied\n") | 1551 ui.write("No patches applied\n") |
1545 return 1 | 1552 return 1 |
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 |
1559 commit message is 'New patch: PATCH'""" | 1568 commit message is 'New patch: PATCH'""" |
1560 q = repo.mq | 1569 q = repo.mq |
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 |
1568 def refresh(ui, repo, *pats, **opts): | 1578 def refresh(ui, repo, *pats, **opts): |
1569 """update the current patch | 1579 """update the current patch |
2122 [('c', 'create-repo', None, 'create queue repository')], | 2132 [('c', 'create-repo', None, 'create queue repository')], |
2123 'hg qinit [-c]'), | 2133 'hg qinit [-c]'), |
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": |
2133 (pop, | 2145 (pop, |
2134 [('a', 'all', None, 'pop all patches'), | 2146 [('a', 'all', None, 'pop all patches'), |