Mercurial > hg
annotate contrib/dumprevlog @ 33449:5747967e257c
phase: put retractboundary out of the loop in advanceboundary
It seems that we were calling retractboundary for each phases to process.
Putting the retractboundary out of the loop reduce the number of calls,
helping tracking the phases changes.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 10 Jul 2017 22:22:42 +0200 |
parents | 6359b80f15fb |
children | a915465a731e |
rev | line source |
---|---|
6433
ec5d77eb3431
add simple dump and undump scripts to contrib/
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
ec5d77eb3431
add simple dump and undump scripts to contrib/
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
2 # Dump revlogs as raw data stream |
ec5d77eb3431
add simple dump and undump scripts to contrib/
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
3 # $ find .hg/store/ -name "*.i" | xargs dumprevlog > repo.dump |
ec5d77eb3431
add simple dump and undump scripts to contrib/
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
4 |
29166
6359b80f15fb
py3: make contrib/dumprevlog use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29165
diff
changeset
|
5 from __future__ import absolute_import, print_function |
29165
a212ca70205c
py3: make contrib/dumprevlog use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
14233
diff
changeset
|
6 |
6433
ec5d77eb3431
add simple dump and undump scripts to contrib/
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
7 import sys |
29165
a212ca70205c
py3: make contrib/dumprevlog use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
14233
diff
changeset
|
8 from mercurial import ( |
a212ca70205c
py3: make contrib/dumprevlog use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
14233
diff
changeset
|
9 node, |
a212ca70205c
py3: make contrib/dumprevlog use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
14233
diff
changeset
|
10 revlog, |
a212ca70205c
py3: make contrib/dumprevlog use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
14233
diff
changeset
|
11 util, |
a212ca70205c
py3: make contrib/dumprevlog use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
14233
diff
changeset
|
12 ) |
6466
9c426da6b03b
contrib: fix binary file issues with dumprevlog on Windows
Adrian Buehlmann <adrian@cadifra.com>
parents:
6433
diff
changeset
|
13 |
9c426da6b03b
contrib: fix binary file issues with dumprevlog on Windows
Adrian Buehlmann <adrian@cadifra.com>
parents:
6433
diff
changeset
|
14 for fp in (sys.stdin, sys.stdout, sys.stderr): |
14233
659f34b833b9
rename util.set_binary to setbinary
Adrian Buehlmann <adrian@cadifra.com>
parents:
7361
diff
changeset
|
15 util.setbinary(fp) |
6433
ec5d77eb3431
add simple dump and undump scripts to contrib/
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
16 |
ec5d77eb3431
add simple dump and undump scripts to contrib/
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
17 for f in sys.argv[1:]: |
6466
9c426da6b03b
contrib: fix binary file issues with dumprevlog on Windows
Adrian Buehlmann <adrian@cadifra.com>
parents:
6433
diff
changeset
|
18 binopen = lambda fn: open(fn, 'rb') |
9c426da6b03b
contrib: fix binary file issues with dumprevlog on Windows
Adrian Buehlmann <adrian@cadifra.com>
parents:
6433
diff
changeset
|
19 r = revlog.revlog(binopen, f) |
29166
6359b80f15fb
py3: make contrib/dumprevlog use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29165
diff
changeset
|
20 print("file:", f) |
6750
fb42030d79d6
add __len__ and __iter__ methods to repo and revlog
Matt Mackall <mpm@selenic.com>
parents:
6466
diff
changeset
|
21 for i in r: |
6433
ec5d77eb3431
add simple dump and undump scripts to contrib/
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
22 n = r.node(i) |
ec5d77eb3431
add simple dump and undump scripts to contrib/
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
23 p = r.parents(n) |
ec5d77eb3431
add simple dump and undump scripts to contrib/
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
24 d = r.revision(n) |
29166
6359b80f15fb
py3: make contrib/dumprevlog use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29165
diff
changeset
|
25 print("node:", node.hex(n)) |
6359b80f15fb
py3: make contrib/dumprevlog use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29165
diff
changeset
|
26 print("linkrev:", r.linkrev(i)) |
6359b80f15fb
py3: make contrib/dumprevlog use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29165
diff
changeset
|
27 print("parents:", node.hex(p[0]), node.hex(p[1])) |
6359b80f15fb
py3: make contrib/dumprevlog use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29165
diff
changeset
|
28 print("length:", len(d)) |
6359b80f15fb
py3: make contrib/dumprevlog use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29165
diff
changeset
|
29 print("-start-") |
6359b80f15fb
py3: make contrib/dumprevlog use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29165
diff
changeset
|
30 print(d) |
6359b80f15fb
py3: make contrib/dumprevlog use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29165
diff
changeset
|
31 print("-end-") |