Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Wed Mar 11 16:18:47 2015 -0700 +++ b/mercurial/cmdutil.py Wed Mar 11 16:39:38 2015 -0700 @@ -19,7 +19,11 @@ def parsealiases(cmd): return cmd.lstrip("^").split("|") -def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, *pats, **opts): +def recordfilter(ui, fp): + return patch.filterpatch(ui, patch.parsepatch(fp)) + +def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, + filterfn, *pats, **opts): import merge as mergemod if not ui.interactive(): raise util.Abort(_('running non-interactively, use %s instead') % @@ -61,7 +65,7 @@ # 1. filter patch, so we have intending-to apply subset of it try: - chunks = patch.filterpatch(ui, patch.parsepatch(fp)) + chunks = filterfn(ui, fp) except patch.PatchError, err: raise util.Abort(_('error parsing patch: %s') % err)