[PATCH inline-doc] manifest: document the extra letter in working copy manifest node

Sean Farley sean.michael.farley at gmail.com
Wed Nov 26 18:56:04 CST 2014


Pierre-Yves David writes:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1417045021 28800
> #      Wed Nov 26 15:37:01 2014 -0800
> # Node ID d20caac6d799b5b594adfd46e8423e5f94ae241a
> # Parent  9da5a7413eb8bc3e708eee62bc38342c8ff7f917
> manifest: document the extra letter in working copy manifest node
>
> As the second developer to get confused by this in November, I'm adding some
> documentation for the next poor soul.
>
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -1033,11 +1033,17 @@ class committablectx(basectx):
>      def _flagfunc(self):
>          return self._repo.dirstate.flagfunc(self._buildflagfunc)
>  
>      @propertycache
>      def _manifest(self):
> -        """generate a manifest corresponding to the values in self._status"""
> +        """generate a manifest corresponding to the values in self._status
> +
> +        This reuse the file nodeid from parent, but we append an extra letter
> +        when modified.  Modified files get and extra 'm' while added files get
> +        appened an extra 'a'. This is used by manifests merge to see that files

"Modified files get *an* extra 'm' while added files get an extra 'a'."

> +        are different and by update logic to avoid deleting fresly added file.

'deleting newly added files' sounds more idiomatic.

> +        """
>  
>          man = self._parents[0].manifest().copy()
>          if len(self._parents) > 1:
>              man2 = self.p2().manifest()
>              def getman(f):
> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -455,11 +455,14 @@ def manifestmerge(repo, wctx, p2, pa, br
>              if n1 != ma[f]:
>                  if acceptremote:
>                      actions['r'].append((f, None, "remote delete"))
>                  else:
>                      actions['cd'].append((f, None, "prompt changed/deleted"))
> -            elif n1[20:] == 'a': # added, no remote
> +            elif n1[20:] == 'a':
> +                # This extra 'a' is added by working copy manifest to mark the
> +                # file as locally added. We should forget it instead of
> +                # deleting it.
>                  actions['f'].append((f, None, "remote deleted"))
>              else:
>                  actions['r'].append((f, None, "other deleted"))
>          elif n2 and f in movewithdir:
>              f2 = movewithdir[f]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list