Rev 3112: (Lukáš Lalinský) Fix traceback in 'bzr send' outside of a branch, (bug #176300) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Dec 14 14:30:31 GMT 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3112
revision-id:pqm at pqm.ubuntu.com-20071214143021-aus9m0gqj1u9gr7n
parent: pqm at pqm.ubuntu.com-20071214084717-xu119wq2x8l2w8lj
parent: lalinsky at gmail.com-20071130211018-j2w4oxlej3x8qocx
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2007-12-14 14:30:21 +0000
message:
(Lukáš Lalinský) Fix traceback in 'bzr send' outside of a branch, (bug #176300)
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/tests/blackbox/test_send.py test_bundle.py-20060616222707-c21c8b7ea5ef57b1
------------------------------------------------------------
revno: 3060.2.1
revision-id:lalinsky at gmail.com-20071130211018-j2w4oxlej3x8qocx
parent: pqm at pqm.ubuntu.com-20071130182102-i0t564k01anm7uk2
committer: Lukáš Lalinský <lalinsky at gmail.com>
branch nick: send-unlock
timestamp: Fri 2007-11-30 22:10:18 +0100
message:
Fix misplaced branch lock in cmd_send.
The branch should be opened and locked outside of the try/finally block, othewise we get an UnboundLocalError exception in "finally" if Branch.open_containing failed.
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/tests/blackbox/test_send.py test_bundle.py-20060616222707-c21c8b7ea5ef57b1
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2007-12-11 17:51:18 +0000
+++ b/bzrlib/builtins.py 2007-12-14 14:30:21 +0000
@@ -4026,17 +4026,17 @@
def _run(self, submit_branch, revision, public_branch, remember, format,
no_bundle, no_patch, output, from_, mail_to, message):
from bzrlib.revision import NULL_REVISION
+ branch = Branch.open_containing(from_)[0]
if output is None:
outfile = StringIO()
elif output == '-':
outfile = self.outf
else:
outfile = open(output, 'wb')
+ # we may need to write data into branch's repository to calculate
+ # the data to send.
+ branch.lock_write()
try:
- branch = Branch.open_containing(from_)[0]
- # we may need to write data into branch's repository to calculate
- # the data to send.
- branch.lock_write()
if output is None:
config = branch.get_config()
if mail_to is None:
=== modified file 'bzrlib/tests/blackbox/test_send.py'
--- a/bzrlib/tests/blackbox/test_send.py 2007-11-28 17:27:10 +0000
+++ b/bzrlib/tests/blackbox/test_send.py 2007-11-30 21:10:18 +0000
@@ -17,6 +17,7 @@
import os
+import sys
from StringIO import StringIO
from bzrlib import (
@@ -236,3 +237,12 @@
'grandparent'])
self.assertEqual('revision1', md.base_revision_id)
self.assertEqual('revision3', md.revision_id)
+
+ def test_nonexistant_branch(self):
+ if sys.platform == "win32":
+ location = "C:/i/do/not/exist/"
+ else:
+ location = "/i/do/not/exist/"
+ out, err = self.run_bzr(["send", "--from", location], retcode=3)
+ self.assertEqual(out, '')
+ self.assertEqual(err, 'bzr: ERROR: Not a branch: "%s".\n' % location)
More information about the bazaar-commits
mailing list