[PATCH 1 of 4 flagprocessor v8] revlog: add 'raw' argument to revision and _addrevision

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Jan 9 10:25:40 EST 2017


On 01/05/2017 06:42 PM, Remi Chaintron wrote:
> # HG changeset patch
> # User Remi Chaintron <remi at fb.com>
> # Date 1483636567 0
> #      Thu Jan 05 17:16:07 2017 +0000
> # Node ID 8c12adc05b5b1c564eb068d5ad893b33aadd4f76
> # Parent  8385310370d0c472373ca9eb8aec59d50218d7e1
> revlog: add 'raw' argument to revision and _addrevision

That one looks good, with very small fix on a docstring.

I'm not super happy with the patch order as that docstring reference 
content from two patches later but that's minor and I don't have a 
better slicing idea so lets move forward. (that also why I'm not taking 
patch 1-2 without 3)

>[…]
> diff --git a/mercurial/revlog.py b/mercurial/revlog.py
> --- a/mercurial/revlog.py
> +++ b/mercurial/revlog.py
> […]
> @@ -1412,13 +1414,16 @@
>          return True
>
>      def _addrevision(self, node, text, transaction, link, p1, p2, flags,
> -                     cachedelta, ifh, dfh, alwayscache=False):
> +                     cachedelta, ifh, dfh, alwayscache=False, raw=False):
>          """internal function to add revisions to the log
>
>          see addrevision for argument descriptions.
>          invariants:
>          - text is optional (can be None); if not set, cachedelta must be set.
>            if both are set, they must correspond to each other.
> +        - raw is optional; if set to True, it indicates the revision data is to
> +          be treated by processflags() as raw. It is usually set by changegroup
> +          generation and debug commands.

s/processflags/_processflags/

That would prevent a small hunk to fix it in patch 3.

>          """
>          btext = [text]
>          def buildtext():
> @@ -1438,8 +1443,9 @@
>                      fh = ifh
>                  else:
>                      fh = dfh
> -                basetext = self.revision(self.node(baserev), _df=fh)
> +                basetext = self.revision(self.node(baserev), _df=fh, raw=raw)
>                  btext[0] = mdiff.patch(basetext, delta)
> +
>              try:
>                  self.checkhash(btext[0], node, p1=p1, p2=p2)
>                  if flags & REVIDX_ISCENSORED:
> @@ -1668,10 +1674,14 @@
>                  # the added revision, which will require a call to
>                  # revision(). revision() will fast path if there is a cache
>                  # hit. So, we tell _addrevision() to always cache in this case.
> +                # We're only using addgroup() in the context of changegroup
> +                # generation so the revision data can always be handled as raw
> +                # by the flagprocessor.
>                  chain = self._addrevision(node, None, transaction, link,
>                                            p1, p2, flags, (baserev, delta),
>                                            ifh, dfh,
> -                                          alwayscache=bool(addrevisioncb))
> +                                          alwayscache=bool(addrevisioncb),
> +                                          raw=True)
>
>                  if addrevisioncb:
>                      addrevisioncb(self, chain)
>[…]

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list