547 c | Bin |
547 c | Bin |
548 d | 1 + |
548 d | 1 + |
549 4 files changed, 2 insertions(+), 0 deletions(-) |
549 4 files changed, 2 insertions(+), 0 deletions(-) |
550 $ hg commit -m binarytest |
550 $ hg commit -m binarytest |
551 $ cat > $TESTTMP/dumpbinary.py << EOF |
551 $ cat > $TESTTMP/dumpbinary.py << EOF |
|
552 > from mercurial.utils import ( |
|
553 > stringutil, |
|
554 > ) |
552 > def reposetup(ui, repo): |
555 > def reposetup(ui, repo): |
553 > for n in 'abcd': |
556 > for n in (b'a', b'b', b'c', b'd'): |
554 > ui.write(('%s: binary=%s\n') % (n, repo['.'][n].isbinary())) |
557 > ui.write((b'%s: binary=%s\n') |
|
558 > % (n, stringutil.pprint(repo[b'.'][n].isbinary()))) |
555 > EOF |
559 > EOF |
556 $ hg --config extensions.dumpbinary=$TESTTMP/dumpbinary.py id --trace |
560 $ hg --config extensions.dumpbinary=$TESTTMP/dumpbinary.py id --trace |
557 a: binary=True |
561 a: binary=True |
558 b: binary=False |
562 b: binary=False |
559 c: binary=True |
563 c: binary=True |
677 |
681 |
678 $ cat > $TESTTMP/dumpflog.py << EOF |
682 $ cat > $TESTTMP/dumpflog.py << EOF |
679 > # print raw revision sizes, flags, and hashes for certain files |
683 > # print raw revision sizes, flags, and hashes for certain files |
680 > import hashlib |
684 > import hashlib |
681 > from mercurial.node import short |
685 > from mercurial.node import short |
682 > from mercurial import revlog |
686 > from mercurial import ( |
|
687 > pycompat, |
|
688 > revlog, |
|
689 > ) |
|
690 > from mercurial.utils import ( |
|
691 > stringutil, |
|
692 > ) |
683 > def hash(rawtext): |
693 > def hash(rawtext): |
684 > h = hashlib.sha512() |
694 > h = hashlib.sha512() |
685 > h.update(rawtext) |
695 > h.update(rawtext) |
686 > return h.hexdigest()[:4] |
696 > return pycompat.sysbytes(h.hexdigest()[:4]) |
687 > def reposetup(ui, repo): |
697 > def reposetup(ui, repo): |
688 > # these 2 files are interesting |
698 > # these 2 files are interesting |
689 > for name in ['l', 's']: |
699 > for name in [b'l', b's']: |
690 > fl = repo.file(name) |
700 > fl = repo.file(name) |
691 > if len(fl) == 0: |
701 > if len(fl) == 0: |
692 > continue |
702 > continue |
693 > sizes = [fl._revlog.rawsize(i) for i in fl] |
703 > sizes = [fl._revlog.rawsize(i) for i in fl] |
694 > texts = [fl.revision(i, raw=True) for i in fl] |
704 > texts = [fl.revision(i, raw=True) for i in fl] |
695 > flags = [int(fl._revlog.flags(i)) for i in fl] |
705 > flags = [int(fl._revlog.flags(i)) for i in fl] |
696 > hashes = [hash(t) for t in texts] |
706 > hashes = [hash(t) for t in texts] |
697 > print(' %s: rawsizes=%r flags=%r hashes=%r' |
707 > pycompat.stdout.write(b' %s: rawsizes=%r flags=%r hashes=%s\n' |
698 > % (name, sizes, flags, hashes)) |
708 > % (name, sizes, flags, stringutil.pprint(hashes))) |
699 > EOF |
709 > EOF |
700 |
710 |
701 $ for i in client client2 server repo3 repo4 repo5 repo6 repo7 repo8 repo9 \ |
711 $ for i in client client2 server repo3 repo4 repo5 repo6 repo7 repo8 repo9 \ |
702 > repo10; do |
712 > repo10; do |
703 > echo 'repo:' $i |
713 > echo 'repo:' $i |