Rev 2488: Better error for selected-file commit of merges in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Mon May 21 16:24:58 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2488
revision-id: pqm at pqm.ubuntu.com-20070521152446-1v1dk0m7c705cdlx
parent: pqm at pqm.ubuntu.com-20070517174205-qwgn733pkui2xqr4
parent: aaron.bentley at utoronto.ca-20070521141436-x3aw0x8tksw2yu0e
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2007-05-21 16:24:46 +0100
message:
Better error for selected-file commit of merges
modified:
bzrlib/commit.py commit.py-20050511101309-79ec1a0168e0e825
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/tests/test_commit.py test_commit.py-20050914060732-279f057f8c295434
------------------------------------------------------------
revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.9
merged: aaron.bentley at utoronto.ca-20070521141436-x3aw0x8tksw2yu0e
parent: aaron.bentley at utoronto.ca-20070521140910-ugock53or9q2ki8g
committer: Aaron Bentley <aaron.bentley at utoronto.ca>
branch nick: Aaron's mergeable stuff
timestamp: Mon 2007-05-21 10:14:36 -0400
message:
Better error for selected-file commit of merges
------------------------------------------------------------
revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.8
merged: aaron.bentley at utoronto.ca-20070521140910-ugock53or9q2ki8g
parent: aaron.bentley at utoronto.ca-20070420114824-jd5kfyku8qeyv844
parent: pqm at pqm.ubuntu.com-20070517174205-qwgn733pkui2xqr4
committer: Aaron Bentley <aaron.bentley at utoronto.ca>
branch nick: Aaron's mergeable stuff
timestamp: Mon 2007-05-21 10:09:10 -0400
message:
Merge bzr.dev
=== modified file 'bzrlib/commit.py'
--- a/bzrlib/commit.py 2007-05-17 15:07:49 +0000
+++ b/bzrlib/commit.py 2007-05-21 14:14:36 +0000
@@ -299,8 +299,7 @@
self._gather_parents()
if len(self.parents) > 1 and self.specific_files:
- raise NotImplementedError('selected-file commit of merges is not supported yet: files %r',
- self.specific_files)
+ raise errors.CannotCommitSelectedFileMerge(self.specific_files)
self.builder = self.branch.get_commit_builder(self.parents,
self.config, timestamp, timezone, committer, revprops, rev_id)
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py 2007-04-26 09:07:38 +0000
+++ b/bzrlib/errors.py 2007-05-21 14:14:36 +0000
@@ -845,6 +845,16 @@
_fmt = "No changes to commit"
+class CannotCommitSelectedFileMerge(BzrError):
+
+ _fmt = 'Selected-file commit of merges is not supported yet:'\
+ ' files %(files_str)s'
+
+ def __init__(self, files):
+ files_str = ', '.join(files)
+ BzrError.__init__(self, files=files, files_str=files_str)
+
+
class UpgradeReadonly(BzrError):
_fmt = "Upgrade URL cannot work with readonly URLs."
=== modified file 'bzrlib/tests/test_commit.py'
--- a/bzrlib/tests/test_commit.py 2007-03-07 19:33:08 +0000
+++ b/bzrlib/tests/test_commit.py 2007-05-21 14:14:36 +0000
@@ -681,3 +681,17 @@
repository.add_inventory = raise_
self.assertRaises(errors.NoSuchFile, tree.commit, message_callback=cb)
self.assertFalse(cb.called)
+
+ def test_selected_file_merge_commit(self):
+ """Ensure the correct error is raised"""
+ tree = self.make_branch_and_tree('foo')
+ # pending merge would turn into a left parent
+ tree.commit('commit 1')
+ tree.add_parent_tree_id('example')
+ self.build_tree(['foo/bar', 'foo/baz'])
+ tree.add(['bar', 'baz'])
+ err = self.assertRaises(errors.CannotCommitSelectedFileMerge,
+ tree.commit, 'commit 2', specific_files=['bar', 'baz'])
+ self.assertEqual(['bar', 'baz'], err.files)
+ self.assertEqual('Selected-file commit of merges is not supported'
+ ' yet: files bar, baz', str(err))
More information about the bazaar-commits
mailing list