~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commit.py

  • Committer: John Arbash Meinel
  • Date: 2006-03-08 14:31:23 UTC
  • mfrom: (1598 +trunk)
  • mto: (1685.1.1 bzr-encoding)
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: john@arbash-meinel.com-20060308143123-448308b0db4de410
[merge] bzr.dev 1573, lots of updates

Show diffs side-by-side

added added

removed removed

Lines of Context:
178
178
        b = wt.branch
179
179
        wt.commit('initial', rev_id='test@rev-1', allow_pointless=True)
180
180
        self.assertRaises(Exception,
181
 
                          b.working_tree().commit,
 
181
                          wt.commit,
182
182
                          message='reused id',
183
183
                          rev_id='test@rev-1',
184
184
                          allow_pointless=True)
195
195
        wt.move(['hello'], 'a')
196
196
        r2 = 'test@rev-2'
197
197
        wt.commit('two', rev_id=r2, allow_pointless=False)
198
 
        self.check_inventory_shape(b.working_tree().read_working_inventory(),
 
198
        self.check_inventory_shape(wt.read_working_inventory(),
199
199
                                   ['a', 'a/hello', 'b'])
200
200
 
201
201
        wt.move(['b'], 'a')
270
270
        file('hello', 'w').write('hello world')
271
271
        wt.add('hello')
272
272
        file('goodbye', 'w').write('goodbye cruel world!')
273
 
        self.assertRaises(StrictCommitFailed, b.working_tree().commit,
 
273
        self.assertRaises(StrictCommitFailed, wt.commit,
274
274
            message='add hello but not goodbye', strict=True)
275
275
 
276
276
    def test_strict_commit_without_unknowns(self):
308
308
        wt = self.make_branch_and_tree('.')
309
309
        branch = wt.branch
310
310
        wt.commit("base", allow_pointless=True, rev_id='A')
311
 
        self.failIf(branch.repository.revision_store.has_id('A', 'sig'))
 
311
        self.failIf(branch.repository.has_signature_for_revision_id('A'))
312
312
        try:
313
313
            from bzrlib.testament import Testament
314
314
            # monkey patch gpg signing mechanism
319
319
                                                      working_tree=wt)
320
320
            self.assertEqual(Testament.from_revision(branch.repository,
321
321
                             'B').as_short_text(),
322
 
                             branch.repository.revision_store.get('B', 
323
 
                                                               'sig').read())
 
322
                             branch.repository.get_signature_text('B'))
324
323
        finally:
325
324
            bzrlib.gpg.GPGStrategy = oldstrategy
326
325
 
331
330
        wt = self.make_branch_and_tree('.')
332
331
        branch = wt.branch
333
332
        wt.commit("base", allow_pointless=True, rev_id='A')
334
 
        self.failIf(branch.repository.revision_store.has_id('A', 'sig'))
 
333
        self.failIf(branch.repository.has_signature_for_revision_id('A'))
335
334
        try:
336
335
            from bzrlib.testament import Testament
337
336
            # monkey patch gpg signing mechanism
339
338
            config = MustSignConfig(branch)
340
339
            self.assertRaises(SigningFailed,
341
340
                              commit.Commit(config=config).commit,
342
 
                              branch, "base",
 
341
                              message="base",
343
342
                              allow_pointless=True,
344
 
                              rev_id='B')
 
343
                              rev_id='B',
 
344
                              working_tree=wt)
345
345
            branch = Branch.open(self.get_url('.'))
346
346
            self.assertEqual(branch.revision_history(), ['A'])
347
 
            self.failIf(branch.repository.revision_store.has_id('B'))
 
347
            self.failIf(branch.repository.has_revision('B'))
348
348
        finally:
349
349
            bzrlib.gpg.GPGStrategy = oldstrategy
350
350
 
365
365
            self.assertEqual(['called', 'called'], calls)
366
366
        finally:
367
367
            del bzrlib.ahook
 
368
 
 
369
    def test_commit_object_doesnt_set_nick(self):
 
370
        # using the Commit object directly does not set the branch nick.
 
371
        wt = self.make_branch_and_tree('.')
 
372
        c = Commit()
 
373
        c.commit(working_tree=wt, message='empty tree', allow_pointless=True)
 
374
        self.assertEquals(wt.branch.revno(), 1)
 
375
        self.assertEqual({},
 
376
                         wt.branch.repository.get_revision(
 
377
                            wt.branch.last_revision()).properties)
 
378
 
 
379