D4813: [RFC] narrow: the first version of narrow_widen wireprotocol command

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Mon Oct 1 13:09:42 EDT 2018


indygreg added a comment.


  From a wire protocol perspective, this looks good.

INLINE COMMENTS

> narrowwirepeer.py:65-68
> +    oldincludes = wireprototypes.decodelist(args.get('oldincludes'))
> +    newincludes = wireprototypes.decodelist(args.get('newincludes'))
> +    oldexcludes = wireprototypes.decodelist(args.get('oldexcludes'))
> +    newexcludes = wireprototypes.decodelist(args.get('newexcludes'))

I think we'll want to use `narrowspec.validatepatterns()` to ensure the patterns are of the appropriate type.

> narrowwirepeer.py:71-78
> +    newmatch = narrowspec.match(repo.root, include=newincludes,
> +                                exclude=newexcludes)
> +    oldmatch = narrowspec.match(repo.root, include=oldincludes,
> +                                exclude=oldexcludes)
> +    diffmatch = matchmod.differencematcher(newmatch, oldmatch)
> +
> +    # get changegroup data

Do we need to call `narrowspec.restrictpatterns()` anywhere in here?

> narrowwirepeer.py:79-81
> +    cg = changegroup.cg3unpacker(util.chunkbuffer(cg), None)
> +    gen = iter(lambda: cg.read(32768), '')
> +    return wireprototypes.streamres(gen=gen)

I /thought/ we had a way to get a stream of chunks out of a changegroup. i.e. we shouldn't need to go through the `util.chunkbuffer()` / `cg.read()` dance. But I could be wrong: the changegroup APIs are a bit wonky.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4813

To: pulkit, durin42, #hg-reviewers
Cc: indygreg, mercurial-devel


More information about the Mercurial-devel mailing list