[PATCH 1 of 2] filemerge: extract conflict marker searching into its own function
Gregory Szorc
gregory.szorc at gmail.com
Sun Aug 31 02:58:01 CDT 2014
On 8/30/14 7:58 PM, Siddharth Agarwal wrote:
>
> On Aug 30, 2014 7:42 PM, "Gregory Szorc" <gregory.szorc at gmail.com
> <mailto:gregory.szorc at gmail.com>> wrote:
> >
> > # HG changeset patch
> > # User Gregory Szorc <gregory.szorc at gmail.com
> <mailto:gregory.szorc at gmail.com>>
> > # Date 1409418673 -7200
> > # Sat Aug 30 19:11:13 2014 +0200
> > # Node ID 55c81bbb9b76fe941faea87e77b0a5c95d4425f2
> > # Parent 188b8aa2120b03eead618ba150319074f4e3b42b
> > filemerge: extract conflict marker searching into its own function
> >
> > 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)
>
> I think this will fail with Markdown files with headers of length 7 --
> one way to mark a header is with equal signs
>
> (This has bitten multiple people at Facebook.)
I addressed this with a new patch in the v2 series.
More information about the Mercurial-devel
mailing list