Rev 3084: (Lukáš Lalinský) Fix bug #133782, UnboundLocalError in cmd_cat in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Dec 5 23:31:15 GMT 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3084
revision-id:pqm at pqm.ubuntu.com-20071205233104-ghmsse3nmhbnz0n1
parent: pqm at pqm.ubuntu.com-20071205212123-n97p6dmi8b4r6lah
parent: john at arbash-meinel.com-20071205225258-kn799zf3tewncv7p
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2007-12-05 23:31:04 +0000
message:
  (Lukáš Lalinský) Fix bug #133782, UnboundLocalError in cmd_cat
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_cat.py test_cat.py-20051201162916-f0937e4e19ea24b3
    ------------------------------------------------------------
    revno: 3063.4.3
    revision-id:john at arbash-meinel.com-20071205225258-kn799zf3tewncv7p
    parent: john at arbash-meinel.com-20071205224237-fswkepwc4yky19ug
    parent: pqm at pqm.ubuntu.com-20071205192943-bii0mqi650ulw5y2
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: jam-integration
    timestamp: Wed 2007-12-05 16:52:58 -0600
    message:
      [merge] bzr.dev 3080
    removed:
      index.txt                      index.txt-20071121073725-0corxykv5irjal00-1
    added:
      doc/en/quick-reference/quick-start-summary.png quickstartsummary.pn-20071203142852-hsiybkmh37q5owwe-1
    modified:
      Makefile                       Makefile-20050805140406-d96e3498bb61c5bb
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/bugtracker.py           bugtracker.py-20070410073305-vu1vu1qosjurg8kb-1
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bundle/serializer/v4.py v10.py-20070611062757-5ggj7k18s9dej0fr-1
      bzrlib/commit.py               commit.py-20050511101309-79ec1a0168e0e825
      bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/help_topics.py          help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
      bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
      bzrlib/plugins/launchpad/lp_indirect.py lp_indirect.py-20070126012204-de5rugwlt22c7u7e-1
      bzrlib/plugins/launchpad/test_lp_indirect.py test_lp_indirect.py-20070126002743-oyle362tzv9cd8mi-1
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
      bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
      bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
      bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
      bzrlib/tests/branch_implementations/test_pull.py test_pull.py-20060410103942-83c35b26657414fc
      bzrlib/tests/test_bugtracker.py test_bugtracker.py-20070410073305-vu1vu1qosjurg8kb-2
      bzrlib/tests/test_config.py    testconfig.py-20051011041908-742d0c15d8d8c8eb
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
      bzrlib/tests/test_log.py       testlog.py-20050728115707-1a514809d7d49309
      bzrlib/tests/test_merge.py     testmerge.py-20050905070950-c1b5aa49ff911024
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      bzrlib/transport/ssh.py        ssh.py-20060824042150-0s9787kng6zv1nwq-1
      bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
      bzrlib/versionedfile.py        versionedfile.py-20060222045106-5039c71ee3b65490
      doc/en/quick-reference/quick-start-summary.svg quickstartsummary.sv-20070813143223-5i7bgw7w8s7l3ae2-3
      doc/en/user-guide/bug_trackers.txt bug_trackers.txt-20070713223459-khxdlcudraii95uv-1
      doc/en/user-guide/core_concepts.txt core_concepts.txt-20071114035000-q36a9h57ps06uvnl-2
      doc/en/user-guide/introducing_bazaar.txt introducing_bazaar.t-20071114035000-q36a9h57ps06uvnl-5
      doc/en/user-guide/merging_changes.txt merging_changes.txt-20071122141511-0knao2lklsdsvb1q-3
      doc/en/user-guide/resolving_conflicts.txt resolving_conflicts.-20071122141511-0knao2lklsdsvb1q-5
      doc/en/user-guide/reusing_a_checkout.txt reusing_a_checkout.t-20071123055134-k5x4ekduci2lbn36-3
      doc/en/user-guide/undoing_mistakes.txt undoing_mistakes.txt-20071121092300-8fyacngt1w98e5mp-1
      doc/en/user-guide/working_offline_central.txt working_offline_cent-20071123055134-k5x4ekduci2lbn36-5
      doc/index.txt                  index.txt-20070813101924-07gd9i9d2jt124bf-1
    ------------------------------------------------------------
    revno: 3063.4.2
    revision-id:john at arbash-meinel.com-20071205224237-fswkepwc4yky19ug
    parent: lalinsky at gmail.com-20071201114356-v65hafsuxuzsmd1e
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: jam-integration
    timestamp: Wed 2007-12-05 16:42:37 -0600
    message:
      Fix 'nonexistent'
    modified:
      bzrlib/tests/blackbox/test_cat.py test_cat.py-20051201162916-f0937e4e19ea24b3
    ------------------------------------------------------------
    revno: 3063.4.1
    revision-id:lalinsky at gmail.com-20071201114356-v65hafsuxuzsmd1e
    parent: pqm at pqm.ubuntu.com-20071201001053-zi6k6s2817c1p97s
    committer: Lukáš Lalinský <lalinsky at gmail.com>
    branch nick: cat-branch
    timestamp: Sat 2007-12-01 12:43:56 +0100
    message:
      Fix UnboundLocalError in cmd_cat.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/tests/blackbox/test_cat.py test_cat.py-20051201162916-f0937e4e19ea24b3
