##// END OF EJS Templates
remotefilelog: rely on progress helper for keeping track of position...
Martin von Zweigbergk -
r40886:74e3df76 default
parent child Browse files
Show More
@@ -334,7 +334,6 b' class fileserverclient(object):'
334 progress.update(0)
334 progress.update(0)
335
335
336 missed = []
336 missed = []
337 count = 0
338 while True:
337 while True:
339 missingid = cache.receiveline()
338 missingid = cache.receiveline()
340 if not missingid:
339 if not missingid:
@@ -350,8 +349,7 b' class fileserverclient(object):'
350 if missingid.startswith("_hits_"):
349 if missingid.startswith("_hits_"):
351 # receive progress reports
350 # receive progress reports
352 parts = missingid.split("_")
351 parts = missingid.split("_")
353 count += int(parts[2])
352 progress.increment(int(parts[2]))
354 progress.update(count)
355 continue
353 continue
356
354
357 missed.append(missingid)
355 missed.append(missingid)
@@ -360,7 +358,6 b' class fileserverclient(object):'
360 fetchmisses += len(missed)
358 fetchmisses += len(missed)
361
359
362 fromcache = total - len(missed)
360 fromcache = total - len(missed)
363 count = [fromcache]
364 progress.update(fromcache, total=total)
361 progress.update(fromcache, total=total)
365 self.ui.log("remotefilelog", "remote cache hit rate is %r of %r\n",
362 self.ui.log("remotefilelog", "remote cache hit rate is %r of %r\n",
366 fromcache, total, hit=fromcache, total=total)
363 fromcache, total, hit=fromcache, total=total)
@@ -369,9 +366,6 b' class fileserverclient(object):'
369 try:
366 try:
370 # receive cache misses from master
367 # receive cache misses from master
371 if missed:
368 if missed:
372 def progresstick():
373 count[0] += 1
374 progress.update(count[0])
375 # When verbose is true, sshpeer prints 'running ssh...'
369 # When verbose is true, sshpeer prints 'running ssh...'
376 # to stdout, which can interfere with some command
370 # to stdout, which can interfere with some command
377 # outputs
371 # outputs
@@ -393,8 +387,8 b' class fileserverclient(object):'
393 _getfiles = _getfiles_threaded
387 _getfiles = _getfiles_threaded
394 else:
388 else:
395 _getfiles = _getfiles_optimistic
389 _getfiles = _getfiles_optimistic
396 _getfiles(remote, self.receivemissing, progresstick,
390 _getfiles(remote, self.receivemissing,
397 missed, idmap, step)
391 progress.increment, missed, idmap, step)
398 elif remote.capable("x_rfl_getfile"):
392 elif remote.capable("x_rfl_getfile"):
399 if remote.capable('batch'):
393 if remote.capable('batch'):
400 batchdefault = 100
394 batchdefault = 100
@@ -403,7 +397,7 b' class fileserverclient(object):'
403 batchsize = self.ui.configint(
397 batchsize = self.ui.configint(
404 'remotefilelog', 'batchsize', batchdefault)
398 'remotefilelog', 'batchsize', batchdefault)
405 _getfilesbatch(
399 _getfilesbatch(
406 remote, self.receivemissing, progresstick,
400 remote, self.receivemissing, progress.increment,
407 missed, idmap, batchsize)
401 missed, idmap, batchsize)
408 else:
402 else:
409 raise error.Abort("configured remotefilelog server"
403 raise error.Abort("configured remotefilelog server"
@@ -411,12 +405,12 b' class fileserverclient(object):'
411
405
412 self.ui.log("remotefilefetchlog",
406 self.ui.log("remotefilefetchlog",
413 "Success\n",
407 "Success\n",
414 fetched_files = count[0] - fromcache,
408 fetched_files = progress.pos - fromcache,
415 total_to_fetch = total - fromcache)
409 total_to_fetch = total - fromcache)
416 except Exception:
410 except Exception:
417 self.ui.log("remotefilefetchlog",
411 self.ui.log("remotefilefetchlog",
418 "Fail\n",
412 "Fail\n",
419 fetched_files = count[0] - fromcache,
413 fetched_files = progress.pos - fromcache,
420 total_to_fetch = total - fromcache)
414 total_to_fetch = total - fromcache)
421 raise
415 raise
422 finally:
416 finally:
General Comments 0
You need to be logged in to leave comments. Login now