[PATCH 1 of 3 ctx-cleanup] context: inline makememctx (API)

Sean Farley sean at farley.io
Thu Jun 1 14:36:03 EDT 2017


Augie Fackler <raf at durin42.com> writes:

> On Wed, May 31, 2017 at 05:22:06PM -0700, Sean Farley wrote:
>> # HG changeset patch
>> # User Sean Farley <sean at farley.io>
>> # Date 1494536055 25200
>> #      Thu May 11 13:54:15 2017 -0700
>> # Branch wctxds
>> # Node ID 9879720e90cf13e445d17fc22f53c071a22322d9
>> # Parent  60b3e8946da728c377a3a6aadb785ae308084614
>> context: inline makememctx (API)
>>
>
> [...]
>
>> -    def __init__(self, repo, parents, text, files, filectxfn, user=None,
>> -                 date=None, extra=None, editor=False):
>> +    def __init__(self, repo, parents, text, files, filectxfn=None, user=None,
>> +                 date=None, extra=None, branch=None, editor=False):
>>          super(memctx, self).__init__(repo, text, user, date, extra)
>>          self._rev = None
>>          self._node = None
>>          parents = [(p or nullid) for p in parents]
>>          p1, p2 = parents
>>          self._parents = [changectx(self._repo, p) for p in (p1, p2)]
>>          files = sorted(set(files))
>>          self._files = files
>> +        if branch is not None:
>> +            self._extra['branch'] = encoding.fromlocal(branch)
>>          self.substate = {}
>>
>> -        # if store is not callable, wrap it in a function
>> -        if not callable(filectxfn):
>> +        if filectxfn is not None and isinstance(filectxfn, patch.filestore):
>> +            def getfilectx(repo, memctx, path):
>
> nit: I don't think this function need be nested. Could you send a
> followup that moves it to be something like _defaultgetfilectx at
> module level if I'm right?

Sure, sounds good.
-------------- 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/20170601/fcda590c/attachment.sig>


More information about the Mercurial-devel mailing list