~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commit.py

  • Committer: Patch Queue Manager
  • Date: 2015-10-05 13:45:00 UTC
  • mfrom: (6603.3.1 bts794146)
  • Revision ID: pqm@pqm.ubuntu.com-20151005134500-v244rho557tv0ukd
(vila) Resolve Bug #1480015: Test failure: hexify removed from paramiko
 (Andrew Starr-Bochicchio) (Andrew Starr-Bochicchio)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2012, 2016 Canonical Ltd
 
1
# Copyright (C) 2005-2011 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
90
90
        with file('hello', 'w') as f: f.write('version 2')
91
91
        rev2 = wt.commit(message='commit 2')
92
92
 
93
 
        eq = self.assertEqual
 
93
        eq = self.assertEquals
94
94
        eq(b.revno(), 2)
95
95
        rev = b.repository.get_revision(rev1)
96
96
        eq(rev.message, 'add hello')
114
114
        with file('hello', 'w') as f: f.write('hello world')
115
115
        wt.add('hello')
116
116
        revid = wt.commit(message='add hello', rev_id='revid', lossy=True)
117
 
        self.assertEqual('revid', revid)
 
117
        self.assertEquals('revid', revid)
118
118
 
119
119
    def test_commit_lossy_foreign(self):
120
120
        """Attempt a lossy commit to a foreign branch."""
126
126
        wt.add('hello')
127
127
        revid = wt.commit(message='add hello', lossy=True,
128
128
            timestamp=1302659388, timezone=0)
129
 
        self.assertEqual('dummy-v1:1302659388.0-0-UNKNOWN', revid)
 
129
        self.assertEquals('dummy-v1:1302659388.0-0-UNKNOWN', revid)
130
130
 
131
131
    def test_commit_bound_lossy_foreign(self):
132
132
        """Attempt a lossy commit to a bzr branch bound to a foreign branch."""
139
139
        wt.add('hello')
140
140
        revid = wt.commit(message='add hello', lossy=True,
141
141
            timestamp=1302659388, timezone=0)
142
 
        self.assertEqual('dummy-v1:1302659388.0-0-0', revid)
143
 
        self.assertEqual('dummy-v1:1302659388.0-0-0',
 
142
        self.assertEquals('dummy-v1:1302659388.0-0-0', revid)
 
143
        self.assertEquals('dummy-v1:1302659388.0-0-0',
144
144
            foreign_branch.last_revision())
145
 
        self.assertEqual('dummy-v1:1302659388.0-0-0',
 
145
        self.assertEquals('dummy-v1:1302659388.0-0-0',
146
146
            wt.branch.last_revision())
147
147
 
148
148
    def test_missing_commit(self):
156
156
        os.remove('hello')
157
157
        reporter = CapturingReporter()
158
158
        wt.commit('removed hello', rev_id='rev2', reporter=reporter)
159
 
        self.assertEqual(
 
159
        self.assertEquals(
160
160
            [('missing', u'hello'), ('deleted', u'hello')],
161
161
            reporter.calls)
162
162
 
190
190
        with file('hello', 'w') as f: f.write('hello')
191
191
        wt.add(['hello'])
192
192
        wt.commit(message='add hello')
193
 
        self.assertEqual(b.revno(), 1)
 
193
        self.assertEquals(b.revno(), 1)
194
194
        self.assertRaises(PointlessCommit,
195
195
                          wt.commit,
196
196
                          message='fails',
197
197
                          allow_pointless=False)
198
 
        self.assertEqual(b.revno(), 1)
 
198
        self.assertEquals(b.revno(), 1)
199
199
 
200
200
    def test_commit_empty(self):
201
201
        """Commiting an empty tree works."""
207
207
                          message='empty tree',
208
208
                          allow_pointless=False)
209
209
        wt.commit(message='empty tree', allow_pointless=True)
210
 
        self.assertEqual(b.revno(), 2)
 
210
        self.assertEquals(b.revno(), 2)
211
211
 
212
212
    def test_selective_delete(self):
213
213
        """Selective commit in tree with deletions"""
232
232
                 allow_pointless=False,
233
233
                 rev_id='test@rev-3')
234
234
 
235
 
        eq = self.assertEqual
 
235
        eq = self.assertEquals
236
236
        eq(b.revno(), 3)
237
237
 
238
238
        tree2 = b.repository.revision_tree('test@rev-2')
239
239
        tree2.lock_read()
240
240
        self.addCleanup(tree2.unlock)
241
241
        self.assertTrue(tree2.has_filename('hello'))
242
 
        self.assertEqual(tree2.get_file_text('hello-id'), 'hello')
243
 
        self.assertEqual(tree2.get_file_text('buongia-id'), 'new text')
 
242
        self.assertEquals(tree2.get_file_text('hello-id'), 'hello')
 
243
        self.assertEquals(tree2.get_file_text('buongia-id'), 'new text')
244
244
 
245
245
        tree3 = b.repository.revision_tree('test@rev-3')
246
246
        tree3.lock_read()
247
247
        self.addCleanup(tree3.unlock)
248
248
        self.assertFalse(tree3.has_filename('hello'))
249
 
        self.assertEqual(tree3.get_file_text('buongia-id'), 'new text')
 
249
        self.assertEquals(tree3.get_file_text('buongia-id'), 'new text')
250
250
 
251
251
    def test_commit_rename(self):
252
252
        """Test commit of a revision where a file is renamed."""
259
259
        tree.rename_one('hello', 'fruity')
260
260
        tree.commit(message='renamed', rev_id='test@rev-2', allow_pointless=False)
261
261
 
262
 
        eq = self.assertEqual
 
262
        eq = self.assertEquals
263
263
        tree1 = b.repository.revision_tree('test@rev-1')
264
264
        tree1.lock_read()
265
265
        self.addCleanup(tree1.unlock)
290
290
 
291
291
    def test_commit_move(self):
292
292
        """Test commit of revisions with moved files and directories"""
293
 
        eq = self.assertEqual
 
293
        eq = self.assertEquals
294
294
        wt = self.make_branch_and_tree('.')
295
295
        b = wt.branch
296
296
        r1 = 'test@rev-1'
489
489
        wt = self.make_branch_and_tree('.')
490
490
        c = Commit()
491
491
        c.commit(working_tree=wt, message='empty tree', allow_pointless=True)
492
 
        self.assertEqual(wt.branch.revno(), 1)
 
492
        self.assertEquals(wt.branch.revno(), 1)
493
493
        self.assertEqual({},
494
494
                         wt.branch.repository.get_revision(
495
495
                            wt.branch.last_revision()).properties)