[PATCH 1 of 2] filemerge: extract conflict marker searching into its own function
Siddharth Agarwal
sid at less-broken.com
Sat Aug 30 17:58:16 UTC 2014
On Aug 30, 2014 7:42 PM, "Gregory Szorc" <gregory.szorc at gmail.com> wrote:
>
> # HG changeset patch
> # User Gregory Szorc <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.)
> +
> # tell hggettext to extract docstrings from these functions:
> i18nfunctions = internals.values()
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20140830/c8381503/attachment-0002.html>
More information about the Mercurial-devel
mailing list