Submitter | Gregory Szorc |
---|---|
Date | Aug. 31, 2014, 7:56 a.m. |
Message ID | <55c81bbb9b76fe941fae.1409471772@gps-mbp.local> |
Download | mbox | patch |
Permalink | /patch/5647/ |
State | Accepted |
Headers | show |
Comments
On 08/31/2014 09:56 AM, Gregory Szorc wrote: > + if haveconflictmarkers(fcd): ... > +def hasconflictmarkers(fctx): This inconsistency is primarily a bug in the definition of the English language, but it also highlights the need for test coverage of this. /Mads
On Sun, 2014-08-31 at 09:56 +0200, Gregory Szorc wrote: > + if haveconflictmarkers(fcd): > > +def hasconflictmarkers(fctx): I question whether this was tested, but I like the idea.
On 09/01/2014 11:16 PM, Matt Mackall wrote: > On Sun, 2014-08-31 at 09:56 +0200, Gregory Szorc wrote: > >> + if haveconflictmarkers(fcd): >> >> +def hasconflictmarkers(fctx): > > I question whether this was tested, but I like the idea. He might have piped his patch through an mq filter to tests your skills.
Patch
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -433,10 +433,9 @@ def filemerge(repo, mynode, orig, fcd, f return r if not r and (_toolbool(ui, tool, "checkconflicts") or 'conflicts' in _toollist(ui, tool, "check")): - if re.search("^(<<<<<<< .*|=======|>>>>>>> .*)$", fcd.data(), - re.MULTILINE): + if haveconflictmarkers(fcd): r = 1 checked = False if 'prompt' in _toollist(ui, tool, "check"): @@ -465,6 +464,11 @@ def filemerge(repo, mynode, orig, fcd, f util.unlink(b) util.unlink(c) return r +def hasconflictmarkers(fctx): + """Whether data from a filecontext has conflict markers.""" + return re.search("^(<<<<<<< .*|=======|>>>>>>> .*)$", fctx.data(), + re.MULTILINE) + # tell hggettext to extract docstrings from these functions: i18nfunctions = internals.values()