Submitter | Gregory Szorc |
---|---|
Date | June 1, 2015, 12:28 a.m. |
Message ID | <a9a943bfb732069110dd.1433118508@vm-ubuntu-main.gateway.sonic.net> |
Download | mbox | patch |
Permalink | /patch/9412/ |
State | Changes Requested |
Headers | show |
Comments
On 05/31/2015 05:28 PM, Gregory Szorc wrote: > # HG changeset patch > # User Gregory Szorc <gregory.szorc@gmail.com> > # Date 1432593644 25200 > # Mon May 25 15:40:44 2015 -0700 > # Node ID a9a943bfb732069110dd2d211f842bad22547535 > # Parent 123f42f6cc182ad6bc6105a4add222b9467834e7 > exchange: store outgoing instance bundle20 instances > > bundle2 provides a container to hold generic data. Currently, all > in-core users of this mechanism transfer data relevant to the state > of the entire repository as opposed to data specific to changesets. > > Built on top of work to have changegroup functions expose a > discovery.outgoing that says what is in a changegroup, we now capture > the outgoing instance explicitly in bundle20 instances. This enables > future bundle2 part generators to examine the changesets sent and add > data for just that subset. Meh, bundle2 is in charge of receiving part, not keeping track of the data used for its creation. Storing outgoing here seems like a layer violation. Especially because multiple changegroup part can be added to the same bundler. You want something like a "serversidegetbundleoperation" it you want to keep track of state during this operation. But reading the rest of your series, I'm not sure you need to keep that data around as it is very simple to compute again. > diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py > --- a/mercurial/bundle2.py > +++ b/mercurial/bundle2.py > @@ -469,8 +469,11 @@ class bundle20(object): > self.ui = ui > self._params = [] > self._parts = [] > self.capabilities = dict(capabilities) > + # discovery.outgoing instance describing state of changegroup data. > + # .missing will be the list of changesets being sent. > + self.outgoing = None > > @property > def nbparts(self): > """total number of parts added to the bundler""" > diff --git a/mercurial/exchange.py b/mercurial/exchange.py > --- a/mercurial/exchange.py > +++ b/mercurial/exchange.py > @@ -480,8 +480,9 @@ def _pushb2ctx(pushop, bundler): > pushop.stepsdone.add('changesets') > # Send known heads to the server for race detection. > if not _pushcheckoutgoing(pushop): > return > + bundler.outgoing = pushop.outgoing > pushop.repo.prepushoutgoinghooks(pushop.repo, > pushop.remote, > pushop.outgoing) > if not pushop.force: > @@ -1235,25 +1236,28 @@ def _getbundlechangegrouppart(bundler, r > # build changegroup bundle here. > version = None > cgversions = b2caps.get('changegroup') > if not cgversions: # 3.1 and 3.2 ship with an empty value > - cg = changegroup.getchangegroupraw(repo, source, heads=heads, > - common=common, > - bundlecaps=bundlecaps)[1] > + outgoing, cg = changegroup.getchangegroupraw(repo, source, > + heads=heads, > + common=common, > + bundlecaps=bundlecaps) > else: > cgversions = [v for v in cgversions if v in changegroup.packermap] > if not cgversions: > raise ValueError(_('no common changegroup version')) > version = max(cgversions) > - cg = changegroup.getchangegroupraw(repo, source, heads=heads, > - common=common, > - bundlecaps=bundlecaps, > - version=version)[1] > + outgoing, cg = changegroup.getchangegroupraw(repo, source, > + heads=heads, > + common=common, > + bundlecaps=bundlecaps, > + version=version) > > if cg: > part = bundler.newpart('changegroup', data=cg) > if version is not None: > part.addparam('version', version) > + bundler.outgoing = outgoing > > @getbundle2partsgenerator('listkeys') > def _getbundlelistkeysparts(bundler, repo, source, bundlecaps=None, > b2caps=None, **kwargs): > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > https://selenic.com/mailman/listinfo/mercurial-devel >
Patch
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -469,8 +469,11 @@ class bundle20(object): self.ui = ui self._params = [] self._parts = [] self.capabilities = dict(capabilities) + # discovery.outgoing instance describing state of changegroup data. + # .missing will be the list of changesets being sent. + self.outgoing = None @property def nbparts(self): """total number of parts added to the bundler""" diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -480,8 +480,9 @@ def _pushb2ctx(pushop, bundler): pushop.stepsdone.add('changesets') # Send known heads to the server for race detection. if not _pushcheckoutgoing(pushop): return + bundler.outgoing = pushop.outgoing pushop.repo.prepushoutgoinghooks(pushop.repo, pushop.remote, pushop.outgoing) if not pushop.force: @@ -1235,25 +1236,28 @@ def _getbundlechangegrouppart(bundler, r # build changegroup bundle here. version = None cgversions = b2caps.get('changegroup') if not cgversions: # 3.1 and 3.2 ship with an empty value - cg = changegroup.getchangegroupraw(repo, source, heads=heads, - common=common, - bundlecaps=bundlecaps)[1] + outgoing, cg = changegroup.getchangegroupraw(repo, source, + heads=heads, + common=common, + bundlecaps=bundlecaps) else: cgversions = [v for v in cgversions if v in changegroup.packermap] if not cgversions: raise ValueError(_('no common changegroup version')) version = max(cgversions) - cg = changegroup.getchangegroupraw(repo, source, heads=heads, - common=common, - bundlecaps=bundlecaps, - version=version)[1] + outgoing, cg = changegroup.getchangegroupraw(repo, source, + heads=heads, + common=common, + bundlecaps=bundlecaps, + version=version) if cg: part = bundler.newpart('changegroup', data=cg) if version is not None: part.addparam('version', version) + bundler.outgoing = outgoing @getbundle2partsgenerator('listkeys') def _getbundlelistkeysparts(bundler, repo, source, bundlecaps=None, b2caps=None, **kwargs):