[PATCH 4 of 5 RFC] remove lock and addchangegroup from peer and restructure push
Sune Foldager
cryo at cyanite.org
Tue Jun 26 16:41:25 CDT 2012
# HG changeset patch
# User Sune Foldager <cryo at cyanite.org>
# Date 1314971476 -7200
# Node ID 7cbe7adbd271ec127e70e7ffb9cb062384ed0596
# Parent 415a68905295b371195d00c4c9921c1e56df3225
remove lock and addchangegroup from peer and restructure push
The lock/addchangegroup code path for local remotes assumed no support
for unbundle on localrepo/peer. This is now no longer the case.
diff -r 415a68905295 -r 7cbe7adbd271 mercurial/localrepo.py
--- a/mercurial/localrepo.py Fri Sep 02 15:34:32 2011 +0200
+++ b/mercurial/localrepo.py Fri Sep 02 15:51:16 2011 +0200
@@ -68,15 +68,6 @@
def getbundle(self, source, heads=None, common=None):
return self._repo.getbundle(source, heads=heads, common=common)
- # TODO We might want to move the next two calls into legacypeer and add
- # unbundle instead.
-
- def lock(self):
- return self._repo.lock()
-
- def addchangegroup(self, cg, source, url):
- return self._repo.addchangegroup(cg, source, url)
-
def pushkey(self, namespace, key, old, new):
return self._repo.pushkey(namespace, key, old, new)
@@ -1784,9 +1775,14 @@
try:
self.checkpush(force, revs)
lock = None
- unbundle = remote.capable('unbundle')
- if not unbundle:
- lock = remote.lock()
+ lockable = None
+ if remote.local():
+ lockable = remote.local()
+ elif not remote.capable('unbundle'):
+ # legacy ssh servers
+ lockable = remote
+ if lockable:
+ lock = lockable.lock()
try:
# discovery
fci = discovery.findcommonincoming
@@ -1817,7 +1813,7 @@
cg = self.getlocalbundle('push', outgoing)
# apply changegroup to remote
- if unbundle:
+ if not lockable:
# local repo finds heads on server, finds out what
# revs it must push. once revs transferred, if server
# finds it has different heads (someone else won
@@ -1830,7 +1826,7 @@
else:
# we return an integer indicating remote head count
# change
- ret = remote.addchangegroup(cg, 'push', self.url())
+ ret = lockable.addchangegroup(cg, 'push', self.url())
if ret:
# push succeed, synchonize target of the push
More information about the Mercurial-devel
mailing list