##// END OF EJS Templates
tests: perform a shallow copy instead of a deep copy...
tests: perform a shallow copy instead of a deep copy Python 3 can't perform a deep copy because it looks like symbols in the locals() namespace are not deep-copyable. For the curious, somehow the deepcopy() is attempting to copy objects attached to the unittest.* functions for the running test! We don't use deepcopy() anywhere in the code base and a shallow object copy should be sufficient to test lock copying. Actually, I'm not sure why we even test this, as I couldn't find copy.copy() being used for lock copying either. Who knows. Differential Revision: https://phab.mercurial-scm.org/D5770

File last commit:

r41051:b444407f default
r41527:af31e369 default
Show More
dirstate_corpus.py
18 lines | 570 B | text/x-python | PythonLexer
from __future__ import absolute_import, print_function
import argparse
import os
import zipfile
ap = argparse.ArgumentParser()
ap.add_argument("out", metavar="some.zip", type=str, nargs=1)
args = ap.parse_args()
reporoot = os.path.normpath(os.path.join(os.path.dirname(__file__),
'..', '..'))
dirstate = os.path.join(reporoot, '.hg', 'dirstate')
with zipfile.ZipFile(args.out[0], "w", zipfile.ZIP_STORED) as zf:
if os.path.exists(dirstate):
with open(dirstate) as f:
zf.writestr("dirstate", f.read())