##// END OF EJS Templates
narrow: fix flaky behavior described in issue6150...
narrow: fix flaky behavior described in issue6150 This has been plaguing the CI for a good while, and it doesn't appear to have an easy fix proposed yet. The solution in this change is to always do an unambiguous (but expensive) lookup in case of comparison. This should always be correct, albeit suboptimal. Differential Revision: https://phab.mercurial-scm.org/D10034

File last commit:

r46434:c102b704 default
r47280:b994db7c stable
Show More
test-filelog.py
68 lines | 1.6 KiB | text/x-python | PythonLexer
Gregory Szorc
global: use python3 in shebangs...
r46434 #!/usr/bin/env python3
Mads Kiilerich
tests: test test-filelog is python - rename to test-filelog.py
r16498 """
timeless@mozdev.org
spelling: behaviour -> behavior
r26098 Tests the behavior of filelog w.r.t. data starting with '\1\n'
Mads Kiilerich
tests: test test-filelog is python - rename to test-filelog.py
r16498 """
Robert Stanca
py3: use print_function in test-filelog.py
r28744 from __future__ import absolute_import, print_function
Yuya Nishihara
py3: move up symbol imports to enforce import-checker rules...
r29205
from mercurial.node import (
hex,
nullid,
)
Robert Stanca
py3: use absolute_import in test-filelog.py
r28743 from mercurial import (
hg,
Yuya Nishihara
test-filelog: alias ui as uimod
r28805 ui as uimod,
Robert Stanca
py3: use absolute_import in test-filelog.py
r28743 )
Mads Kiilerich
tests: test test-filelog is python - rename to test-filelog.py
r16498
Yuya Nishihara
ui: factor out ui.load() to create a ui without loading configs (API)...
r30559 myui = uimod.ui.load()
Augie Fackler
tests: port test-filelog.py to Python 3...
r37952 repo = hg.repository(myui, path=b'.', create=True)
Mads Kiilerich
tests: test test-filelog is python - rename to test-filelog.py
r16498
Augie Fackler
tests: port test-filelog.py to Python 3...
r37952 fl = repo.file(b'foobar')
Mads Kiilerich
tests: test test-filelog is python - rename to test-filelog.py
r16498
Augie Fackler
formatting: blacken the codebase...
r43346
Mads Kiilerich
tests: test test-filelog is python - rename to test-filelog.py
r16498 def addrev(text, renamed=False):
if renamed:
timeless@mozdev.org
spelling: doesn't/does not
r17486 # data doesn't matter. Just make sure filelog.renamed() returns True
Augie Fackler
tests: port test-filelog.py to Python 3...
r37952 meta = {b'copyrev': hex(nullid), b'copy': b'bar'}
Mads Kiilerich
tests: test test-filelog is python - rename to test-filelog.py
r16498 else:
meta = {}
lock = t = None
try:
lock = repo.lock()
Augie Fackler
tests: port test-filelog.py to Python 3...
r37952 t = repo.transaction(b'commit')
Mads Kiilerich
tests: test test-filelog is python - rename to test-filelog.py
r16498 node = fl.add(text, meta, t, 0, nullid, nullid)
return node
finally:
if t:
t.close()
if lock:
lock.release()
Augie Fackler
formatting: blacken the codebase...
r43346
Mads Kiilerich
tests: test test-filelog is python - rename to test-filelog.py
r16498 def error(text):
Robert Stanca
py3: use print_function in test-filelog.py
r28744 print('ERROR: ' + text)
Mads Kiilerich
tests: test test-filelog is python - rename to test-filelog.py
r16498
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
tests: port test-filelog.py to Python 3...
r37952 textwith = b'\1\nfoo'
without = b'foo'
Mads Kiilerich
tests: test test-filelog is python - rename to test-filelog.py
r16498
node = addrev(textwith)
if not textwith == fl.read(node):
error('filelog.read for data starting with \\1\\n')
if fl.cmp(node, textwith) or not fl.cmp(node, without):
error('filelog.cmp for data starting with \\1\\n')
if fl.size(0) != len(textwith):
Augie Fackler
formatting: blacken the codebase...
r43346 error(
'FIXME: This is a known failure of filelog.size for data starting '
'with \\1\\n'
)
Mads Kiilerich
tests: test test-filelog is python - rename to test-filelog.py
r16498
node = addrev(textwith, renamed=True)
if not textwith == fl.read(node):
error('filelog.read for a renaming + data starting with \\1\\n')
if fl.cmp(node, textwith) or not fl.cmp(node, without):
error('filelog.cmp for a renaming + data starting with \\1\\n')
if fl.size(1) != len(textwith):
error('filelog.size for a renaming + data starting with \\1\\n')
Robert Stanca
py3: use print_function in test-filelog.py
r28744 print('OK.')