##// END OF EJS Templates
check-code: stop forbidding return code result...
check-code: stop forbidding return code result There is no explication of what is the intend of that check and what is the alternative. I suspect this comes from the transition to the "unified test" format circa 2010. With the non zero return explicitly listed in the output explicit $? checking became Redundant. However there is valid use case for checking $? so I am dropping this check. Differential Revision: https://phab.mercurial-scm.org/D10994

File last commit:

r47758:07b9ebea default
r48293:9b1710c5 default
Show More
test-filelog.py
65 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
Joerg Sonnenberger
node: replace nullid and friends with nodeconstants class...
r47771 from mercurial.node import hex
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
Joerg Sonnenberger
node: replace nullid and friends with nodeconstants class...
r47771 meta = {b'copyrev': hex(repo.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')
Joerg Sonnenberger
node: replace nullid and friends with nodeconstants class...
r47771 node = fl.add(text, meta, t, 0, repo.nullid, repo.nullid)
Mads Kiilerich
tests: test test-filelog is python - rename to test-filelog.py
r16498 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.')