~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_revision.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-10-05 21:15:13 UTC
  • mfrom: (5448.3.5 374700-Add-gnu-lsh-support)
  • Revision ID: pqm@pqm.ubuntu.com-20101005211513-whouyj5t7oo92gmq
(gz) Add support for GNU lsh as a secure shell client (Matthew Gordon)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011, 2016 Canonical Ltd
 
1
# Copyright (C) 2005 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
 
18
import os
18
19
import warnings
19
20
 
20
21
from bzrlib import (
21
22
    bugtracker,
22
23
    revision,
 
24
    symbol_versioning,
23
25
    )
 
26
from bzrlib.branch import Branch
24
27
from bzrlib.errors import (
25
28
    InvalidBugStatus,
26
29
    InvalidLineInBugsProperty,
 
30
    NoSuchRevision,
27
31
    )
28
 
from bzrlib.revision import NULL_REVISION
 
32
from bzrlib.deprecated_graph import Graph
 
33
from bzrlib.revision import (find_present_ancestors,
 
34
                             NULL_REVISION)
29
35
from bzrlib.tests import TestCase, TestCaseWithTransport
30
 
from bzrlib.tests.matchers import MatchesAncestry
 
36
from bzrlib.trace import mutter
 
37
from bzrlib.workingtree import WorkingTree
31
38
 
32
39
# We're allowed to test deprecated interfaces
33
40
warnings.filterwarnings('ignore',
66
73
    br2 = tree2.branch
67
74
    tree2.commit("Commit four", rev_id="b@u-0-3")
68
75
    tree2.commit("Commit five", rev_id="b@u-0-4")
69
 
    self.assertEqual(br2.last_revision(), 'b@u-0-4')
 
76
    revisions_2 = br2.revision_history()
 
77
    self.assertEquals(revisions_2[-1], 'b@u-0-4')
70
78
 
71
79
    tree1.merge_from_branch(br2)
72
80
    tree1.commit("Commit six", rev_id="a@u-0-3")
73
81
    tree1.commit("Commit seven", rev_id="a@u-0-4")
74
82
    tree2.commit("Commit eight", rev_id="b@u-0-5")
75
 
    self.assertEqual(br2.last_revision(), 'b@u-0-5')
 
83
    self.assertEquals(br2.revision_history()[-1], 'b@u-0-5')
76
84
 
77
85
    tree1.merge_from_branch(br2)
78
86
    tree1.commit("Commit nine", rev_id="a@u-0-5")
79
87
    # DO NOT MERGE HERE - we WANT a GHOST.
80
 
    br1.lock_read()
81
 
    try:
82
 
        graph = br1.repository.get_graph()
83
 
        revhistory = list(graph.iter_lefthand_ancestry(br1.last_revision(),
84
 
            [revision.NULL_REVISION]))
85
 
        revhistory.reverse()
86
 
    finally:
87
 
        br1.unlock()
88
 
    tree2.add_parent_tree_id(revhistory[4])
 
88
    tree2.add_parent_tree_id(br1.revision_history()[4])
89
89
    tree2.commit("Commit ten - ghost merge", rev_id="b@u-0-6")
90
90
 
91
91
    return br1, br2
111
111
             ('a@u-0-5', ['a@u-0-0', 'a@u-0-1', 'a@u-0-2', 'a@u-0-3', 'a@u-0-4',
112
112
                          'b@u-0-3', 'b@u-0-4',
113
113
                          'b@u-0-5', 'a@u-0-5']),
114
 
             ('b@u-0-6', ['a@u-0-0', 'a@u-0-1', 'a@u-0-2', 'a@u-0-4',
 
114
             ('b@u-0-6', ['a@u-0-0', 'a@u-0-1', 'a@u-0-2',
115
115
                          'b@u-0-3', 'b@u-0-4',
116
116
                          'b@u-0-5', 'b@u-0-6']),
117
117
             ]
123
123
                    continue
124
124
                if rev_id in br2_only and not branch is br2:
125
125
                    continue
126
 
                self.assertThat(anc,
127
 
                    MatchesAncestry(branch.repository, rev_id))
 
126
                mutter('ancestry of {%s}: %r',
 
127
                       rev_id, branch.repository.get_ancestry(rev_id))
 
128
                result = sorted(branch.repository.get_ancestry(rev_id))
 
129
                self.assertEquals(result, [None] + sorted(anc))
128
130
 
129
131
 
130
132
class TestIntermediateRevisions(TestCaseWithTransport):