| 1 |
|
| 2 |
|
| 3 |
om> |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
from breezy.tests import TestCase, TestCaseWithTransport |
| 20 |
from PyQt5 import QtCore |
| 21 |
|
| 22 |
from breezy.plugins.qbrz.lib import tests as qtests |
| 23 |
from breezy.plugins.qbrz.lib.logmodel import (LogModel, GraphVizLoader) |
| 24 |
from breezy.plugins.qbrz.lib.loggraphviz import BranchInfo |
| 25 |
from breezy.plugins.qbrz.lib.util import ThrobberWidget |
| 26 |
|
| 27 |
from breezy.plugins.qbrz.lib.tests.modeltest import ModelTest |
| 28 |
|
| 29 |
|
| 30 |
class TestModel(qtests.QTestCase): |
| 31 |
|
| 32 |
def _test(self, wt): |
| 33 |
def processEvents(): |
| 34 |
pass |
| 35 |
throbber = ThrobberWidget(None) |
| 36 |
log_model = LogModel(processEvents, throbber) |
| 37 |
modeltest = ModelTest(log_model, None) |
| 38 |
bi = BranchInfo('', wt, wt.branch) |
| 39 |
log_model.load((bi,), bi, None, False, GraphVizLoader) |
| 40 |
|
| 41 |
def test_empty_branch(self): |
| 42 |
wt = self.make_branch_and_tree('.') |
| 43 |
self._test(wt) |
| 44 |
|
| 45 |
|
| 46 |
def _prepare_tree_with_merges(self, with_tags=False): |
| 47 |
wt = self.make_branch_and_memory_tree('.') |
| 48 |
wt.lock_write() |
| 49 |
self.addCleanup(wt.unlock) |
| 50 |
wt.add('') |
| 51 |
wt.commit('rev-1', rev_id=b'rev-1', timestamp=1132586655, timezone=36000, committer='Joe Foo <[email protected]>') |
| 52 |
wt.commit('rev-merged', rev_id=b'rev-2a', timestamp=1132586700, timezone=36000, committer='Joe Foo <[email protected]>') |
| 53 |
wt.set_parent_ids([b'rev-1', b'rev-2a']) |
| 54 |
wt.branch.set_last_revision_info(1, b'rev-1') |
| 55 |
wt.commit('rev-2', rev_id=b'rev-2b', timestamp=1132586800, timezone=36000, committer='Joe Foo <[email protected]>') |
| 56 |
if with_tags: |
| 57 |
branch = wt.branch |
| 58 |
branch.tags.set_tag('v0.2', b'rev-2b') |
| 59 |
wt.commit('rev-3', rev_id=b'rev-3', imestamp=1132586900, timezone=36000, committer='Jane Foo <[email protected]>') |
| 60 |
branch.tags.set_tag('v1.0rc1', b'rev-3') |
| 61 |
branch.tags.set_tag('v1.0', b'rev-3') |
| 62 |
return wt |
| 63 |
|
| 64 |
def test_merges(self): |
| 65 |
wt = self._prepare_tree_with_merges() |
| 66 |
self._test(wt) |