Submitter | Pierre-Yves David |
---|---|
Date | Oct. 20, 2015, 2:36 p.m. |
Message ID | <93a27c3e16d0ec1904a5.1445351777@marginatus.alto.octopoid.net> |
Download | mbox | patch |
Permalink | /patch/11182/ |
State | Accepted |
Commit | 28a6c2d72097d6478434c01347d3330b153f0e45 |
Headers | show |
Comments
On Tue, Oct 20, 2015 at 7:36 AM, Pierre-Yves David < pierre-yves.david@ens-lyon.org> wrote: > # HG changeset patch > # User Pierre-Yves David <pierre-yves.david@fb.com> > # Date 1445348739 -7200 > # Tue Oct 20 15:45:39 2015 +0200 > # Node ID 93a27c3e16d0ec1904a50757a5503ca97174aac0 > # Parent df1a29ec45bfaee30f974b06a0214a3359b369aa > # EXP-Topic generaldelta > # Available At http://hg.netv6.net/marmoute-wip/mercurial/ > # hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r > 93a27c3e16d0 > bundle2: introduce an "applybundle" function > > General comments on this series: 1) exchange.readbundle() will now return a streamclone.streamcloneapplier as well. Its apply() only takes a repo argument. Strictly speaking, all the isinstance() checks should look for it as well. However, since we don't expect many people to produce these bundles yet, it's probably OK to ignore them for now. It does, however, give us another reason for a generic applybundle(fh, ...) function. Although having attempted to write this, the APIs are so different that it's going to take a lot of refactoring. 2) I think you'll find that our test coverage on things like hook environment variables is non-existence in a number of unbundle cases. I would be scared to perform the bundle2 switchover without having these tests in place in fear of silently breaking hook and possibly even transaction semantics.
Patch
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -300,10 +300,14 @@ def _notransaction(): Raise an exception to highlight the fact that no transaction was expected to be created""" raise TransactionUnavailable() +def applybundle(repo, unbundler, tr, op=None): + # transform me in unbundler.apply() as soon as the freeze is lifted + return processbundle(repo, unbundler, lambda: tr, op=op) + def processbundle(repo, unbundler, transactiongetter=None, op=None): """This function process a bundle, apply effect to/from a repo It iterates over each part then searches for and uses the proper handling code to process the part. Parts are processed in order.