Mercurial > hg
comparison tests/test-filelog.py @ 37933:f71c97d9b97b
tests: port test-filelog.py to Python 3
# skip-blame just some bytes prefixes
Differential Revision: https://phab.mercurial-scm.org/D3522
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 27 Apr 2018 13:17:24 -0400 |
parents | d83ca854fa21 |
children | 2372284d9457 |
comparison
equal
deleted
inserted
replaced
37932:bf6bb710b40f | 37933:f71c97d9b97b |
---|---|
12 hg, | 12 hg, |
13 ui as uimod, | 13 ui as uimod, |
14 ) | 14 ) |
15 | 15 |
16 myui = uimod.ui.load() | 16 myui = uimod.ui.load() |
17 repo = hg.repository(myui, path='.', create=True) | 17 repo = hg.repository(myui, path=b'.', create=True) |
18 | 18 |
19 fl = repo.file('foobar') | 19 fl = repo.file(b'foobar') |
20 | 20 |
21 def addrev(text, renamed=False): | 21 def addrev(text, renamed=False): |
22 if renamed: | 22 if renamed: |
23 # data doesn't matter. Just make sure filelog.renamed() returns True | 23 # data doesn't matter. Just make sure filelog.renamed() returns True |
24 meta = {'copyrev': hex(nullid), 'copy': 'bar'} | 24 meta = {b'copyrev': hex(nullid), b'copy': b'bar'} |
25 else: | 25 else: |
26 meta = {} | 26 meta = {} |
27 | 27 |
28 lock = t = None | 28 lock = t = None |
29 try: | 29 try: |
30 lock = repo.lock() | 30 lock = repo.lock() |
31 t = repo.transaction('commit') | 31 t = repo.transaction(b'commit') |
32 node = fl.add(text, meta, t, 0, nullid, nullid) | 32 node = fl.add(text, meta, t, 0, nullid, nullid) |
33 return node | 33 return node |
34 finally: | 34 finally: |
35 if t: | 35 if t: |
36 t.close() | 36 t.close() |
38 lock.release() | 38 lock.release() |
39 | 39 |
40 def error(text): | 40 def error(text): |
41 print('ERROR: ' + text) | 41 print('ERROR: ' + text) |
42 | 42 |
43 textwith = '\1\nfoo' | 43 textwith = b'\1\nfoo' |
44 without = 'foo' | 44 without = b'foo' |
45 | 45 |
46 node = addrev(textwith) | 46 node = addrev(textwith) |
47 if not textwith == fl.read(node): | 47 if not textwith == fl.read(node): |
48 error('filelog.read for data starting with \\1\\n') | 48 error('filelog.read for data starting with \\1\\n') |
49 if fl.cmp(node, textwith) or not fl.cmp(node, without): | 49 if fl.cmp(node, textwith) or not fl.cmp(node, without): |