Mercurial > hgrepos > Python > apps > py-cutils
comparison cutils/treesum.py @ 193:fb36e71f6ba8
Change: path indicators for symlinks: ./@ -> ./@/ and /./@ -> /./@/
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 16 Jan 2025 19:04:33 +0100 |
| parents | 1b8bc876146a |
| children | 48e2610978e5 |
comparison
equal
deleted
inserted
replaced
| 192:188de62caac6 | 193:fb36e71f6ba8 |
|---|---|
| 411 if self._size_only: | 411 if self._size_only: |
| 412 self._outfp.write( | 412 self._outfp.write( |
| 413 format_bsd_line( | 413 format_bsd_line( |
| 414 "SIZE", | 414 "SIZE", |
| 415 None, | 415 None, |
| 416 "./@", | 416 "./@/", |
| 417 False, | 417 False, |
| 418 0)) | 418 0)) |
| 419 else: | 419 else: |
| 420 self._outfp.write( | 420 self._outfp.write( |
| 421 format_bsd_line( | 421 format_bsd_line( |
| 422 self._algorithm[1], | 422 self._algorithm[1], |
| 423 dir_dgst.digest(), | 423 dir_dgst.digest(), |
| 424 "./@", | 424 "./@/", |
| 425 self._use_base64)) | 425 self._use_base64)) |
| 426 self._outfp.flush() | 426 self._outfp.flush() |
| 427 self._outfp.write(format_bsd_line( | 427 self._outfp.write(format_bsd_line( |
| 428 "CRC32", self._outfp.hexcrcdigest(), None, False)) | 428 "CRC32", self._outfp.hexcrcdigest(), None, False)) |
| 429 return | 429 return |
| 458 b"%d:%s,", | 458 b"%d:%s,", |
| 459 len(linkdgst.digest()), linkdgst.digest())) | 459 len(linkdgst.digest()), linkdgst.digest())) |
| 460 opath = "/".join(top) + "/" + fso.name if top else fso.name | 460 opath = "/".join(top) + "/" + fso.name if top else fso.name |
| 461 if self._size_only: | 461 if self._size_only: |
| 462 self._outfp.write(format_bsd_line( | 462 self._outfp.write(format_bsd_line( |
| 463 "SIZE", None, "%s/./@" % (opath,), False, 0)) | 463 "SIZE", None, "%s/./@/" % (opath,), False, 0)) |
| 464 else: | 464 else: |
| 465 self._outfp.write(format_bsd_line( | 465 self._outfp.write(format_bsd_line( |
| 466 self._algorithm[1], | 466 self._algorithm[1], |
| 467 linkdgst.digest(), | 467 linkdgst.digest(), |
| 468 "%s/./@" % (opath,), | 468 "%s/./@/" % (opath,), |
| 469 self._use_base64)) | 469 self._use_base64)) |
| 470 self._outfp.flush() | 470 self._outfp.flush() |
| 471 else: | 471 else: |
| 472 # | 472 # |
| 473 # Follow the symlink to dir or handle a "real" directory | 473 # Follow the symlink to dir or handle a "real" directory |
| 639 return util.interpolate_bytes(b"%s (%s)%s", what, filename, ls) | 639 return util.interpolate_bytes(b"%s (%s)%s", what, filename, ls) |
| 640 if use_base64: | 640 if use_base64: |
| 641 value = base64.b64encode(value) | 641 value = base64.b64encode(value) |
| 642 else: | 642 else: |
| 643 value = binascii.hexlify(value) | 643 value = binascii.hexlify(value) |
| 644 if filename != b"./@": | 644 if filename != b"./@/": |
| 645 filename = util.normalize_filename(filename, True) | 645 filename = util.normalize_filename(filename, True) |
| 646 if size is None: | 646 if size is None: |
| 647 return util.interpolate_bytes( | 647 return util.interpolate_bytes( |
| 648 b"%s (%s) = %s%s", what, filename, value, ls) | 648 b"%s (%s) = %s%s", what, filename, value, ls) |
| 649 else: | 649 else: |
| 883 # in_block = False | 883 # in_block = False |
| 884 else: | 884 else: |
| 885 if not in_block: | 885 if not in_block: |
| 886 continue | 886 continue |
| 887 # digest line or size line | 887 # digest line or size line |
| 888 if not record[1] or record[1] == b"./@": | 888 if not record[1] or record[1] == b"./@/": |
| 889 if record[0] == "SIZE": | 889 if record[0] == "SIZE": |
| 890 algorithm = "SIZE" | 890 algorithm = "SIZE" |
| 891 digest = None | 891 digest = None |
| 892 size = record[2] | 892 size = record[2] |
| 893 else: | 893 else: |
