~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_repository/test_commit_builder.py

  • Committer: Andrew Bennetts
  • Date: 2010-08-17 06:45:33 UTC
  • mfrom: (5050.17.9 2.2)
  • mto: This revision was merged to the branch mainline in revision 5379.
  • Revision ID: andrew.bennetts@canonical.com-20100817064533-kof2i2f3r6mr4ayb
Merge lp:bzr/2.2 into lp:bzr, including fixes for #192859, #224373, #300062, #585667, #614404, #617503.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1303
1303
        self.addCleanup(repo_local.unlock)
1304
1304
        self.assertRaises(errors.BzrError, repo_local.get_commit_builder,
1305
1305
            branch, [], branch.get_config())
 
1306
 
 
1307
    def test_committer_no_username(self):
 
1308
        # Ensure that when no username is available but a committer is
 
1309
        # supplied, commit works.
 
1310
        del os.environ['EMAIL']
 
1311
        tree = self.make_branch_and_tree(".")
 
1312
        tree.lock_write()
 
1313
        try:
 
1314
            # Make sure no username is available.
 
1315
            self.assertRaises(errors.NoWhoami, tree.branch.get_commit_builder,
 
1316
                              [])
 
1317
            builder = tree.branch.get_commit_builder(
 
1318
                [], committer='me@example.com')
 
1319
            try:
 
1320
                list(builder.record_iter_changes(tree, tree.last_revision(),
 
1321
                    tree.iter_changes(tree.basis_tree())))
 
1322
                builder.finish_inventory()
 
1323
            except:
 
1324
                builder.abort()
 
1325
                raise
 
1326
            repo = tree.branch.repository
 
1327
            repo.commit_write_group()
 
1328
        finally:
 
1329
            tree.unlock()