[PATCH 5 of 5 V2] simplemerge: write merge result to the localctx, if passed

Sean Farley sean at farley.io
Tue Jul 4 22:07:36 EDT 2017


Phil Cohen <phillco at fb.com> writes:

> # HG changeset patch
> # User Phil Cohen <phillco at fb.com>
> # Date 1499213534 25200
> #      Tue Jul 04 17:12:14 2017 -0700
> # Node ID 52493999f5be383353a73c5f53143595fbf2a494
> # Parent  fa38e77dd154d1dbabb2505dd27d972a2d7cc5cf
> simplemerge: write merge result to the localctx, if passed
>
> diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py
> --- a/mercurial/simplemerge.py
> +++ b/mercurial/simplemerge.py
> @@ -412,8 +412,8 @@
>      """Performs the simplemerge algorithm.
>  
>      {local|base|other}ctx are optional. If passed, they (local/base/other) will
> -    be read from. You should pass explicit labels in this mode since the default
> -    is to use the file paths."""
> +    be read from and the merge result written to (local). You should pass
> +    explicit labels in this mode since the default is to use the file paths."""
>      def readfile(filename):
>          f = open(filename, "rb")
>          text = f.read()
> @@ -433,6 +433,17 @@
>          return repo.wwritedata(ctx.path(),
>                                 _verifytext(ctx.data(), ctx.path(), ui, opts))
>  
> +    class ctxwriter(object):
> +        def __init__(self, ctx):
> +            self.ctx = ctx
> +            self.text = ""
> +
> +        def write(self, text):
> +            self.text += text
> +
> +        def close(self):
> +            self.ctx.write(self.text, self.ctx.flags())

Is this also a helper class while this method gets refactored?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170704/5d7fc2c6/attachment.sig>


More information about the Mercurial-devel mailing list