Show More
@@ -1223,46 +1223,34 b' class localrepository(repo.repository):' | |||
|
1223 | 1223 | # unbundle assumes local user cannot lock remote repo (new ssh |
|
1224 | 1224 | # servers, http servers). |
|
1225 | 1225 | |
|
1226 | if remote.capable('unbundle'): | |
|
1227 | return self.push_unbundle(remote, force, revs, newbranch) | |
|
1228 | return self.push_addchangegroup(remote, force, revs, newbranch) | |
|
1229 | ||
|
1230 | def push_addchangegroup(self, remote, force, revs, newbranch): | |
|
1231 | '''Push a changegroup by locking the remote and sending the | |
|
1232 | addchangegroup command to it. Used for local and old SSH repos. | |
|
1233 | Return an integer: see push(). | |
|
1234 | ''' | |
|
1235 | lock = remote.lock() | |
|
1226 | lock = None | |
|
1227 | unbundle = remote.capable('unbundle') | |
|
1228 | if not unbundle: | |
|
1229 | lock = remote.lock() | |
|
1236 | 1230 | try: |
|
1237 | 1231 | ret = discovery.prepush(self, remote, force, revs, newbranch) |
|
1238 |
if ret[0] is |
|
|
1239 | cg, remote_heads = ret | |
|
1232 | if ret[0] is None: | |
|
1233 | # and here we return 0 for "nothing to push" or 1 for | |
|
1234 | # "something to push but I refuse" | |
|
1235 | return ret[1] | |
|
1236 | ||
|
1237 | cg, remote_heads = ret | |
|
1238 | if unbundle: | |
|
1239 | # local repo finds heads on server, finds out what revs it must | |
|
1240 | # push. once revs transferred, if server finds it has | |
|
1241 | # different heads (someone else won commit/push race), server | |
|
1242 | # aborts. | |
|
1243 | if force: | |
|
1244 | remote_heads = ['force'] | |
|
1245 | # ssh: return remote's addchangegroup() | |
|
1246 | # http: return remote's addchangegroup() or 0 for error | |
|
1247 | return remote.unbundle(cg, remote_heads, 'push') | |
|
1248 | else: | |
|
1240 | 1249 | # we return an integer indicating remote head count change |
|
1241 | 1250 | return remote.addchangegroup(cg, 'push', self.url(), lock=lock) |
|
1242 | # and here we return 0 for "nothing to push" or 1 for | |
|
1243 | # "something to push but I refuse" | |
|
1244 | return ret[1] | |
|
1245 | 1251 | finally: |
|
1246 | lock.release() | |
|
1247 | ||
|
1248 | def push_unbundle(self, remote, force, revs, newbranch): | |
|
1249 | '''Push a changegroup by unbundling it on the remote. Used for new | |
|
1250 | SSH and HTTP repos. Return an integer: see push().''' | |
|
1251 | # local repo finds heads on server, finds out what revs it | |
|
1252 | # must push. once revs transferred, if server finds it has | |
|
1253 | # different heads (someone else won commit/push race), server | |
|
1254 | # aborts. | |
|
1255 | ||
|
1256 | ret = discovery.prepush(self, remote, force, revs, newbranch) | |
|
1257 | if ret[0] is not None: | |
|
1258 | cg, remote_heads = ret | |
|
1259 | if force: | |
|
1260 | remote_heads = ['force'] | |
|
1261 | # ssh: return remote's addchangegroup() | |
|
1262 | # http: return remote's addchangegroup() or 0 for error | |
|
1263 | return remote.unbundle(cg, remote_heads, 'push') | |
|
1264 | # as in push_addchangegroup() | |
|
1265 | return ret[1] | |
|
1252 | if lock is not None: | |
|
1253 | lock.release() | |
|
1266 | 1254 | |
|
1267 | 1255 | def changegroupinfo(self, nodes, source): |
|
1268 | 1256 | if self.ui.verbose or source == 'bundle': |
General Comments 0
You need to be logged in to leave comments.
Login now