=== modified file 'NEWS'
--- a/NEWS	2007-12-05 18:47:51 +0000
+++ b/NEWS	2007-12-05 22:52:58 +0000
@@ -34,6 +34,9 @@
 
   BUGFIXES:
 
+   * Better error message when running ``bzr cat`` on a non-existant branch.
+     (Lukáš Lalinský, #133782)
+
    * Catch OSError 17 (file exists) in final phase of tree transform and show
      filename to user.
      (Alexander Belchenko, #111758)

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2007-12-05 20:12:27 +0000
+++ b/bzrlib/builtins.py	2007-12-05 23:31:04 +0000
@@ -2126,22 +2126,15 @@
     def run(self, filename, revision=None, name_from_revision=False):
         if revision is not None and len(revision) != 1:
             raise errors.BzrCommandError("bzr cat --revision takes exactly"
-                                        " one number")
-        tree = None
-        try:
-            tree, b, relpath = \
-                    bzrdir.BzrDir.open_containing_tree_or_branch(filename)
-        except errors.NotBranchError:
-            pass
-
-        if revision is not None and revision[0].get_branch() is not None:
-            b = Branch.open(revision[0].get_branch())
-        b.lock_read()
-        try:
-            return self._run(tree, b, relpath, filename, revision,
-                name_from_revision)
+                                         " one revision specifier")
+        tree, branch, relpath = \
+            bzrdir.BzrDir.open_containing_tree_or_branch(filename)
+        branch.lock_read()
+        try:
+            return self._run(tree, branch, relpath, filename, revision,
+                             name_from_revision)
         finally:
-            b.unlock()
+            branch.unlock()
 
     def _run(self, tree, b, relpath, filename, revision, name_from_revision):
         if tree is None:

=== modified file 'bzrlib/tests/blackbox/test_cat.py'
--- a/bzrlib/tests/blackbox/test_cat.py	2007-09-04 03:23:59 +0000
+++ b/bzrlib/tests/blackbox/test_cat.py	2007-12-05 22:42:37 +0000
@@ -20,6 +20,7 @@
 """
 
 import os
+import sys
 
 from bzrlib.tests.blackbox import TestCaseWithTransport
 
@@ -128,3 +129,9 @@
         out, err = self.run_bzr_subprocess(['cat', url])
         self.assertEqual('contents of README\n', out)
 
+    def test_cat_nonexistent_branch(self):
+        if sys.platform == "win32":
+            location = "C:/i/do/not/exist"
+        else:
+            location = "/i/do/not/exist"
+        self.run_bzr_error(['^bzr: ERROR: Not a branch'], ['cat', location])




More information about the bazaar-commits mailing list