Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 20969:7a679918ee2b
localrepo: add unbundle support
Localrepo now supports the unbundle method of pushing changegroups. We
plan to use the unbundle call for bundle2 so it is important that all
peers supports it. The `peer.unbundle` and `peer.addchangegroup` code
path have small difference so cause some test output changes. None of those
changes seems problematic.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 04 Apr 2014 17:50:44 -0700 |
parents | ffddabb8aa5d |
children | 37cdf1fca1b2 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Fri Apr 04 17:28:59 2014 -0700 +++ b/mercurial/localrepo.py Fri Apr 04 17:50:44 2014 -0700 @@ -63,7 +63,7 @@ return wrapper moderncaps = set(('lookup', 'branchmap', 'pushkey', 'known', 'getbundle', - 'bundle2')) + 'bundle2', 'unbundle')) legacycaps = moderncaps.union(set(['changegroupsubset'])) class localpeer(peer.peerrepository): @@ -112,6 +112,15 @@ # TODO We might want to move the next two calls into legacypeer and add # unbundle instead. + def unbundle(self, cg, heads, url): + """apply a bundle on a repo + + This function handles the repo locking itself.""" + try: + return exchange.unbundle(self._repo, cg, heads, 'push', url) + except exchange.PushRaced, exc: + raise error.ResponseError(_('push failed:'), exc.message) + def lock(self): return self._repo.lock()