##// END OF EJS Templates
revlog: subclass the new `repository.iverifyproblem` Protocol class...
revlog: subclass the new `repository.iverifyproblem` Protocol class This is the same transformation as 3a90a6fd710d did for dirstate, but the CamelCase naming was already cleaned up here. We shouldn't have to explicitly subclass, but I'm doing so to test the interplay of regular attributes and the `attrs` class. Also, PyCharm has a nifty feature that puts a jump point in the gutter to navigate back and forth between the base class and subclasses (and override functions and base class functions) when there's an explicit subclassing. Additionally, PyCharm will immediately flag signature mismatches without a 40m pytype run.

File last commit:

r50934:7b289a70 default
r53365:4ef6dbc2 default
Show More
test-revlog-ancestry.py
94 lines | 1.9 KiB | text/x-python | PythonLexer
/ tests / test-revlog-ancestry.py
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872 import os
Robert Stanca
py3: use absolute_import in test-revlog-ancestry.py
r28763 from mercurial import (
hg,
merge,
Yuya Nishihara
tests: alias ui as uimod in test-revlog-ancestry/test-ui-verbosity
r28842 ui as uimod,
Robert Stanca
py3: use absolute_import in test-revlog-ancestry.py
r28763 )
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
Yuya Nishihara
ui: factor out ui.load() to create a ui without loading configs (API)...
r30559 u = uimod.ui.load()
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
Pulkit Goyal
py3: add b'' prefixes in tests/test-revlog-ancestry.py...
r36500 repo = hg.repository(u, b'test1', create=1)
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872 os.chdir('test1')
Augie Fackler
formatting: blacken the codebase...
r43346
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872 def commit(text, time):
Pulkit Goyal
py3: add b'' prefixes in tests/test-revlog-ancestry.py...
r36500 repo.commit(text=text, date=b"%d 0" % time)
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
Augie Fackler
formatting: blacken the codebase...
r43346
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872 def addcommit(name, time):
Pulkit Goyal
py3: make sure we open the file in bytes mode...
r36501 f = open(name, 'wb')
Pulkit Goyal
py3: add b'' prefixes in tests/test-revlog-ancestry.py...
r36500 f.write(b'%s\n' % name)
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872 f.close()
dirstate: use wlock and changing_files context in `test-revlog-ancestry`...
r50934 with repo.wlock():
with repo.dirstate.changing_files(repo):
repo[None].add([name])
commit(name, time)
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
Augie Fackler
formatting: blacken the codebase...
r43346
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872 def update(rev):
Martin von Zweigbergk
tests: use new, use-case-specific methods from merge module...
r44884 merge.clean_update(repo[rev])
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
Augie Fackler
formatting: blacken the codebase...
r43346
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872 def merge_(rev):
Martin von Zweigbergk
tests: use new, use-case-specific methods from merge module...
r44884 merge.merge(repo[rev])
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
Augie Fackler
formatting: blacken the codebase...
r43346
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872 if __name__ == '__main__':
Pulkit Goyal
py3: add b'' prefixes in tests/test-revlog-ancestry.py...
r36500 addcommit(b"A", 0)
addcommit(b"B", 1)
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
update(0)
Pulkit Goyal
py3: add b'' prefixes in tests/test-revlog-ancestry.py...
r36500 addcommit(b"C", 2)
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
merge_(1)
Pulkit Goyal
py3: add b'' prefixes in tests/test-revlog-ancestry.py...
r36500 commit(b"D", 3)
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
update(2)
Pulkit Goyal
py3: add b'' prefixes in tests/test-revlog-ancestry.py...
r36500 addcommit(b"E", 4)
addcommit(b"F", 5)
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
update(3)
Pulkit Goyal
py3: add b'' prefixes in tests/test-revlog-ancestry.py...
r36500 addcommit(b"G", 6)
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
merge_(5)
Pulkit Goyal
py3: add b'' prefixes in tests/test-revlog-ancestry.py...
r36500 commit(b"H", 7)
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
update(5)
Pulkit Goyal
py3: add b'' prefixes in tests/test-revlog-ancestry.py...
r36500 addcommit(b"I", 8)
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
# Ancestors
Robert Stanca
py3: use print_function in test-revlog-ancestry.py
r28764 print('Ancestors of 5')
Bryan O'Sullivan
revlog: ancestors(*revs) becomes ancestors(revs) (API)...
r16866 for r in repo.changelog.ancestors([5]):
Robert Stanca
py3: use print_function in test-revlog-ancestry.py
r28764 print(r, end=' ')
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
Robert Stanca
py3: use print_function in test-revlog-ancestry.py
r28764 print('\nAncestors of 6 and 5')
Bryan O'Sullivan
revlog: ancestors(*revs) becomes ancestors(revs) (API)...
r16866 for r in repo.changelog.ancestors([6, 5]):
Robert Stanca
py3: use print_function in test-revlog-ancestry.py
r28764 print(r, end=' ')
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
Robert Stanca
py3: use print_function in test-revlog-ancestry.py
r28764 print('\nAncestors of 5 and 4')
Bryan O'Sullivan
revlog: ancestors(*revs) becomes ancestors(revs) (API)...
r16866 for r in repo.changelog.ancestors([5, 4]):
Robert Stanca
py3: use print_function in test-revlog-ancestry.py
r28764 print(r, end=' ')
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
Robert Stanca
py3: use print_function in test-revlog-ancestry.py
r28764 print('\nAncestors of 7, stop at 6')
Joshua Redstone
revlog: add optional stoprev arg to revlog.ancestors()...
r16868 for r in repo.changelog.ancestors([7], 6):
Robert Stanca
py3: use print_function in test-revlog-ancestry.py
r28764 print(r, end=' ')
Joshua Redstone
revlog: add optional stoprev arg to revlog.ancestors()...
r16868
Robert Stanca
py3: use print_function in test-revlog-ancestry.py
r28764 print('\nAncestors of 7, including revs')
Siddharth Agarwal
revlog.ancestors: add support for including revs...
r18081 for r in repo.changelog.ancestors([7], inclusive=True):
Robert Stanca
py3: use print_function in test-revlog-ancestry.py
r28764 print(r, end=' ')
Siddharth Agarwal
revlog.ancestors: add support for including revs...
r18081
Robert Stanca
py3: use print_function in test-revlog-ancestry.py
r28764 print('\nAncestors of 7, 5 and 3, including revs')
Siddharth Agarwal
revlog.ancestors: add support for including revs...
r18081 for r in repo.changelog.ancestors([7, 5, 3], inclusive=True):
Robert Stanca
py3: use print_function in test-revlog-ancestry.py
r28764 print(r, end=' ')
Siddharth Agarwal
revlog.ancestors: add support for including revs...
r18081
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872 # Descendants
Robert Stanca
py3: use print_function in test-revlog-ancestry.py
r28764 print('\n\nDescendants of 5')
Bryan O'Sullivan
revlog: descendants(*revs) becomes descendants(revs) (API)...
r16867 for r in repo.changelog.descendants([5]):
Robert Stanca
py3: use print_function in test-revlog-ancestry.py
r28764 print(r, end=' ')
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
Robert Stanca
py3: use print_function in test-revlog-ancestry.py
r28764 print('\nDescendants of 5 and 3')
Bryan O'Sullivan
revlog: descendants(*revs) becomes descendants(revs) (API)...
r16867 for r in repo.changelog.descendants([5, 3]):
Robert Stanca
py3: use print_function in test-revlog-ancestry.py
r28764 print(r, end=' ')
Stefano Tortarolo
Add ancestors and descendants to revlog...
r6872
Robert Stanca
py3: use print_function in test-revlog-ancestry.py
r28764 print('\nDescendants of 5 and 4')
print(*repo.changelog.descendants([5, 4]), sep=' ')