[PATCH 4 of 8] bundlerepo: make baserevision return raw text

Jun Wu quark at fb.com
Fri Apr 7 14:04:40 UTC 2017


Excerpts from Yuya Nishihara's message of 2017-04-07 22:56:54 +0900:
> On Thu, 6 Apr 2017 19:08:12 -0700, Jun Wu wrote:
> > # HG changeset patch
> > # User Jun Wu <quark at fb.com>
> > # Date 1491525809 25200
> > #      Thu Apr 06 17:43:29 2017 -0700
> > # Node ID f05275cd80eb1afde5c36470fadf224a44733c45
> > # Parent  2a254e0cac392c1e0af8bbf0645ecb02b2352f8c
> > # Available At https://bitbucket.org/quark-zju/hg-draft 
> > #              hg pull https://bitbucket.org/quark-zju/hg-draft  -r f05275cd80eb
> > bundlerepo: make baserevision return raw text
> 
> It might be better to pass 'raw' argument to baserevision(), but I'm not
> sure.

Since no deltas are built against external content in all cases, and base
revision is related to delta application. I think it's safer to not allow
raw=False.

> 
> > @@ -211,5 +211,10 @@ class bundlemanifest(bundlerevlog, manif
> >              result = '%s' % self.fulltextcache[node]
> >          else:
> > -            result = manifest.manifestrevlog.revision(self, nodeorrev)
> > +            try:
> > +                result = manifest.manifestrevlog.revision(self, nodeorrev,
> > +                                                          raw=True)
> > +            except TypeError:
> > +                # some manifestrevlog implementation does not accept "raw"
> > +                result = manifest.manifestrevlog.revision(self, nodeorrev)
> >          return result
> 
> I think the general rule is to change the API and fix non-core extensions.

I agree. I was a bit worried that it may make the series too long. But it
turns out the try block is actually not necessary here.

It should be just:

    result = manifest.manifestrevlog.revision(self, nodeorrev, raw=True)



More information about the Mercurial-devel mailing list