[PATCH 3 of 5] memctx: add _manifest implementation that computes the filenode

Sean Farley sean.michael.farley at gmail.com
Wed Jun 18 23:19:31 CDT 2014


Sean Farley writes:

> # HG changeset patch
> # User Sean Farley <sean.michael.farley at gmail.com>
> # Date 1401397979 18000
> #      Thu May 29 16:12:59 2014 -0500
> # Node ID 8bc35c83920f4a20a1de3e020662d73fa949c0a3
> # Parent  2c35a9d4b14a62fa13cc2f3a06a4a729a90ed85f
> memctx: add _manifest implementation that computes the filenode
>
> This is an initial implementation of having a manifest for memctx that computes
> the hash in the same way that filenodes are computed elsewhere.
>
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -11,10 +11,11 @@ import mdiff, error, util, scmutil, subr
>  import match as matchmod
>  import os, errno, stat
>  import obsolete as obsmod
>  import repoview
>  import fileset
> +import revlog
>  
>  propertycache = util.propertycache
>  
>  class basectx(object):
>      """A basectx object represents the common logic for its children:
> @@ -1585,10 +1586,31 @@ class memctx(committablectx):
>  
>      def commit(self):
>          """commit context to the repo"""
>          return self._repo.commitctx(self)
>  
> +    @propertycache
> +    def _manifest(self):
> +        """generate a manifest based on the return values of filectxfn"""
> +
> +        # keep this simple for now; just worry about p1
> +        pctx = self._parents[0]
> +        man = pctx.manifest().copy()
> +
> +        for f, fnode in man.iteritems():

Perhaps this should be 'for f in self.files()' since 'files' is required
to be sent into the constructor?


More information about the Mercurial-devel mailing list