Mercurial > public > mercurial-scm > hg
comparison tests/test-filelog.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | f71c97d9b97b |
children | c102b704edb5 |
comparison
equal
deleted
inserted
replaced
43075:57875cf423c9 | 43076:2372284d9457 |
---|---|
16 myui = uimod.ui.load() | 16 myui = uimod.ui.load() |
17 repo = hg.repository(myui, path=b'.', create=True) | 17 repo = hg.repository(myui, path=b'.', create=True) |
18 | 18 |
19 fl = repo.file(b'foobar') | 19 fl = repo.file(b'foobar') |
20 | 20 |
21 | |
21 def addrev(text, renamed=False): | 22 def addrev(text, renamed=False): |
22 if renamed: | 23 if renamed: |
23 # data doesn't matter. Just make sure filelog.renamed() returns True | 24 # data doesn't matter. Just make sure filelog.renamed() returns True |
24 meta = {b'copyrev': hex(nullid), b'copy': b'bar'} | 25 meta = {b'copyrev': hex(nullid), b'copy': b'bar'} |
25 else: | 26 else: |
35 if t: | 36 if t: |
36 t.close() | 37 t.close() |
37 if lock: | 38 if lock: |
38 lock.release() | 39 lock.release() |
39 | 40 |
41 | |
40 def error(text): | 42 def error(text): |
41 print('ERROR: ' + text) | 43 print('ERROR: ' + text) |
44 | |
42 | 45 |
43 textwith = b'\1\nfoo' | 46 textwith = b'\1\nfoo' |
44 without = b'foo' | 47 without = b'foo' |
45 | 48 |
46 node = addrev(textwith) | 49 node = addrev(textwith) |
47 if not textwith == fl.read(node): | 50 if not textwith == fl.read(node): |
48 error('filelog.read for data starting with \\1\\n') | 51 error('filelog.read for data starting with \\1\\n') |
49 if fl.cmp(node, textwith) or not fl.cmp(node, without): | 52 if fl.cmp(node, textwith) or not fl.cmp(node, without): |
50 error('filelog.cmp for data starting with \\1\\n') | 53 error('filelog.cmp for data starting with \\1\\n') |
51 if fl.size(0) != len(textwith): | 54 if fl.size(0) != len(textwith): |
52 error('FIXME: This is a known failure of filelog.size for data starting ' | 55 error( |
53 'with \\1\\n') | 56 'FIXME: This is a known failure of filelog.size for data starting ' |
57 'with \\1\\n' | |
58 ) | |
54 | 59 |
55 node = addrev(textwith, renamed=True) | 60 node = addrev(textwith, renamed=True) |
56 if not textwith == fl.read(node): | 61 if not textwith == fl.read(node): |
57 error('filelog.read for a renaming + data starting with \\1\\n') | 62 error('filelog.read for a renaming + data starting with \\1\\n') |
58 if fl.cmp(node, textwith) or not fl.cmp(node, without): | 63 if fl.cmp(node, textwith) or not fl.cmp(node, without): |