comparison tests/test-filelog.py @ 47012:d55b71393907

node: replace nullid and friends with nodeconstants class The introduction of 256bit hashes require changes to nullid and other constant magic values. Start pushing them down from repository and revlog where sensible. Differential Revision: https://phab.mercurial-scm.org/D9465
author Joerg Sonnenberger <joerg@bec.de>
date Mon, 29 Mar 2021 01:52:06 +0200
parents c102b704edb5
children 23f5ed6dbcb1
comparison
equal deleted inserted replaced
46992:5fa019ceb499 47012:d55b71393907
2 """ 2 """
3 Tests the behavior of filelog w.r.t. data starting with '\1\n' 3 Tests the behavior of filelog w.r.t. data starting with '\1\n'
4 """ 4 """
5 from __future__ import absolute_import, print_function 5 from __future__ import absolute_import, print_function
6 6
7 from mercurial.node import ( 7 from mercurial.node import hex
8 hex,
9 nullid,
10 )
11 from mercurial import ( 8 from mercurial import (
12 hg, 9 hg,
13 ui as uimod, 10 ui as uimod,
14 ) 11 )
15 12
20 17
21 18
22 def addrev(text, renamed=False): 19 def addrev(text, renamed=False):
23 if renamed: 20 if renamed:
24 # data doesn't matter. Just make sure filelog.renamed() returns True 21 # data doesn't matter. Just make sure filelog.renamed() returns True
25 meta = {b'copyrev': hex(nullid), b'copy': b'bar'} 22 meta = {b'copyrev': hex(repo.nullid), b'copy': b'bar'}
26 else: 23 else:
27 meta = {} 24 meta = {}
28 25
29 lock = t = None 26 lock = t = None
30 try: 27 try:
31 lock = repo.lock() 28 lock = repo.lock()
32 t = repo.transaction(b'commit') 29 t = repo.transaction(b'commit')
33 node = fl.add(text, meta, t, 0, nullid, nullid) 30 node = fl.add(text, meta, t, 0, repo.nullid, repo.nullid)
34 return node 31 return node
35 finally: 32 finally:
36 if t: 33 if t:
37 t.close() 34 t.close()
38 if lock: 35 if lock: