~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testrevision.py

  • Committer: Aaron Bentley
  • Date: 2005-08-25 22:05:37 UTC
  • mto: (1092.1.42) (1185.3.4)
  • mto: This revision was merged to the branch mainline in revision 1178.
  • Revision ID: abentley@panoramicfeedback.com-20050825220537-3a8e6ffc843ad8ca
Improved intermediate revision tracer
Now, when asked, it always finds the longest lines.
It maximizes the number of revision-history lines and, secondarily, minimizes
the number of non-revision-history lines.

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
 
90
90
    def runTest(self):
91
91
        """Find intermediate revisions, without requiring history"""
 
92
        from bzrlib.errors import NotAncestor, NoSuchRevision
92
93
        assert len(self.intervene('a@u-0-0', 'a@u-0-0')) == 0
93
94
        self.assertEqual(self.intervene('a@u-0-0', 'a@u-0-1'), ['a@u-0-1'])
94
95
        self.assertEqual(self.intervene('a@u-0-0', 'a@u-0-2'), 
97
98
                         ['a@u-0-1', 'a@u-0-2', 'b@u-0-3'])
98
99
        self.assertEqual(self.intervene('b@u-0-3', 'a@u-0-3'), 
99
100
                         ['b@u-0-4', 'a@u-0-3'])
100
 
        self.assertEqual(self.intervene('a@u-0-2', 'a@u-0-3'), 
 
101
        self.assertEqual(self.intervene('a@u-0-2', 'a@u-0-3', 
 
102
                                        self.br1.revision_history()), 
101
103
                         ['a@u-0-3'])
102
104
        self.assertEqual(self.intervene('a@u-0-0', 'a@u-0-5', 
103
105
                                        self.br1.revision_history()), 
110
112
        self.assertEqual(self.intervene('a@u-0-0', 'b@u-0-5'), 
111
113
                         ['a@u-0-1', 'a@u-0-2', 'b@u-0-3', 'b@u-0-4', 
112
114
                          'b@u-0-5'])
113
 
        self.assertEqual(self.intervene('b@u-0-3', 'b@u-0-6'), 
 
115
        self.assertEqual(self.intervene('b@u-0-3', 'b@u-0-6', 
 
116
                         self.br2.revision_history()), 
114
117
                         ['b@u-0-4', 'b@u-0-5', 'b@u-0-6'])
115
118
        self.assertEqual(self.intervene('b@u-0-6', 'b@u-0-10'), 
116
 
                         ['a@u-0-6', 'b@u-0-10'])
117
 
#        self.assertEqual(self.intervene('b@u-0-6', 'b@u-0-10', 
118
 
#                                        self.br2.revision_history()), 
119
 
#                         ['b@u-0-7', 'b@u-0-8', 'b@u-0-9', 'b@u-0-10'])
 
119
                         ['b@u-0-7', 'b@u-0-8', 'b@u-0-9', 'b@u-0-10'])
 
120
        self.assertEqual(self.intervene('b@u-0-6', 'b@u-0-10', 
 
121
                                        self.br2.revision_history()), 
 
122
                         ['b@u-0-7', 'b@u-0-8', 'b@u-0-9', 'b@u-0-10'])
 
123
        self.assertRaises(NotAncestor, self.intervene, 'b@u-0-10', 'b@u-0-6', 
 
124
                          self.br2.revision_history())
 
125
        self.assertRaises(NoSuchRevision, self.intervene, 'c@u-0-10', 
 
126
                          'b@u-0-6', self.br2.revision_history())
 
127
        self.assertRaises(NoSuchRevision, self.intervene, 'b@u-0-10', 
 
128
                          'c@u-0-6', self.br2.revision_history())
120
129
 
121
130
 
122
131
class TestCommonAncestor(InTempDir):