Mercurial > hg-stable
comparison mercurial/wireproto.py @ 12702:f747c085b789
wireproto: redirect the output earlier
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Mon, 11 Oct 2010 12:44:33 -0500 |
parents | cb9e1d1c34ea |
children | 40bb5853fc4b |
comparison
equal
deleted
inserted
replaced
12701:cb9e1d1c34ea | 12702:f747c085b789 |
---|---|
279 | 279 |
280 def check_heads(): | 280 def check_heads(): |
281 heads = repo.heads() | 281 heads = repo.heads() |
282 return their_heads == ['force'] or their_heads == heads | 282 return their_heads == ['force'] or their_heads == heads |
283 | 283 |
284 proto.redirect() | |
285 | |
284 # fail early if possible | 286 # fail early if possible |
285 if not check_heads(): | 287 if not check_heads(): |
286 return 'unsynced changes' | 288 return 'unsynced changes' |
287 | 289 |
288 # write bundle data to temporary file because it can be big | 290 # write bundle data to temporary file because it can be big |
289 fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-') | 291 fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-') |
290 fp = os.fdopen(fd, 'wb+') | 292 fp = os.fdopen(fd, 'wb+') |
291 r = 0 | 293 r = 0 |
292 proto.redirect() | |
293 try: | 294 try: |
294 proto.getfile(fp) | 295 proto.getfile(fp) |
295 lock = repo.lock() | 296 lock = repo.lock() |
296 try: | 297 try: |
297 if not check_heads(): | 298 if not check_heads(): |