mercurial/localrepo.py
changeset 20969 7a679918ee2b
parent 20963 ffddabb8aa5d
child 20975 37cdf1fca1b2
--- 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()