##// END OF EJS Templates
branching: merge default into stable...
branching: merge default into stable This mark the start of the 5.9 freeze.

File last commit:

r48294:23f5ed6d default
r48559:d7515d29 merge 5.9rc0 stable
Show More
test-filelog.py
65 lines | 1.6 KiB | text/x-python | PythonLexer
run-tests: stop writing a `python3` symlink pointing to python2...
r48294 #!/usr/bin/env python
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.')