[PATCH] obscache: use _readmarkers() from core with correct signature

Boris Feld boris.feld at octobus.net
Wed Aug 23 04:36:10 EDT 2017


The patch seems fine. Could you move the _readmarkers function
definition inside the if/else, flake8 and pyflakes are complaining:

+  hgext3rd/evolve/obscache.py:133:5: F811 redefinition of unused
'_readmarkers' from line 115

How did you detect it? Did you call _readmarkers from another
extension? Should we add an Evolve test to not be taken off-guard the
next time?

On Tue, 2017-08-22 at 13:05 -0700, Martin von Zweigbergk via Mercurial-
devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1503424759 25200
> #      Tue Aug 22 10:59:19 2017 -0700
> # Node ID efc4b69aecfb3b407ca362cff318044445e9672c
> # Parent  95470e817c00b03fcf99e486412cc7d7f0116681
> obscache: use _readmarkers() from core with correct signature
> 
> The copied _readmarkers() went stale with Mercurial core commit
> 5d3ba4395288 (obsstore: let read marker API take a range of offsets,
> 2017-06-04). At the same time, the Mercurial core version of the
> function gained the desired offset argument, so we can now use that
> function.
> 
> diff --git a/hgext3rd/evolve/obscache.py
> b/hgext3rd/evolve/obscache.py
> --- a/hgext3rd/evolve/obscache.py
> +++ b/hgext3rd/evolve/obscache.py
> @@ -127,6 +127,11 @@
>                            % diskversion)
>      return diskversion, obsolete.formats[diskversion][0](data, off)
>  
> +if obsolete._readmarkers.__code__.co_argcount > 1:
> +    # hg-4.3+ has the "offset" parameter, and _fm?readmarkers also
> have an
> +    # extra "stop" parameter
> +    _readmarkers = obsolete._readmarkers
> +
>  def markersfrom(obsstore, byteoffset, firstmarker):
>      if not firstmarker:
>          return list(obsstore)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list