Mercurial > hg
comparison mercurial/cmdutil.py @ 24309:fefcafda10b8
record: change interface of dorecord to accept new filters
This makes it easier to add different filtering logic (record /crecord ...)
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Wed, 11 Mar 2015 16:39:38 -0700 |
parents | 6ddc86eedc3b |
children | e02a0a419418 |
comparison
equal
deleted
inserted
replaced
24308:1725843a7644 | 24309:fefcafda10b8 |
---|---|
17 import lock as lockmod | 17 import lock as lockmod |
18 | 18 |
19 def parsealiases(cmd): | 19 def parsealiases(cmd): |
20 return cmd.lstrip("^").split("|") | 20 return cmd.lstrip("^").split("|") |
21 | 21 |
22 def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, *pats, **opts): | 22 def recordfilter(ui, fp): |
23 return patch.filterpatch(ui, patch.parsepatch(fp)) | |
24 | |
25 def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, | |
26 filterfn, *pats, **opts): | |
23 import merge as mergemod | 27 import merge as mergemod |
24 if not ui.interactive(): | 28 if not ui.interactive(): |
25 raise util.Abort(_('running non-interactively, use %s instead') % | 29 raise util.Abort(_('running non-interactively, use %s instead') % |
26 cmdsuggest) | 30 cmdsuggest) |
27 | 31 |
59 fp.write(''.join(originalchunks)) | 63 fp.write(''.join(originalchunks)) |
60 fp.seek(0) | 64 fp.seek(0) |
61 | 65 |
62 # 1. filter patch, so we have intending-to apply subset of it | 66 # 1. filter patch, so we have intending-to apply subset of it |
63 try: | 67 try: |
64 chunks = patch.filterpatch(ui, patch.parsepatch(fp)) | 68 chunks = filterfn(ui, fp) |
65 except patch.PatchError, err: | 69 except patch.PatchError, err: |
66 raise util.Abort(_('error parsing patch: %s') % err) | 70 raise util.Abort(_('error parsing patch: %s') % err) |
67 | 71 |
68 del fp | 72 del fp |
69 | 73 |