##// END OF EJS Templates
copies-rust: rename Oracle.is_ancestor to Oracle.is_overwrite...
copies-rust: rename Oracle.is_ancestor to Oracle.is_overwrite The core information that we want here is about "does information from revision X overwrite information in Y". To do so, we check is X is an ancestors of Y, but this is an implementation details, they could be other ways. We update the naming to clarify this (and align more with wording used in upcoming changesets. For people curious about other ways: for example we could record the overwrite graph as it happens and reuse that to check if X overwrite Y, without having to do potential expensive `is_ancestor` call on the revision graph. Differential Revision: https://phab.mercurial-scm.org/D9496

File last commit:

r46729:59fa3890 default
r46769:ecbb2fc9 default
Show More
undumprevlog
48 lines | 1.2 KiB | text/plain | TextLexer
#!/usr/bin/env python3
# Undump a dump from dumprevlog
# $ hg init
# $ undumprevlog < repo.dump
from __future__ import absolute_import, print_function
import sys
from mercurial.node import bin
from mercurial import (
encoding,
revlog,
transaction,
vfs as vfsmod,
)
from mercurial.utils import procutil
for fp in (sys.stdin, sys.stdout, sys.stderr):
procutil.setbinary(fp)
opener = vfsmod.vfs(b'.', False)
tr = transaction.transaction(
sys.stderr.write, opener, {b'store': opener}, b"undump.journal"
)
while True:
l = sys.stdin.readline()
if not l:
break
if l.startswith("file:"):
f = encoding.strtolocal(l[6:-1])
r = revlog.revlog(opener, f)
procutil.stdout.write(b'%s\n' % f)
elif l.startswith("node:"):
n = bin(l[6:-1])
elif l.startswith("linkrev:"):
lr = int(l[9:-1])
elif l.startswith("parents:"):
p = l[9:-1].split()
p1 = bin(p[0])
p2 = bin(p[1])
elif l.startswith("length:"):
length = int(l[8:-1])
sys.stdin.readline() # start marker
d = encoding.strtolocal(sys.stdin.read(length))
sys.stdin.readline() # end marker
r.addrevision(d, tr, lr, p1, p2)
tr.close()