[PATCH 07 of 15] localrepo: generate parentdelta'ed changegroup if flag is on

Pradeepkumar Gayam in3xes at gmail.com
Mon Jul 12 09:09:17 CDT 2010


-- Pradeep


On Mon, Jul 12, 2010 at 7:31 PM, Gilles Moris <gilles.moris at free.fr> wrote:

> On Monday 12 July 2010 12:49:49 pm Pradeepkumar Gayam wrote:
> > # HG changeset patch
> > # User Pradeepkumar Gayam <in3xes at gmail.com>
> > # Date 1278877989 -19800
> > # Branch stable
> > # Node ID 652e22c020362dff73df745be4fe1e5d1712993a
> > # Parent  d7ffd4120b04df6bf6382fc88586debe9607013e
> > localrepo: generate parentdelta'ed changegroup if flag is on
> >
> > diff -r d7ffd4120b04 -r 652e22c02036 mercurial/localrepo.py
> > --- a/mercurial/localrepo.py  Mon Jul 12 00:53:18 2010 +0530
> > +++ b/mercurial/localrepo.py  Mon Jul 12 01:23:09 2010 +0530
> > @@ -20,7 +20,7 @@
> >  propertycache = util.propertycache
> >
> >  class localrepository(repo.repository):
> > -    capabilities = set(('lookup', 'changegroupsubset', 'branchmap',
> > 'pushkey'))
> > +    capabilities = set(('lookup', 'changegroupsubset',
> > 'branchmap', 'pushkey parentdelta'))
>
> I am not familiar with the code, but I guess you want here:
> 'pushkey', 'parentdelta'
> and not
> 'pushkey parentdelta'.
>
> Yes, that is a mistake. Thanks for pointing out.

> Regards.
> Gilles.
>
> > supported = set('revlogv1 store fncache shared'.split())
> >
> >      def __init__(self, baseui, path=None, create=0):
> > @@ -1272,7 +1272,7 @@
> >              for node in nodes:
> >                  self.ui.debug("%s\n" % hex(node))
> >
> > -    def changegroupsubset(self, bases, heads, source, extranodes=None):
> > +    def changegroupsubset(self, bases, heads, source, extranodes=None,
> > pdelta=False): """Compute a changegroup consisting of all the nodes that
> > are descendents of any of the bases and ancestors of any of the heads.
> > Return a chunkbuffer object whose read() method will return @@ -1308,7
> > +1308,7 @@
> >              allheads = self.heads()
> >              allheads.sort()
> >              if heads == allheads:
> > -                return self._changegroup(msng_cl_lst, source)
> > +                return self._changegroup(msng_cl_lst, source, pdelta)
> >
> >          # slow path
> >          self.hook('preoutgoing', throw=True, source=source)
> > @@ -1543,11 +1543,11 @@
> >
> >          return util.chunkbuffer(gengroup())
> >
> > -    def changegroup(self, basenodes, source):
> > +    def changegroup(self, basenodes, source, pdelta=False):
> >          # to avoid a race we use changegroupsubset() (issue1320)
> > -        return self.changegroupsubset(basenodes, self.heads(), source)
> > +        return self.changegroupsubset(basenodes, self.heads(), source,
> > pdelta=pdelta)
> >
> > -    def _changegroup(self, nodes, source):
> > +    def _changegroup(self, nodes, source, pdelta=False):
> >          """Compute the changegroup of all nodes that we have that a
> > recipient doesn't.  Return a chunkbuffer object whose read() method will
> > return successive changegroup chunks.
> > @@ -1584,7 +1584,7 @@
> >              collect = changegroup.collector(cl, mmfs, changedfiles)
> >
> >              cnt = 0
> > -            for chnk in cl.group(nodes, identity, collect):
> > +            for chnk in cl.group(nodes, identity, collect, pdelta):
> >                  self.ui.progress(_('bundling changes'), cnt,
> > unit=_('chunks')) cnt += 1
> >                  yield chnk
> > @@ -1593,7 +1593,8 @@
> >              mnfst = self.manifest
> >              nodeiter = gennodelst(mnfst)
> >              cnt = 0
> > -            for chnk in mnfst.group(nodeiter,
> lookuprevlink_func(mnfst)):
> > +            for chnk in mnfst.group(nodeiter, lookuprevlink_func(mnfst),
> > +                                    pdelta=pdelta):
> >                  self.ui.progress(_('bundling manifests'), cnt,
> > unit=_('chunks')) cnt += 1
> >                  yield chnk
> > @@ -1610,7 +1611,7 @@
> >                      yield changegroup.chunkheader(len(fname))
> >                      yield fname
> >                      lookup = lookuprevlink_func(filerevlog)
> > -                    for chnk in filerevlog.group(nodeiter, lookup):
> > +                    for chnk in filerevlog.group(nodeiter, lookup,
> > pdelta=pdelta): self.ui.progress(
> >                              _('bundling files'), cnt, item=fname,
> > unit=_('chunks')) cnt += 1
> > diff -r d7ffd4120b04 -r 652e22c02036 mercurial/revlog.py
> > --- a/mercurial/revlog.py     Mon Jul 12 00:53:18 2010 +0530
> > +++ b/mercurial/revlog.py     Mon Jul 12 01:23:09 2010 +0530
> > @@ -1180,7 +1180,7 @@
> >              self._cache = (node, curr, text)
> >          return node
> >
> > -    def group(self, nodelist, lookup, infocollect=None):
> > +    def group(self, nodelist, lookup, infocollect=None, pdelta=False):
> >          """Calculate a delta group, yielding a sequence of changegroup
> > chunks (strings).
> >
> > @@ -1216,7 +1216,11 @@
> >                  d = self.revision(nb)
> >                  meta += mdiff.trivialdiffheader(len(d))
> >              else:
> > -                d = self.revdiff(a, b)
> > +                if pdelta:
> > +                    d = self.revdiff(self.parentrevs(b)[0], b)
> > +                else:
> > +                    d = self.revdiff(a, b)
> > +
> >              yield changegroup.chunkheader(len(meta) + len(d))
> >              yield meta
> >              if len(d) > 2**20:
> > _______________________________________________
> > Mercurial-devel mailing list
> > Mercurial-devel at selenic.com
> > http://selenic.com/mailman/listinfo/mercurial-devel
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100712/9fab0d11/attachment.htm>


More information about the Mercurial-devel mailing list