~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commit.py

  • Committer: Vincent Ladeuil
  • Date: 2011-11-24 15:48:29 UTC
  • mfrom: (6289 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6337.
  • Revision ID: v.ladeuil+lp@free.fr-20111124154829-avowjpsxdl8yp2vz
merge trunk resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    LockContention,
34
34
    )
35
35
from bzrlib.tests import (
36
 
    SymlinkFeature,
37
36
    TestCaseWithTransport,
38
37
    test_foreign,
39
38
    )
 
39
from bzrlib.tests.features import (
 
40
    SymlinkFeature,
 
41
    )
40
42
from bzrlib.tests.matchers import MatchesAncestry
41
43
 
42
44
 
88
90
        b = wt.branch
89
91
        file('hello', 'w').write('hello world')
90
92
        wt.add('hello')
91
 
        wt.commit(message='add hello')
 
93
        rev1 = wt.commit(message='add hello')
92
94
        file_id = wt.path2id('hello')
93
95
 
94
96
        file('hello', 'w').write('version 2')
95
 
        wt.commit(message='commit 2')
 
97
        rev2 = wt.commit(message='commit 2')
96
98
 
97
99
        eq = self.assertEquals
98
100
        eq(b.revno(), 2)
99
 
        rh = b.revision_history()
100
 
        rev = b.repository.get_revision(rh[0])
 
101
        rev = b.repository.get_revision(rev1)
101
102
        eq(rev.message, 'add hello')
102
103
 
103
 
        tree1 = b.repository.revision_tree(rh[0])
 
104
        tree1 = b.repository.revision_tree(rev1)
104
105
        tree1.lock_read()
105
106
        text = tree1.get_file_text(file_id)
106
107
        tree1.unlock()
107
108
        self.assertEqual('hello world', text)
108
109
 
109
 
        tree2 = b.repository.revision_tree(rh[1])
 
110
        tree2 = b.repository.revision_tree(rev2)
110
111
        tree2.lock_read()
111
112
        text = tree2.get_file_text(file_id)
112
113
        tree2.unlock()
159
160
        wt.commit(message='add hello')
160
161
 
161
162
        os.remove('hello')
162
 
        wt.commit('removed hello', rev_id='rev2')
 
163
        reporter = CapturingReporter()
 
164
        wt.commit('removed hello', rev_id='rev2', reporter=reporter)
 
165
        self.assertEquals(
 
166
            [('missing', u'hello'), ('deleted', u'hello')],
 
167
            reporter.calls)
163
168
 
164
169
        tree = b.repository.revision_tree('rev2')
165
170
        self.assertFalse(tree.has_id('hello-id'))
359
364
            rev_ids.append(rev_id)
360
365
            wt.commit(message='rev %d' % (i+1),
361
366
                     rev_id=rev_id)
362
 
        eq = self.assertEquals
363
 
        eq(b.revision_history(), rev_ids)
364
367
        for i in range(4):
365
368
            self.assertThat(rev_ids[:i+1],
366
369
                MatchesAncestry(b.repository, rev_ids[i]))
459
462
                              rev_id='B',
460
463
                              working_tree=wt)
461
464
            branch = Branch.open(self.get_url('.'))
462
 
            self.assertEqual(branch.revision_history(), ['A'])
 
465
            self.assertEqual(branch.last_revision(), 'A')
463
466
            self.assertFalse(branch.repository.has_revision('B'))
464
467
        finally:
465
468
            bzrlib.gpg.GPGStrategy = oldstrategy