[PATCH 13 of 15] sshrepo: support parentdeltas

Pradeepkumar Gayam in3xes at gmail.com
Tue Jul 13 11:14:12 CDT 2010


-- Pradeep


On Tue, Jul 13, 2010 at 7:22 PM, Benoit Boissinot <
benoit.boissinot at ens-lyon.org> wrote:

> On Mon, Jul 12, 2010 at 04:19:55PM +0530, Pradeepkumar Gayam wrote:
> > # HG changeset patch
> > # User Pradeepkumar Gayam <in3xes at gmail.com>
> > # Date 1278922650 -19800
> > # Branch stable
> > # Node ID 57655345de4bda2ed96cd0ac1d681065c14b4203
> > # Parent  c018677a0c5e6d0521433836b7143f4499d0b55f
> > sshrepo: support parentdeltas
> >
> > diff -r c018677a0c5e -r 57655345de4b mercurial/hgweb/protocol.py
> > --- a/mercurial/hgweb/protocol.py     Mon Jul 12 12:56:34 2010 +0530
> > +++ b/mercurial/hgweb/protocol.py     Mon Jul 12 13:47:30 2010 +0530
> > @@ -167,7 +167,7 @@
> >                            urllib.quote(req.env.get('REMOTE_HOST', '')),
> >                            urllib.quote(req.env.get('REMOTE_USER', '')))
> >                      try:
> > -                        ret = repo.addchangegroup(gen, 'serve', url,
> lock=lock,pdelta)
> > +                        ret = repo.addchangegroup(gen, 'serve', url,
> lock=lock, pdelta=pdelta)
> >                      except util.Abort, inst:
> >                          sys.stdout.write("abort: %s\n" % inst)
> >                          ret = 0
> > diff -r c018677a0c5e -r 57655345de4b mercurial/sshrepo.py
> > --- a/mercurial/sshrepo.py    Mon Jul 12 12:56:34 2010 +0530
> > +++ b/mercurial/sshrepo.py    Mon Jul 12 13:47:30 2010 +0530
> > @@ -206,22 +206,36 @@
> >          except:
> >              self.abort(error.ResponseError(_("unexpected response:"),
> d))
> >
> > -    def changegroup(self, nodes, kind):
> > +    def changegroup(self, nodes, kind, pdelta=False):
> >          n = " ".join(map(hex, nodes))
> > -        return self.do_cmd("changegroup", roots=n)
> > +        if pdelta:
> > +            return self.do_cmd("changegroup", roots=n,
> parentdelta='parentdelta')
> > +        else:
> > +            return self.do_cmd("changegroup", roots=n)
>
> Can't you avoid the duplication?
> >
> > -    def changegroupsubset(self, bases, heads, kind):
> > +    def changegroupsubset(self, bases, heads, kind, pdelta=False):
> >          self.requirecap('changegroupsubset', _('look up remote
> changes'))
> >          bases = " ".join(map(hex, bases))
> >          heads = " ".join(map(hex, heads))
> > -        return self.do_cmd("changegroupsubset", bases=bases,
> heads=heads)
> > +        if pdelta:
> > +            return self.do_cmd("changegroupsubset", bases=bases,
> heads=heads,
> > +                               parentdelta='parentdelta')
> > +        else:
> > +            return self.do_cmd("changegroupsubset", bases=bases,
> heads=heads)
>
> ditto
>
> >
> > -    def unbundle(self, cg, heads, source):
> > +    def unbundle(self, cg, heads, source, pdelta=False):
> >          '''Send cg (a readable file-like object representing the
> >          changegroup to push, typically a chunkbuffer object) to the
> >          remote server as a bundle. Return an integer indicating the
> >          result of the push (see localrepository.addchangegroup()).'''
> > -        d = self.call("unbundle", heads=' '.join(map(hex, heads)))
> > +
> > +
> > +        if pdelta:
> > +            d = self.call("unbundle", heads=' '.join(map(hex, heads)),
> > +                          parentdelta='parentdelta')
> > +        else:
> > +            d = self.call("unbundle", heads=' '.join(map(hex, heads)))
> > +
>
> and here.
> >          if d:
> >              # remote may send "unsynced changes"
> >              self.abort(error.RepoError(_("push refused: %s") % d))
> > @@ -245,11 +259,15 @@
> >          except:
> >              self.abort(error.ResponseError(_("unexpected response:"),
> r))
> >
> > -    def addchangegroup(self, cg, source, url):
> > +    def addchangegroup(self, cg, source, url, pdelta=False):
> >          '''Send a changegroup to the remote server.  Return an integer
> >          similar to unbundle(). DEPRECATED, since it requires locking the
> >          remote.'''
> > -        d = self.call("addchangegroup")
> > +        if pdelta:
> > +            d = self.call("addchangegroup", parentdelta='parentdelta'))
> > +        else:
> > +            d = self.call("addchangegroup")
>
> same here.
>

Thanks for suggestion, I should avoid duplication.

Thanks,
- Pradeep

>
> --
> :wq
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100713/74f65846/attachment.htm>


More information about the Mercurial-devel mailing list