Rev 5926: (jr) Give an appropriate error when merging a non-existant file (Jonathan in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri May 27 12:42:35 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5926 [merge]
revision-id: pqm at pqm.ubuntu.com-20110527124234-ckug8d7n60j1kip1
parent: pqm at pqm.ubuntu.com-20110527104800-fvcjlygvqloos6kl
parent: jriddell at canonical.com-20110527110547-u40cytf8940pq66e
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2011-05-27 12:42:34 +0000
message:
(jr) Give an appropriate error when merging a non-existant file (Jonathan
Riddell)
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2011-05-27 05:16:48 +0000
+++ b/bzrlib/builtins.py 2011-05-27 11:05:47 +0000
@@ -3836,7 +3836,10 @@
The source of the merge can be specified either in the form of a branch,
or in the form of a path to a file containing a merge directive generated
with bzr send. If neither is specified, the default is the upstream branch
- or the branch most recently merged using --remember.
+ or the branch most recently merged using --remember. The source of the
+ merge may also be specified in the form of a path to a file in another
+ branch: in this case, only the modifications to that file are merged into
+ the current working tree.
When merging from a branch, by default bzr will try to merge in all new
work from the other branch, automatically determining an appropriate base
@@ -4006,6 +4009,13 @@
self.sanity_check_merger(merger)
if (merger.base_rev_id == merger.other_rev_id and
merger.other_rev_id is not None):
+ # check if location is a nonexistent file (and not a branch) to
+ # disambiguate the 'Nothing to do'
+ if merger.interesting_files:
+ if not merger.other_tree.has_filename(
+ merger.interesting_files[0]):
+ note("merger: " + str(merger))
+ raise errors.PathsDoNotExist([location])
note('Nothing to do.')
return 0
if pull and not preview:
=== modified file 'bzrlib/tests/blackbox/test_merge.py'
--- a/bzrlib/tests/blackbox/test_merge.py 2011-05-19 08:32:55 +0000
+++ b/bzrlib/tests/blackbox/test_merge.py 2011-05-27 09:45:44 +0000
@@ -353,6 +353,17 @@
self.assertPathExists('file1')
self.assertPathDoesNotExist('file2')
+ def test_merge_nonexistent_file(self):
+ """It should not be possible to merge changes from a file which
+ does not exist."""
+ tree_a = self.make_branch_and_tree('tree_a')
+ self.build_tree_contents([('tree_a/file', 'bar\n')])
+ tree_a.add(['file'])
+ tree_a.commit('commit 1')
+ os.chdir('tree_a')
+ self.run_bzr_error(('Path\(s\) do not exist: non/existing',),
+ ['merge', 'non/existing'])
+
def pullable_branch(self):
tree_a = self.make_branch_and_tree('a')
self.build_tree_contents([('a/file', 'bar\n')])
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt 2011-05-27 10:48:00 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt 2011-05-27 11:05:47 +0000
@@ -35,6 +35,9 @@
* Reports the original error when an InvalidHttpResponse exception is
encountered to facilitate debug. (Vincent Ladeuil, #788530)
+* Reports a non-existant file error when trying to merge in a file
+ that does not exist. (Jonathan Riddell, #330063)
+
* ``UIFactory.prompt``, ``UIFactory.get_username``,
``UIFactory.get_password`` and ``UIFactory.get_boolean`` now require a
unicode prompt to be passed in. (Jelmer Vernooij, #592083)
More information about the bazaar-commits
mailing list