##// END OF EJS Templates
py3: byteify contrib/dumprevlog
Matt Harbison -
r39983:a063b84c default
parent child Browse files
Show More
@@ -1,37 +1,43
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # Dump revlogs as raw data stream
2 # Dump revlogs as raw data stream
3 # $ find .hg/store/ -name "*.i" | xargs dumprevlog > repo.dump
3 # $ find .hg/store/ -name "*.i" | xargs dumprevlog > repo.dump
4
4
5 from __future__ import absolute_import, print_function
5 from __future__ import absolute_import, print_function
6
6
7 import sys
7 import sys
8 from mercurial import (
8 from mercurial import (
9 encoding,
9 node,
10 node,
11 pycompat,
10 revlog,
12 revlog,
11 )
13 )
12 from mercurial.utils import (
14 from mercurial.utils import (
13 procutil,
15 procutil,
14 )
16 )
15
17
16 for fp in (sys.stdin, sys.stdout, sys.stderr):
18 for fp in (sys.stdin, sys.stdout, sys.stderr):
17 procutil.setbinary(fp)
19 procutil.setbinary(fp)
18
20
19 def binopen(path, mode='rb'):
21 def binopen(path, mode=b'rb'):
20 if 'b' not in mode:
22 if b'b' not in mode:
21 mode = mode + 'b'
23 mode = mode + b'b'
22 return open(path, mode)
24 return open(path, pycompat.sysstr(mode))
25
26 def printb(data, end=b'\n'):
27 sys.stdout.flush()
28 pycompat.stdout.write(data + end)
23
29
24 for f in sys.argv[1:]:
30 for f in sys.argv[1:]:
25 r = revlog.revlog(binopen, f)
31 r = revlog.revlog(binopen, encoding.strtolocal(f))
26 print("file:", f)
32 print("file:", f)
27 for i in r:
33 for i in r:
28 n = r.node(i)
34 n = r.node(i)
29 p = r.parents(n)
35 p = r.parents(n)
30 d = r.revision(n)
36 d = r.revision(n)
31 print("node:", node.hex(n))
37 printb(b"node: %s" % node.hex(n))
32 print("linkrev:", r.linkrev(i))
38 printb(b"linkrev: %d" % r.linkrev(i))
33 print("parents:", node.hex(p[0]), node.hex(p[1]))
39 printb(b"parents: %s %s" % (node.hex(p[0]), node.hex(p[1])))
34 print("length:", len(d))
40 printb(b"length: %d" % len(d))
35 print("-start-")
41 printb(b"-start-")
36 print(d)
42 printb(d)
37 print("-end-")
43 printb(b"-end-")
@@ -1,578 +1,579
1 test-abort-checkin.t
1 test-abort-checkin.t
2 test-absorb-filefixupstate.py
2 test-absorb-filefixupstate.py
3 test-absorb-phase.t
3 test-absorb-phase.t
4 test-absorb-rename.t
4 test-absorb-rename.t
5 test-absorb-strip.t
5 test-absorb-strip.t
6 test-absorb.t
6 test-absorb.t
7 test-add.t
7 test-add.t
8 test-addremove-similar.t
8 test-addremove-similar.t
9 test-addremove.t
9 test-addremove.t
10 test-alias.t
10 test-alias.t
11 test-amend-subrepo.t
11 test-amend-subrepo.t
12 test-amend.t
12 test-amend.t
13 test-ancestor.py
13 test-ancestor.py
14 test-annotate.py
14 test-annotate.py
15 test-annotate.t
15 test-annotate.t
16 test-archive-symlinks.t
16 test-archive-symlinks.t
17 test-atomictempfile.py
17 test-atomictempfile.py
18 test-audit-path.t
18 test-audit-path.t
19 test-audit-subrepo.t
19 test-audit-subrepo.t
20 test-automv.t
20 test-automv.t
21 test-backout.t
21 test-backout.t
22 test-backwards-remove.t
22 test-backwards-remove.t
23 test-bad-pull.t
23 test-bad-pull.t
24 test-basic.t
24 test-basic.t
25 test-bdiff.py
25 test-bdiff.py
26 test-bheads.t
26 test-bheads.t
27 test-bisect.t
27 test-bisect.t
28 test-bisect2.t
28 test-bisect2.t
29 test-bisect3.t
29 test-bisect3.t
30 test-blackbox.t
30 test-blackbox.t
31 test-bookmarks-current.t
31 test-bookmarks-current.t
32 test-bookmarks-merge.t
32 test-bookmarks-merge.t
33 test-bookmarks-pushpull.t
33 test-bookmarks-pushpull.t
34 test-bookmarks-rebase.t
34 test-bookmarks-rebase.t
35 test-bookmarks-strip.t
35 test-bookmarks-strip.t
36 test-bookmarks.t
36 test-bookmarks.t
37 test-branch-change.t
37 test-branch-change.t
38 test-branch-option.t
38 test-branch-option.t
39 test-branch-tag-confict.t
39 test-branch-tag-confict.t
40 test-branches.t
40 test-branches.t
41 test-bundle-phases.t
41 test-bundle-phases.t
42 test-bundle-r.t
42 test-bundle-r.t
43 test-bundle-type.t
43 test-bundle-type.t
44 test-bundle-vs-outgoing.t
44 test-bundle-vs-outgoing.t
45 test-bundle.t
45 test-bundle.t
46 test-bundle2-exchange.t
46 test-bundle2-exchange.t
47 test-bundle2-format.t
47 test-bundle2-format.t
48 test-bundle2-multiple-changegroups.t
48 test-bundle2-multiple-changegroups.t
49 test-bundle2-pushback.t
49 test-bundle2-pushback.t
50 test-bundle2-remote-changegroup.t
50 test-bundle2-remote-changegroup.t
51 test-cappedreader.py
51 test-cappedreader.py
52 test-casecollision.t
52 test-casecollision.t
53 test-cat.t
53 test-cat.t
54 test-cbor.py
54 test-cbor.py
55 test-censor.t
55 test-censor.t
56 test-changelog-exec.t
56 test-changelog-exec.t
57 test-check-code.t
57 test-check-code.t
58 test-check-commit.t
58 test-check-commit.t
59 test-check-execute.t
59 test-check-execute.t
60 test-check-interfaces.py
60 test-check-interfaces.py
61 test-check-module-imports.t
61 test-check-module-imports.t
62 test-check-py3-compat.t
62 test-check-py3-compat.t
63 test-check-pyflakes.t
63 test-check-pyflakes.t
64 test-check-pylint.t
64 test-check-pylint.t
65 test-check-shbang.t
65 test-check-shbang.t
66 test-children.t
66 test-children.t
67 test-clone-cgi.t
67 test-clone-cgi.t
68 test-clone-pull-corruption.t
68 test-clone-pull-corruption.t
69 test-clone-r.t
69 test-clone-r.t
70 test-clone-uncompressed.t
70 test-clone-uncompressed.t
71 test-clone-update-order.t
71 test-clone-update-order.t
72 test-clonebundles.t
72 test-clonebundles.t
73 test-commit-amend.t
73 test-commit-amend.t
74 test-commit-interactive.t
74 test-commit-interactive.t
75 test-commit-multiple.t
75 test-commit-multiple.t
76 test-commit-unresolved.t
76 test-commit-unresolved.t
77 test-commit.t
77 test-commit.t
78 test-committer.t
78 test-committer.t
79 test-completion.t
79 test-completion.t
80 test-config-env.py
80 test-config-env.py
81 test-config.t
81 test-config.t
82 test-conflict.t
82 test-conflict.t
83 test-confused-revert.t
83 test-confused-revert.t
84 test-context.py
84 test-context.py
85 test-contrib-check-code.t
85 test-contrib-check-code.t
86 test-contrib-check-commit.t
86 test-contrib-check-commit.t
87 test-convert-authormap.t
87 test-convert-authormap.t
88 test-convert-clonebranches.t
88 test-convert-clonebranches.t
89 test-convert-cvs-branch.t
89 test-convert-cvs-branch.t
90 test-convert-cvs-detectmerge.t
90 test-convert-cvs-detectmerge.t
91 test-convert-cvs-synthetic.t
91 test-convert-cvs-synthetic.t
92 test-convert-cvs.t
92 test-convert-cvs.t
93 test-convert-cvsnt-mergepoints.t
93 test-convert-cvsnt-mergepoints.t
94 test-convert-datesort.t
94 test-convert-datesort.t
95 test-contrib-dumprevlog.t
95 test-convert-filemap.t
96 test-convert-filemap.t
96 test-convert-hg-sink.t
97 test-convert-hg-sink.t
97 test-convert-hg-source.t
98 test-convert-hg-source.t
98 test-convert-hg-startrev.t
99 test-convert-hg-startrev.t
99 test-convert-splicemap.t
100 test-convert-splicemap.t
100 test-convert-tagsbranch-topology.t
101 test-convert-tagsbranch-topology.t
101 test-copy-move-merge.t
102 test-copy-move-merge.t
102 test-copy.t
103 test-copy.t
103 test-copytrace-heuristics.t
104 test-copytrace-heuristics.t
104 test-debugbuilddag.t
105 test-debugbuilddag.t
105 test-debugbundle.t
106 test-debugbundle.t
106 test-debugcommands.t
107 test-debugcommands.t
107 test-debugextensions.t
108 test-debugextensions.t
108 test-debugindexdot.t
109 test-debugindexdot.t
109 test-debugrename.t
110 test-debugrename.t
110 test-default-push.t
111 test-default-push.t
111 test-diff-antipatience.t
112 test-diff-antipatience.t
112 test-diff-binary-file.t
113 test-diff-binary-file.t
113 test-diff-change.t
114 test-diff-change.t
114 test-diff-copy-depth.t
115 test-diff-copy-depth.t
115 test-diff-hashes.t
116 test-diff-hashes.t
116 test-diff-ignore-whitespace.t
117 test-diff-ignore-whitespace.t
117 test-diff-indent-heuristic.t
118 test-diff-indent-heuristic.t
118 test-diff-issue2761.t
119 test-diff-issue2761.t
119 test-diff-newlines.t
120 test-diff-newlines.t
120 test-diff-reverse.t
121 test-diff-reverse.t
121 test-diff-subdir.t
122 test-diff-subdir.t
122 test-diff-unified.t
123 test-diff-unified.t
123 test-diff-upgrade.t
124 test-diff-upgrade.t
124 test-diffdir.t
125 test-diffdir.t
125 test-diffstat.t
126 test-diffstat.t
126 test-directaccess.t
127 test-directaccess.t
127 test-dirstate-backup.t
128 test-dirstate-backup.t
128 test-dirstate-nonnormalset.t
129 test-dirstate-nonnormalset.t
129 test-dirstate.t
130 test-dirstate.t
130 test-dispatch.py
131 test-dispatch.py
131 test-doctest.py
132 test-doctest.py
132 test-double-merge.t
133 test-double-merge.t
133 test-drawdag.t
134 test-drawdag.t
134 test-duplicateoptions.py
135 test-duplicateoptions.py
135 test-editor-filename.t
136 test-editor-filename.t
136 test-empty-dir.t
137 test-empty-dir.t
137 test-empty-file.t
138 test-empty-file.t
138 test-empty-group.t
139 test-empty-group.t
139 test-empty.t
140 test-empty.t
140 test-encode.t
141 test-encode.t
141 test-encoding-func.py
142 test-encoding-func.py
142 test-encoding.t
143 test-encoding.t
143 test-eol-add.t
144 test-eol-add.t
144 test-eol-clone.t
145 test-eol-clone.t
145 test-eol-hook.t
146 test-eol-hook.t
146 test-eol-patch.t
147 test-eol-patch.t
147 test-eol-tag.t
148 test-eol-tag.t
148 test-eol-update.t
149 test-eol-update.t
149 test-eol.t
150 test-eol.t
150 test-eolfilename.t
151 test-eolfilename.t
151 test-excessive-merge.t
152 test-excessive-merge.t
152 test-exchange-obsmarkers-case-A1.t
153 test-exchange-obsmarkers-case-A1.t
153 test-exchange-obsmarkers-case-A2.t
154 test-exchange-obsmarkers-case-A2.t
154 test-exchange-obsmarkers-case-A3.t
155 test-exchange-obsmarkers-case-A3.t
155 test-exchange-obsmarkers-case-A4.t
156 test-exchange-obsmarkers-case-A4.t
156 test-exchange-obsmarkers-case-A5.t
157 test-exchange-obsmarkers-case-A5.t
157 test-exchange-obsmarkers-case-A6.t
158 test-exchange-obsmarkers-case-A6.t
158 test-exchange-obsmarkers-case-A7.t
159 test-exchange-obsmarkers-case-A7.t
159 test-exchange-obsmarkers-case-B1.t
160 test-exchange-obsmarkers-case-B1.t
160 test-exchange-obsmarkers-case-B2.t
161 test-exchange-obsmarkers-case-B2.t
161 test-exchange-obsmarkers-case-B3.t
162 test-exchange-obsmarkers-case-B3.t
162 test-exchange-obsmarkers-case-B4.t
163 test-exchange-obsmarkers-case-B4.t
163 test-exchange-obsmarkers-case-B5.t
164 test-exchange-obsmarkers-case-B5.t
164 test-exchange-obsmarkers-case-B6.t
165 test-exchange-obsmarkers-case-B6.t
165 test-exchange-obsmarkers-case-B7.t
166 test-exchange-obsmarkers-case-B7.t
166 test-exchange-obsmarkers-case-C1.t
167 test-exchange-obsmarkers-case-C1.t
167 test-exchange-obsmarkers-case-C2.t
168 test-exchange-obsmarkers-case-C2.t
168 test-exchange-obsmarkers-case-C3.t
169 test-exchange-obsmarkers-case-C3.t
169 test-exchange-obsmarkers-case-C4.t
170 test-exchange-obsmarkers-case-C4.t
170 test-exchange-obsmarkers-case-D1.t
171 test-exchange-obsmarkers-case-D1.t
171 test-exchange-obsmarkers-case-D2.t
172 test-exchange-obsmarkers-case-D2.t
172 test-exchange-obsmarkers-case-D3.t
173 test-exchange-obsmarkers-case-D3.t
173 test-exchange-obsmarkers-case-D4.t
174 test-exchange-obsmarkers-case-D4.t
174 test-execute-bit.t
175 test-execute-bit.t
175 test-export.t
176 test-export.t
176 test-extdata.t
177 test-extdata.t
177 test-extdiff.t
178 test-extdiff.t
178 test-extensions-afterloaded.t
179 test-extensions-afterloaded.t
179 test-extensions-wrapfunction.py
180 test-extensions-wrapfunction.py
180 test-extra-filelog-entry.t
181 test-extra-filelog-entry.t
181 test-fetch.t
182 test-fetch.t
182 test-filebranch.t
183 test-filebranch.t
183 test-filecache.py
184 test-filecache.py
184 test-filelog.py
185 test-filelog.py
185 test-fileset-generated.t
186 test-fileset-generated.t
186 test-fileset.t
187 test-fileset.t
187 test-fix-topology.t
188 test-fix-topology.t
188 test-flags.t
189 test-flags.t
189 test-generaldelta.t
190 test-generaldelta.t
190 test-getbundle.t
191 test-getbundle.t
191 test-git-export.t
192 test-git-export.t
192 test-glog-beautifygraph.t
193 test-glog-beautifygraph.t
193 test-glog-topological.t
194 test-glog-topological.t
194 test-glog.t
195 test-glog.t
195 test-gpg.t
196 test-gpg.t
196 test-graft.t
197 test-graft.t
197 test-grep.t
198 test-grep.t
198 test-hg-parseurl.py
199 test-hg-parseurl.py
199 test-hghave.t
200 test-hghave.t
200 test-hgignore.t
201 test-hgignore.t
201 test-hgk.t
202 test-hgk.t
202 test-hgrc.t
203 test-hgrc.t
203 test-hgweb-bundle.t
204 test-hgweb-bundle.t
204 test-hgweb-descend-empties.t
205 test-hgweb-descend-empties.t
205 test-hgweb-empty.t
206 test-hgweb-empty.t
206 test-hgweb-non-interactive.t
207 test-hgweb-non-interactive.t
207 test-hgweb-removed.t
208 test-hgweb-removed.t
208 test-hgwebdir-paths.py
209 test-hgwebdir-paths.py
209 test-hgwebdirsym.t
210 test-hgwebdirsym.t
210 test-histedit-arguments.t
211 test-histedit-arguments.t
211 test-histedit-base.t
212 test-histedit-base.t
212 test-histedit-bookmark-motion.t
213 test-histedit-bookmark-motion.t
213 test-histedit-commute.t
214 test-histedit-commute.t
214 test-histedit-drop.t
215 test-histedit-drop.t
215 test-histedit-edit.t
216 test-histedit-edit.t
216 test-histedit-fold-non-commute.t
217 test-histedit-fold-non-commute.t
217 test-histedit-fold.t
218 test-histedit-fold.t
218 test-histedit-no-backup.t
219 test-histedit-no-backup.t
219 test-histedit-no-change.t
220 test-histedit-no-change.t
220 test-histedit-non-commute-abort.t
221 test-histedit-non-commute-abort.t
221 test-histedit-non-commute.t
222 test-histedit-non-commute.t
222 test-histedit-obsolete.t
223 test-histedit-obsolete.t
223 test-histedit-outgoing.t
224 test-histedit-outgoing.t
224 test-histedit-templates.t
225 test-histedit-templates.t
225 test-http-branchmap.t
226 test-http-branchmap.t
226 test-http-bundle1.t
227 test-http-bundle1.t
227 test-http-clone-r.t
228 test-http-clone-r.t
228 test-http-permissions.t
229 test-http-permissions.t
229 test-http.t
230 test-http.t
230 test-hybridencode.py
231 test-hybridencode.py
231 test-identify.t
232 test-identify.t
232 test-impexp-branch.t
233 test-impexp-branch.t
233 test-import-bypass.t
234 test-import-bypass.t
234 test-import-eol.t
235 test-import-eol.t
235 test-import-merge.t
236 test-import-merge.t
236 test-import-unknown.t
237 test-import-unknown.t
237 test-import.t
238 test-import.t
238 test-imports-checker.t
239 test-imports-checker.t
239 test-incoming-outgoing.t
240 test-incoming-outgoing.t
240 test-inherit-mode.t
241 test-inherit-mode.t
241 test-init.t
242 test-init.t
242 test-issue1089.t
243 test-issue1089.t
243 test-issue1102.t
244 test-issue1102.t
244 test-issue1175.t
245 test-issue1175.t
245 test-issue1306.t
246 test-issue1306.t
246 test-issue1438.t
247 test-issue1438.t
247 test-issue1502.t
248 test-issue1502.t
248 test-issue1802.t
249 test-issue1802.t
249 test-issue1877.t
250 test-issue1877.t
250 test-issue1993.t
251 test-issue1993.t
251 test-issue2137.t
252 test-issue2137.t
252 test-issue3084.t
253 test-issue3084.t
253 test-issue4074.t
254 test-issue4074.t
254 test-issue522.t
255 test-issue522.t
255 test-issue586.t
256 test-issue586.t
256 test-issue5979.t
257 test-issue5979.t
257 test-issue612.t
258 test-issue612.t
258 test-issue619.t
259 test-issue619.t
259 test-issue660.t
260 test-issue660.t
260 test-issue672.t
261 test-issue672.t
261 test-issue842.t
262 test-issue842.t
262 test-journal-exists.t
263 test-journal-exists.t
263 test-journal-share.t
264 test-journal-share.t
264 test-journal.t
265 test-journal.t
265 test-known.t
266 test-known.t
266 test-largefiles-cache.t
267 test-largefiles-cache.t
267 test-largefiles-misc.t
268 test-largefiles-misc.t
268 test-largefiles-small-disk.t
269 test-largefiles-small-disk.t
269 test-largefiles-update.t
270 test-largefiles-update.t
270 test-largefiles.t
271 test-largefiles.t
271 test-lfs-largefiles.t
272 test-lfs-largefiles.t
272 test-lfs-pointer.py
273 test-lfs-pointer.py
273 test-linelog.py
274 test-linelog.py
274 test-linerange.py
275 test-linerange.py
275 test-locate.t
276 test-locate.t
276 test-lock-badness.t
277 test-lock-badness.t
277 test-log-linerange.t
278 test-log-linerange.t
278 test-log.t
279 test-log.t
279 test-logexchange.t
280 test-logexchange.t
280 test-lrucachedict.py
281 test-lrucachedict.py
281 test-mactext.t
282 test-mactext.t
282 test-mailmap.t
283 test-mailmap.t
283 test-manifest-merging.t
284 test-manifest-merging.t
284 test-manifest.py
285 test-manifest.py
285 test-manifest.t
286 test-manifest.t
286 test-match.py
287 test-match.py
287 test-mdiff.py
288 test-mdiff.py
288 test-merge-changedelete.t
289 test-merge-changedelete.t
289 test-merge-closedheads.t
290 test-merge-closedheads.t
290 test-merge-commit.t
291 test-merge-commit.t
291 test-merge-criss-cross.t
292 test-merge-criss-cross.t
292 test-merge-default.t
293 test-merge-default.t
293 test-merge-force.t
294 test-merge-force.t
294 test-merge-halt.t
295 test-merge-halt.t
295 test-merge-internal-tools-pattern.t
296 test-merge-internal-tools-pattern.t
296 test-merge-local.t
297 test-merge-local.t
297 test-merge-no-file-change.t
298 test-merge-no-file-change.t
298 test-merge-remove.t
299 test-merge-remove.t
299 test-merge-revert.t
300 test-merge-revert.t
300 test-merge-revert2.t
301 test-merge-revert2.t
301 test-merge-subrepos.t
302 test-merge-subrepos.t
302 test-merge-symlinks.t
303 test-merge-symlinks.t
303 test-merge-tools.t
304 test-merge-tools.t
304 test-merge-types.t
305 test-merge-types.t
305 test-merge1.t
306 test-merge1.t
306 test-merge10.t
307 test-merge10.t
307 test-merge2.t
308 test-merge2.t
308 test-merge4.t
309 test-merge4.t
309 test-merge5.t
310 test-merge5.t
310 test-merge6.t
311 test-merge6.t
311 test-merge7.t
312 test-merge7.t
312 test-merge8.t
313 test-merge8.t
313 test-merge9.t
314 test-merge9.t
314 test-minifileset.py
315 test-minifileset.py
315 test-minirst.py
316 test-minirst.py
316 test-mq-git.t
317 test-mq-git.t
317 test-mq-guards.t
318 test-mq-guards.t
318 test-mq-header-date.t
319 test-mq-header-date.t
319 test-mq-header-from.t
320 test-mq-header-from.t
320 test-mq-merge.t
321 test-mq-merge.t
321 test-mq-pull-from-bundle.t
322 test-mq-pull-from-bundle.t
322 test-mq-qclone-http.t
323 test-mq-qclone-http.t
323 test-mq-qdelete.t
324 test-mq-qdelete.t
324 test-mq-qdiff.t
325 test-mq-qdiff.t
325 test-mq-qfold.t
326 test-mq-qfold.t
326 test-mq-qgoto.t
327 test-mq-qgoto.t
327 test-mq-qimport-fail-cleanup.t
328 test-mq-qimport-fail-cleanup.t
328 test-mq-qnew.t
329 test-mq-qnew.t
329 test-mq-qpush-exact.t
330 test-mq-qpush-exact.t
330 test-mq-qpush-fail.t
331 test-mq-qpush-fail.t
331 test-mq-qqueue.t
332 test-mq-qqueue.t
332 test-mq-qrefresh-interactive.t
333 test-mq-qrefresh-interactive.t
333 test-mq-qrefresh-replace-log-message.t
334 test-mq-qrefresh-replace-log-message.t
334 test-mq-qrefresh.t
335 test-mq-qrefresh.t
335 test-mq-qrename.t
336 test-mq-qrename.t
336 test-mq-qsave.t
337 test-mq-qsave.t
337 test-mq-safety.t
338 test-mq-safety.t
338 test-mq-subrepo.t
339 test-mq-subrepo.t
339 test-mq-symlinks.t
340 test-mq-symlinks.t
340 test-mq.t
341 test-mq.t
341 test-mv-cp-st-diff.t
342 test-mv-cp-st-diff.t
342 test-narrow-acl.t
343 test-narrow-acl.t
343 test-narrow-archive.t
344 test-narrow-archive.t
344 test-narrow-clone-no-ellipsis.t
345 test-narrow-clone-no-ellipsis.t
345 test-narrow-clone-non-narrow-server.t
346 test-narrow-clone-non-narrow-server.t
346 test-narrow-clone-nonlinear.t
347 test-narrow-clone-nonlinear.t
347 test-narrow-clone.t
348 test-narrow-clone.t
348 test-narrow-commit.t
349 test-narrow-commit.t
349 test-narrow-copies.t
350 test-narrow-copies.t
350 test-narrow-debugcommands.t
351 test-narrow-debugcommands.t
351 test-narrow-debugrebuilddirstate.t
352 test-narrow-debugrebuilddirstate.t
352 test-narrow-exchange-merges.t
353 test-narrow-exchange-merges.t
353 test-narrow-exchange.t
354 test-narrow-exchange.t
354 test-narrow-expanddirstate.t
355 test-narrow-expanddirstate.t
355 test-narrow-merge.t
356 test-narrow-merge.t
356 test-narrow-patch.t
357 test-narrow-patch.t
357 test-narrow-patterns.t
358 test-narrow-patterns.t
358 test-narrow-pull.t
359 test-narrow-pull.t
359 test-narrow-rebase.t
360 test-narrow-rebase.t
360 test-narrow-shallow-merges.t
361 test-narrow-shallow-merges.t
361 test-narrow-shallow.t
362 test-narrow-shallow.t
362 test-narrow-strip.t
363 test-narrow-strip.t
363 test-narrow-trackedcmd.t
364 test-narrow-trackedcmd.t
364 test-narrow-update.t
365 test-narrow-update.t
365 test-narrow-widen-no-ellipsis.t
366 test-narrow-widen-no-ellipsis.t
366 test-narrow-widen.t
367 test-narrow-widen.t
367 test-narrow.t
368 test-narrow.t
368 test-nested-repo.t
369 test-nested-repo.t
369 test-newbranch.t
370 test-newbranch.t
370 test-newercgi.t
371 test-newercgi.t
371 test-nointerrupt.t
372 test-nointerrupt.t
372 test-obshistory.t
373 test-obshistory.t
373 test-obsmarker-template.t
374 test-obsmarker-template.t
374 test-obsmarkers-effectflag.t
375 test-obsmarkers-effectflag.t
375 test-obsolete-bounds-checking.t
376 test-obsolete-bounds-checking.t
376 test-obsolete-bundle-strip.t
377 test-obsolete-bundle-strip.t
377 test-obsolete-changeset-exchange.t
378 test-obsolete-changeset-exchange.t
378 test-obsolete-checkheads.t
379 test-obsolete-checkheads.t
379 test-obsolete-distributed.t
380 test-obsolete-distributed.t
380 test-obsolete-divergent.t
381 test-obsolete-divergent.t
381 test-obsolete-tag-cache.t
382 test-obsolete-tag-cache.t
382 test-pager.t
383 test-pager.t
383 test-parents.t
384 test-parents.t
384 test-parseindex2.py
385 test-parseindex2.py
385 test-patch-offset.t
386 test-patch-offset.t
386 test-patch.t
387 test-patch.t
387 test-patchbomb-bookmark.t
388 test-patchbomb-bookmark.t
388 test-patchbomb-tls.t
389 test-patchbomb-tls.t
389 test-patchbomb.t
390 test-patchbomb.t
390 test-pathconflicts-merge.t
391 test-pathconflicts-merge.t
391 test-pathconflicts-update.t
392 test-pathconflicts-update.t
392 test-pathencode.py
393 test-pathencode.py
393 test-pending.t
394 test-pending.t
394 test-permissions.t
395 test-permissions.t
395 test-phases.t
396 test-phases.t
396 test-pull-branch.t
397 test-pull-branch.t
397 test-pull-http.t
398 test-pull-http.t
398 test-pull-permission.t
399 test-pull-permission.t
399 test-pull-pull-corruption.t
400 test-pull-pull-corruption.t
400 test-pull-r.t
401 test-pull-r.t
401 test-pull-update.t
402 test-pull-update.t
402 test-pull.t
403 test-pull.t
403 test-purge.t
404 test-purge.t
404 test-push-cgi.t
405 test-push-cgi.t
405 test-push-checkheads-partial-C1.t
406 test-push-checkheads-partial-C1.t
406 test-push-checkheads-partial-C2.t
407 test-push-checkheads-partial-C2.t
407 test-push-checkheads-partial-C3.t
408 test-push-checkheads-partial-C3.t
408 test-push-checkheads-partial-C4.t
409 test-push-checkheads-partial-C4.t
409 test-push-checkheads-pruned-B1.t
410 test-push-checkheads-pruned-B1.t
410 test-push-checkheads-pruned-B2.t
411 test-push-checkheads-pruned-B2.t
411 test-push-checkheads-pruned-B3.t
412 test-push-checkheads-pruned-B3.t
412 test-push-checkheads-pruned-B4.t
413 test-push-checkheads-pruned-B4.t
413 test-push-checkheads-pruned-B5.t
414 test-push-checkheads-pruned-B5.t
414 test-push-checkheads-pruned-B6.t
415 test-push-checkheads-pruned-B6.t
415 test-push-checkheads-pruned-B7.t
416 test-push-checkheads-pruned-B7.t
416 test-push-checkheads-pruned-B8.t
417 test-push-checkheads-pruned-B8.t
417 test-push-checkheads-superceed-A1.t
418 test-push-checkheads-superceed-A1.t
418 test-push-checkheads-superceed-A2.t
419 test-push-checkheads-superceed-A2.t
419 test-push-checkheads-superceed-A3.t
420 test-push-checkheads-superceed-A3.t
420 test-push-checkheads-superceed-A4.t
421 test-push-checkheads-superceed-A4.t
421 test-push-checkheads-superceed-A5.t
422 test-push-checkheads-superceed-A5.t
422 test-push-checkheads-superceed-A6.t
423 test-push-checkheads-superceed-A6.t
423 test-push-checkheads-superceed-A7.t
424 test-push-checkheads-superceed-A7.t
424 test-push-checkheads-superceed-A8.t
425 test-push-checkheads-superceed-A8.t
425 test-push-checkheads-unpushed-D1.t
426 test-push-checkheads-unpushed-D1.t
426 test-push-checkheads-unpushed-D2.t
427 test-push-checkheads-unpushed-D2.t
427 test-push-checkheads-unpushed-D3.t
428 test-push-checkheads-unpushed-D3.t
428 test-push-checkheads-unpushed-D4.t
429 test-push-checkheads-unpushed-D4.t
429 test-push-checkheads-unpushed-D5.t
430 test-push-checkheads-unpushed-D5.t
430 test-push-checkheads-unpushed-D6.t
431 test-push-checkheads-unpushed-D6.t
431 test-push-checkheads-unpushed-D7.t
432 test-push-checkheads-unpushed-D7.t
432 test-push-http.t
433 test-push-http.t
433 test-push-warn.t
434 test-push-warn.t
434 test-push.t
435 test-push.t
435 test-pushvars.t
436 test-pushvars.t
436 test-qrecord.t
437 test-qrecord.t
437 test-rebase-abort.t
438 test-rebase-abort.t
438 test-rebase-backup.t
439 test-rebase-backup.t
439 test-rebase-base-flag.t
440 test-rebase-base-flag.t
440 test-rebase-bookmarks.t
441 test-rebase-bookmarks.t
441 test-rebase-brute-force.t
442 test-rebase-brute-force.t
442 test-rebase-cache.t
443 test-rebase-cache.t
443 test-rebase-check-restore.t
444 test-rebase-check-restore.t
444 test-rebase-collapse.t
445 test-rebase-collapse.t
445 test-rebase-conflicts.t
446 test-rebase-conflicts.t
446 test-rebase-dest.t
447 test-rebase-dest.t
447 test-rebase-detach.t
448 test-rebase-detach.t
448 test-rebase-emptycommit.t
449 test-rebase-emptycommit.t
449 test-rebase-inmemory.t
450 test-rebase-inmemory.t
450 test-rebase-interruptions.t
451 test-rebase-interruptions.t
451 test-rebase-issue-noparam-single-rev.t
452 test-rebase-issue-noparam-single-rev.t
452 test-rebase-legacy.t
453 test-rebase-legacy.t
453 test-rebase-mq-skip.t
454 test-rebase-mq-skip.t
454 test-rebase-mq.t
455 test-rebase-mq.t
455 test-rebase-named-branches.t
456 test-rebase-named-branches.t
456 test-rebase-newancestor.t
457 test-rebase-newancestor.t
457 test-rebase-obsolete.t
458 test-rebase-obsolete.t
458 test-rebase-parameters.t
459 test-rebase-parameters.t
459 test-rebase-partial.t
460 test-rebase-partial.t
460 test-rebase-pull.t
461 test-rebase-pull.t
461 test-rebase-rename.t
462 test-rebase-rename.t
462 test-rebase-scenario-global.t
463 test-rebase-scenario-global.t
463 test-rebase-templates.t
464 test-rebase-templates.t
464 test-rebase-transaction.t
465 test-rebase-transaction.t
465 test-rebuildstate.t
466 test-rebuildstate.t
466 test-record.t
467 test-record.t
467 test-relink.t
468 test-relink.t
468 test-remove.t
469 test-remove.t
469 test-removeemptydirs.t
470 test-removeemptydirs.t
470 test-rename-after-merge.t
471 test-rename-after-merge.t
471 test-rename-dir-merge.t
472 test-rename-dir-merge.t
472 test-rename-merge1.t
473 test-rename-merge1.t
473 test-rename-merge2.t
474 test-rename-merge2.t
474 test-rename.t
475 test-rename.t
475 test-repair-strip.t
476 test-repair-strip.t
476 test-repo-compengines.t
477 test-repo-compengines.t
477 test-resolve.t
478 test-resolve.t
478 test-revert-flags.t
479 test-revert-flags.t
479 test-revert-interactive.t
480 test-revert-interactive.t
480 test-revert-unknown.t
481 test-revert-unknown.t
481 test-revert.t
482 test-revert.t
482 test-revisions.t
483 test-revisions.t
483 test-revlog-ancestry.py
484 test-revlog-ancestry.py
484 test-revlog-group-emptyiter.t
485 test-revlog-group-emptyiter.t
485 test-revlog-mmapindex.t
486 test-revlog-mmapindex.t
486 test-revlog-packentry.t
487 test-revlog-packentry.t
487 test-revlog-raw.py
488 test-revlog-raw.py
488 test-revlog-v2.t
489 test-revlog-v2.t
489 test-revset-dirstate-parents.t
490 test-revset-dirstate-parents.t
490 test-revset-legacy-lookup.t
491 test-revset-legacy-lookup.t
491 test-revset-outgoing.t
492 test-revset-outgoing.t
492 test-rollback.t
493 test-rollback.t
493 test-run-tests.py
494 test-run-tests.py
494 test-run-tests.t
495 test-run-tests.t
495 test-schemes.t
496 test-schemes.t
496 test-serve.t
497 test-serve.t
497 test-setdiscovery.t
498 test-setdiscovery.t
498 test-share.t
499 test-share.t
499 test-shelve.t
500 test-shelve.t
500 test-show-stack.t
501 test-show-stack.t
501 test-show-work.t
502 test-show-work.t
502 test-show.t
503 test-show.t
503 test-simple-update.t
504 test-simple-update.t
504 test-simplekeyvaluefile.py
505 test-simplekeyvaluefile.py
505 test-simplemerge.py
506 test-simplemerge.py
506 test-single-head.t
507 test-single-head.t
507 test-sparse-clear.t
508 test-sparse-clear.t
508 test-sparse-clone.t
509 test-sparse-clone.t
509 test-sparse-import.t
510 test-sparse-import.t
510 test-sparse-merges.t
511 test-sparse-merges.t
511 test-sparse-profiles.t
512 test-sparse-profiles.t
512 test-sparse-requirement.t
513 test-sparse-requirement.t
513 test-sparse-verbose-json.t
514 test-sparse-verbose-json.t
514 test-sparse.t
515 test-sparse.t
515 test-split.t
516 test-split.t
516 test-ssh-bundle1.t
517 test-ssh-bundle1.t
517 test-ssh-clone-r.t
518 test-ssh-clone-r.t
518 test-ssh-proto-unbundle.t
519 test-ssh-proto-unbundle.t
519 test-ssh-proto.t
520 test-ssh-proto.t
520 test-ssh.t
521 test-ssh.t
521 test-sshserver.py
522 test-sshserver.py
522 test-stack.t
523 test-stack.t
523 test-status-inprocess.py
524 test-status-inprocess.py
524 test-status-rev.t
525 test-status-rev.t
525 test-status-terse.t
526 test-status-terse.t
526 test-stream-bundle-v2.t
527 test-stream-bundle-v2.t
527 test-strict.t
528 test-strict.t
528 test-strip-cross.t
529 test-strip-cross.t
529 test-strip.t
530 test-strip.t
530 test-subrepo-deep-nested-change.t
531 test-subrepo-deep-nested-change.t
531 test-subrepo-missing.t
532 test-subrepo-missing.t
532 test-subrepo-paths.t
533 test-subrepo-paths.t
533 test-subrepo-recursion.t
534 test-subrepo-recursion.t
534 test-subrepo-relative-path.t
535 test-subrepo-relative-path.t
535 test-subrepo.t
536 test-subrepo.t
536 test-symlink-os-yes-fs-no.py
537 test-symlink-os-yes-fs-no.py
537 test-symlink-placeholder.t
538 test-symlink-placeholder.t
538 test-symlinks.t
539 test-symlinks.t
539 test-tag.t
540 test-tag.t
540 test-tags.t
541 test-tags.t
541 test-template-basic.t
542 test-template-basic.t
542 test-template-functions.t
543 test-template-functions.t
543 test-template-keywords.t
544 test-template-keywords.t
544 test-template-map.t
545 test-template-map.t
545 test-transplant.t
546 test-transplant.t
546 test-treemanifest.t
547 test-treemanifest.t
547 test-ui-color.py
548 test-ui-color.py
548 test-ui-config.py
549 test-ui-config.py
549 test-ui-verbosity.py
550 test-ui-verbosity.py
550 test-unamend.t
551 test-unamend.t
551 test-unbundlehash.t
552 test-unbundlehash.t
552 test-uncommit.t
553 test-uncommit.t
553 test-unified-test.t
554 test-unified-test.t
554 test-unionrepo.t
555 test-unionrepo.t
555 test-unrelated-pull.t
556 test-unrelated-pull.t
556 test-up-local-change.t
557 test-up-local-change.t
557 test-update-branches.t
558 test-update-branches.t
558 test-update-dest.t
559 test-update-dest.t
559 test-update-issue1456.t
560 test-update-issue1456.t
560 test-update-names.t
561 test-update-names.t
561 test-update-reverse.t
562 test-update-reverse.t
562 test-upgrade-repo.t
563 test-upgrade-repo.t
563 test-url-download.t
564 test-url-download.t
564 test-url-rev.t
565 test-url-rev.t
565 test-url.py
566 test-url.py
566 test-username-newline.t
567 test-username-newline.t
567 test-util.py
568 test-util.py
568 test-verify.t
569 test-verify.t
569 test-walk.t
570 test-walk.t
570 test-walkrepo.py
571 test-walkrepo.py
571 test-websub.t
572 test-websub.t
572 test-win32text.t
573 test-win32text.t
573 test-wireproto-clientreactor.py
574 test-wireproto-clientreactor.py
574 test-wireproto-framing.py
575 test-wireproto-framing.py
575 test-wireproto-serverreactor.py
576 test-wireproto-serverreactor.py
576 test-wireproto.py
577 test-wireproto.py
577 test-wsgirequest.py
578 test-wsgirequest.py
578 test-xdg.t
579 test-xdg.t
@@ -1,48 +1,50
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # Undump a dump from dumprevlog
2 # Undump a dump from dumprevlog
3 # $ hg init
3 # $ hg init
4 # $ undumprevlog < repo.dump
4 # $ undumprevlog < repo.dump
5
5
6 from __future__ import absolute_import, print_function
6 from __future__ import absolute_import, print_function
7
7
8 import sys
8 import sys
9 from mercurial import (
9 from mercurial import (
10 encoding,
10 node,
11 node,
12 pycompat,
11 revlog,
13 revlog,
12 transaction,
14 transaction,
13 vfs as vfsmod,
15 vfs as vfsmod,
14 )
16 )
15 from mercurial.utils import (
17 from mercurial.utils import (
16 procutil,
18 procutil,
17 )
19 )
18
20
19 for fp in (sys.stdin, sys.stdout, sys.stderr):
21 for fp in (sys.stdin, sys.stdout, sys.stderr):
20 procutil.setbinary(fp)
22 procutil.setbinary(fp)
21
23
22 opener = vfsmod.vfs('.', False)
24 opener = vfsmod.vfs(b'.', False)
23 tr = transaction.transaction(sys.stderr.write, opener, {'store': opener},
25 tr = transaction.transaction(sys.stderr.write, opener, {b'store': opener},
24 "undump.journal")
26 b"undump.journal")
25 while True:
27 while True:
26 l = sys.stdin.readline()
28 l = sys.stdin.readline()
27 if not l:
29 if not l:
28 break
30 break
29 if l.startswith("file:"):
31 if l.startswith("file:"):
30 f = l[6:-1]
32 f = encoding.strtolocal(l[6:-1])
31 r = revlog.revlog(opener, f)
33 r = revlog.revlog(opener, f)
32 print(f)
34 pycompat.stdout.write(b'%s\n' % f)
33 elif l.startswith("node:"):
35 elif l.startswith("node:"):
34 n = node.bin(l[6:-1])
36 n = node.bin(l[6:-1])
35 elif l.startswith("linkrev:"):
37 elif l.startswith("linkrev:"):
36 lr = int(l[9:-1])
38 lr = int(l[9:-1])
37 elif l.startswith("parents:"):
39 elif l.startswith("parents:"):
38 p = l[9:-1].split()
40 p = l[9:-1].split()
39 p1 = node.bin(p[0])
41 p1 = node.bin(p[0])
40 p2 = node.bin(p[1])
42 p2 = node.bin(p[1])
41 elif l.startswith("length:"):
43 elif l.startswith("length:"):
42 length = int(l[8:-1])
44 length = int(l[8:-1])
43 sys.stdin.readline() # start marker
45 sys.stdin.readline() # start marker
44 d = sys.stdin.read(length)
46 d = encoding.strtolocal(sys.stdin.read(length))
45 sys.stdin.readline() # end marker
47 sys.stdin.readline() # end marker
46 r.addrevision(d, tr, lr, p1, p2)
48 r.addrevision(d, tr, lr, p1, p2)
47
49
48 tr.close()
50 tr.close()
General Comments 0
You need to be logged in to leave comments. Login now