##// END OF EJS Templates
memfilectx: make changectx argument mandatory in constructor (API)...
memfilectx: make changectx argument mandatory in constructor (API) committablefilectx has three subclasses: workingfilectx, memfilectx, and overlayfilectx. committablefilectx takes an optional (change) ctx instance to its constructor. If it's provided, it's set on the instance as self._changectx. If not, that property is supposed to be defined by the class. However, only workingfilectx does that. The other two will have the property undefined if it's not passed in the constructor. That seems bad to me. This patch makes the changectx argument to the memfilectx constructor mandatory because that fixes the failure I ran into. It seems like we should also fix the overlayfilectx case. Differential Revision: https://phab.mercurial-scm.org/D1658

File last commit:

r33874:5d9890d8 default
r35401:8a0cac20 default
Show More
undumprevlog
46 lines | 1.1 KiB | text/plain | TextLexer
Matt Mackall
add simple dump and undump scripts to contrib/
r6433 #!/usr/bin/env python
# Undump a dump from dumprevlog
# $ hg init
# $ undumprevlog < repo.dump
Augie Fackler
undumprevlog: update to valid Python 3 syntax...
r33874 from __future__ import absolute_import, print_function
Pulkit Goyal
py3: make contrib/undumprevlog use absolute_import
r29167
Matt Mackall
add simple dump and undump scripts to contrib/
r6433 import sys
Pulkit Goyal
py3: make contrib/undumprevlog use absolute_import
r29167 from mercurial import (
node,
revlog,
transaction,
util,
Pierre-Yves David
vfs: use 'vfs' module directly in 'contrib/undumprevlog'...
r31248 vfs as vfsmod,
Pulkit Goyal
py3: make contrib/undumprevlog use absolute_import
r29167 )
Matt Mackall
add simple dump and undump scripts to contrib/
r6433
Adrian Buehlmann
contrib: fix binary file issues with dumprevlog on Windows...
r6466 for fp in (sys.stdin, sys.stdout, sys.stderr):
Adrian Buehlmann
rename util.set_binary to setbinary
r14233 util.setbinary(fp)
Adrian Buehlmann
contrib: fix binary file issues with dumprevlog on Windows...
r6466
Pierre-Yves David
vfs: use 'vfs' module directly in 'contrib/undumprevlog'...
r31248 opener = vfsmod.vfs('.', False)
Pierre-Yves David
transaction: pass a vfs map to the transaction...
r23310 tr = transaction.transaction(sys.stderr.write, opener, {'store': opener},
"undump.journal")
Mads Kiilerich
tests: run check-code on Python files without .py extension
r19022 while True:
Matt Mackall
add simple dump and undump scripts to contrib/
r6433 l = sys.stdin.readline()
if not l:
break
if l.startswith("file:"):
f = l[6:-1]
r = revlog.revlog(opener, f)
Augie Fackler
undumprevlog: update to valid Python 3 syntax...
r33874 print(f)
Matt Mackall
add simple dump and undump scripts to contrib/
r6433 elif l.startswith("node:"):
n = node.bin(l[6:-1])
elif l.startswith("linkrev:"):
lr = int(l[9:-1])
elif l.startswith("parents:"):
p = l[9:-1].split()
p1 = node.bin(p[0])
p2 = node.bin(p[1])
elif l.startswith("length:"):
length = int(l[8:-1])
sys.stdin.readline() # start marker
d = sys.stdin.read(length)
sys.stdin.readline() # end marker
r.addrevision(d, tr, lr, p1, p2)
tr.close()