##// END OF EJS Templates
exchange: drop support for lock-based unbundling (BC)...
Gregory Szorc -
r33667:fda0867c default
parent child Browse files
Show More
@@ -433,16 +433,13 b' def push(repo, remote, force=False, revs'
433 433 " %s") % (', '.join(sorted(missing)))
434 434 raise error.Abort(msg)
435 435
436 # there are two ways to push to remote repo:
437 #
438 # addchangegroup assumes local user can lock remote
439 # repo (local filesystem, old ssh servers).
440 #
441 # unbundle assumes local user cannot lock remote repo (new ssh
442 # servers, http servers).
443
444 436 if not pushop.remote.canpush():
445 437 raise error.Abort(_("destination does not support push"))
438
439 if not pushop.remote.capable('unbundle'):
440 raise error.Abort(_('cannot push: destination does not support the '
441 'unbundle wire protocol command'))
442
446 443 # get local lock as we might write phase data
447 444 localwlock = locallock = None
448 445 try:
@@ -468,21 +465,14 b' def push(repo, remote, force=False, revs'
468 465 'push-response',
469 466 pushop.remote.url())
470 467 pushop.repo.checkpush(pushop)
471 lock = None
472 unbundle = pushop.remote.capable('unbundle')
473 if not unbundle:
474 lock = pushop.remote.lock()
475 try:
476 _pushdiscovery(pushop)
477 if not _forcebundle1(pushop):
478 _pushbundle2(pushop)
479 _pushchangeset(pushop)
480 _pushsyncphase(pushop)
481 _pushobsolete(pushop)
482 _pushbookmark(pushop)
483 finally:
484 if lock is not None:
485 lock.release()
468 _pushdiscovery(pushop)
469 if not _forcebundle1(pushop):
470 _pushbundle2(pushop)
471 _pushchangeset(pushop)
472 _pushsyncphase(pushop)
473 _pushobsolete(pushop)
474 _pushbookmark(pushop)
475
486 476 if pushop.trmanager:
487 477 pushop.trmanager.close()
488 478 finally:
@@ -958,9 +948,12 b' def _pushchangeset(pushop):'
958 948 pushop.stepsdone.add('changesets')
959 949 if not _pushcheckoutgoing(pushop):
960 950 return
951
952 # Should have verified this in push().
953 assert pushop.remote.capable('unbundle')
954
961 955 pushop.repo.prepushoutgoinghooks(pushop)
962 956 outgoing = pushop.outgoing
963 unbundle = pushop.remote.capable('unbundle')
964 957 # TODO: get bundlecaps from remote
965 958 bundlecaps = None
966 959 # create a changegroup from local
@@ -979,24 +972,18 b' def _pushchangeset(pushop):'
979 972 bundlecaps=bundlecaps)
980 973
981 974 # apply changegroup to remote
982 if unbundle:
983 # local repo finds heads on server, finds out what
984 # revs it must push. once revs transferred, if server
985 # finds it has different heads (someone else won
986 # commit/push race), server aborts.
987 if pushop.force:
988 remoteheads = ['force']
989 else:
990 remoteheads = pushop.remoteheads
991 # ssh: return remote's addchangegroup()
992 # http: return remote's addchangegroup() or 0 for error
993 pushop.cgresult = pushop.remote.unbundle(cg, remoteheads,
994 pushop.repo.url())
975 # local repo finds heads on server, finds out what
976 # revs it must push. once revs transferred, if server
977 # finds it has different heads (someone else won
978 # commit/push race), server aborts.
979 if pushop.force:
980 remoteheads = ['force']
995 981 else:
996 # we return an integer indicating remote head count
997 # change
998 pushop.cgresult = pushop.remote.addchangegroup(cg, 'push',
999 pushop.repo.url())
982 remoteheads = pushop.remoteheads
983 # ssh: return remote's addchangegroup()
984 # http: return remote's addchangegroup() or 0 for error
985 pushop.cgresult = pushop.remote.unbundle(cg, remoteheads,
986 pushop.repo.url())
1000 987
1001 988 def _pushsyncphase(pushop):
1002 989 """synchronise phase information locally and remotely"""
@@ -132,9 +132,6 b' class httppeer(wireproto.wirepeer):'
132 132 (' '.join(self.caps or ['none'])))
133 133 return self.caps
134 134
135 def lock(self):
136 raise error.Abort(_('operation not supported over http'))
137
138 135 def _callstream(self, cmd, _compressible=False, **args):
139 136 if cmd == 'pushkey':
140 137 args['data'] = ''
@@ -237,9 +237,6 b' class localpeer(peer.peerrepository):'
237 237 except error.PushRaced as exc:
238 238 raise error.ResponseError(_('push failed:'), str(exc))
239 239
240 def lock(self):
241 return self._repo.lock()
242
243 240 def pushkey(self, namespace, key, old, new):
244 241 return self._repo.pushkey(namespace, key, old, new)
245 242
@@ -17,21 +17,6 b' from . import ('
17 17 wireproto,
18 18 )
19 19
20 class remotelock(object):
21 def __init__(self, repo):
22 self.repo = repo
23 def release(self):
24 self.repo.unlock()
25 self.repo = None
26 def __enter__(self):
27 return self
28 def __exit__(self, exc_type, exc_val, exc_tb):
29 if self.repo:
30 self.release()
31 def __del__(self):
32 if self.repo:
33 self.release()
34
35 20 def _serverquote(s):
36 21 if not s:
37 22 return s
@@ -337,33 +322,4 b' class sshpeer(wireproto.wirepeer):'
337 322 self.pipeo.flush()
338 323 self.readerr()
339 324
340 def lock(self):
341 self._call("lock")
342 return remotelock(self)
343
344 def unlock(self):
345 self._call("unlock")
346
347 def addchangegroup(self, cg, source, url, lock=None):
348 '''Send a changegroup to the remote server. Return an integer
349 similar to unbundle(). DEPRECATED, since it requires locking the
350 remote.'''
351 d = self._call("addchangegroup")
352 if d:
353 self._abort(error.RepoError(_("push refused: %s") % d))
354 for d in iter(lambda: cg.read(4096), ''):
355 self.pipeo.write(d)
356 self.readerr()
357
358 self.pipeo.flush()
359
360 self.readerr()
361 r = self._recv()
362 if not r:
363 return 1
364 try:
365 return int(r)
366 except ValueError:
367 self._abort(error.ResponseError(_("unexpected response:"), r))
368
369 325 instance = sshpeer
General Comments 0
You need to be logged in to leave comments. Login now