[PATCH 12 of 15] wire-proto: push parentdeltas to httprepo if flag is on

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


-- Pradeep


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

> On Mon, Jul 12, 2010 at 04:19:54PM +0530, Pradeepkumar Gayam wrote:
> > # HG changeset patch
> > # User Pradeepkumar Gayam <in3xes at gmail.com>
> > # Date 1278919594 -19800
> > # Branch stable
> > # Node ID c018677a0c5e6d0521433836b7143f4499d0b55f
> > # Parent  5cbf744770059217f22720b935e889f841c9b508
> > wire-proto: push parentdeltas to httprepo if flag is on
> >
> > diff -r 5cbf74477005 -r c018677a0c5e mercurial/httprepo.py
> > --- a/mercurial/httprepo.py   Mon Jul 12 12:38:29 2010 +0530
> > +++ b/mercurial/httprepo.py   Mon Jul 12 12:56:34 2010 +0530
> > @@ -214,7 +214,7 @@
> >              f = self.do_cmd("changegroupsubset", bases=baselst,
> heads=headlst)
> >          return util.chunkbuffer(zgenerator(f))
> >
> > -    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 response code:
> > @@ -242,10 +242,17 @@
> >          fp = url.httpsendfile(tempname, "rb")
> >          try:
> >              try:
> > -                resp = self.do_read(
> > -                     'unbundle', data=fp,
> > -                     headers={'Content-Type':
> 'application/mercurial-0.1'},
> > -                     heads=' '.join(map(hex, heads)))
> > +                if pdelta:
> > +                    resp = self.do_read(
> > +                        'unbundle', data=fp, parentdelta='parentdelta'
> > +                        headers={'Content-Type':
> 'application/mercurial-0.1'},
> > +                        heads=' '.join(map(hex, heads)))
> > +                else:
> > +                    resp = self.do_read(
> > +                        'unbundle', data=fp,
> > +                        headers={'Content-Type':
> 'application/mercurial-0.1'},
> > +                        heads=' '.join(map(hex, heads)))
> > +
>
> I am pretty sure you can avoid duplicating the code.
>


> >                  resp_code, output = resp.split('\n', 1)
> >                  try:
> >                      ret = int(resp_code)
> > diff -r 5cbf74477005 -r c018677a0c5e mercurial/localrepo.py
> > --- a/mercurial/localrepo.py  Mon Jul 12 12:38:29 2010 +0530
> > +++ b/mercurial/localrepo.py  Mon Jul 12 12:56:34 2010 +0530
> > @@ -1235,12 +1235,13 @@
> >          Return an integer: see push().
> >          '''
> >          lock = remote.lock()
> > +        pdelta = rempte.capable('parentdelta')
> >          try:
> > -            ret = discovery.prepush(self, remote, force, revs,
> newbranch)
> > +            ret = discovery.prepush(self, remote, force, revs,
> newbranch, pdelta)
>
> why would discovery need to know about pdelta ?
>
> prepush() in discovery returns changegroup so it needs to know what kind of
changegroup it shall return. Hence, that change.

>  > @@ -1255,14 +1256,15 @@
> >          # different heads (someone else won commit/push race), server
> >          # aborts.
> >
> > -        ret = discovery.prepush(self, remote, force, revs, newbranch)
> > +        pdelta = remote.capable('parentdelta')
> > +        ret = discovery.prepush(self, remote, force, revs, newbranch,
> pdelta)
>
> ditto
>
> Benoit
> --
> :wq
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100713/53c1abf2/attachment.htm>


More information about the Mercurial-devel mailing list