Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 2612:ffb895f16925
add support for streaming clone.
existing clone code uses pull to get changes from remote repo. is very
slow, uses lots of memory and cpu.
new clone code has server write file data straight to client, client
writes file data straight to disk. memory and cpu used are very low,
clone is much faster over lan.
new client can still clone with pull, can still clone from older servers.
new server can still serve older clients.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Fri, 14 Jul 2006 11:17:22 -0700 |
parents | 6c5b1b5cc160 |
children | e6a41cbaa260 |
comparison
equal
deleted
inserted
replaced
2611:1b4eb1f92433 | 2612:ffb895f16925 |
---|---|
959 else: | 959 else: |
960 _rcpath.append(p) | 960 _rcpath.append(p) |
961 else: | 961 else: |
962 _rcpath = os_rcpath() | 962 _rcpath = os_rcpath() |
963 return _rcpath | 963 return _rcpath |
964 | |
965 def bytecount(nbytes): | |
966 '''return byte count formatted as readable string, with units''' | |
967 | |
968 units = ( | |
969 (100, 1<<30, _('%.0f GB')), | |
970 (10, 1<<30, _('%.1f GB')), | |
971 (1, 1<<30, _('%.2f GB')), | |
972 (100, 1<<20, _('%.0f MB')), | |
973 (10, 1<<20, _('%.1f MB')), | |
974 (1, 1<<20, _('%.2f MB')), | |
975 (100, 1<<10, _('%.0f KB')), | |
976 (10, 1<<10, _('%.1f KB')), | |
977 (1, 1<<10, _('%.2f KB')), | |
978 (1, 1, _('%.0f bytes')), | |
979 ) | |
980 | |
981 for multiplier, divisor, format in units: | |
982 if nbytes >= divisor * multiplier: | |
983 return format % (nbytes / float(divisor)) | |
984 return units[-1][2] % nbytes |