Rev 2564: (James Westby) Fix bug #122656 by raising a nice error for 'bzr annotate nonexistant' in http://bzr.arbash-meinel.com/branches/bzr/jam-integration

John Arbash Meinel john at arbash-meinel.com
Fri Jun 29 00:32:17 BST 2007


At http://bzr.arbash-meinel.com/branches/bzr/jam-integration

------------------------------------------------------------
revno: 2564
revision-id: john at arbash-meinel.com-20070628233134-i49poh40mkt2f9i4
parent: pqm at pqm.ubuntu.com-20070628225335-facf1886gxehj2w1
parent: jw+debian at jameswestby.net-20070628205014-sgiw70zcyg2qhl13
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Thu 2007-06-28 18:31:34 -0500
message:
  (James Westby) Fix bug #122656 by raising a nice error for 'bzr annotate nonexistant'
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_annotate.py testannotate.py-20051013044000-457f44801bfa9d39
    ------------------------------------------------------------
    revno: 2561.2.2
    revision-id: jw+debian at jameswestby.net-20070628205014-sgiw70zcyg2qhl13
    parent: jw+debian at jameswestby.net-20070628191100-7jkrxku0fv7n7ju1
    committer: James Westby <jw+debian at jameswestby.net>
    branch nick: bzr.dev
    timestamp: Thu 2007-06-28 21:50:14 +0100
    message:
      Fix up with comments from Aaron.
    ------------------------------------------------------------
    revno: 2561.2.1
    revision-id: jw+debian at jameswestby.net-20070628191100-7jkrxku0fv7n7ju1
    parent: pqm at pqm.ubuntu.com-20070628082903-b21gad45bimzvmgu
    committer: James Westby <jw+debian at jameswestby.net>
    branch nick: bzr.dev
    timestamp: Thu 2007-06-28 20:11:00 +0100
    message:
      Display a useful error message when annotating a non-existant file (#122656)
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2007-06-28 07:50:53 +0000
+++ b/NEWS	2007-06-28 19:11:00 +0000
@@ -5,6 +5,10 @@
     * Do not suppress pipe errors, etc. in non-display commands
       (Alexander Belchenko, #87178)
 
+    * Display a useful error message when the user requests to annotate
+      a file that is not present in the specified revision.
+      (James Westby, #122656)
+
   IMPROVEMENTS:
 
     * The --lsprof-file option now dumps a text rendering of the profiling

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2007-06-26 14:10:56 +0000
+++ b/bzrlib/builtins.py	2007-06-28 20:50:14 +0000
@@ -3142,6 +3142,8 @@
             else:
                 revision_id = revision[0].in_history(branch).rev_id
             file_id = tree.path2id(relpath)
+            if file_id is None:
+                raise errors.NotVersionedError(filename)
             tree = branch.repository.revision_tree(revision_id)
             file_version = tree.inventory[file_id].revision
             annotate_file(branch, file_version, file_id, long, all, sys.stdout,

=== modified file 'bzrlib/tests/blackbox/test_annotate.py'
--- a/bzrlib/tests/blackbox/test_annotate.py	2006-12-15 15:23:43 +0000
+++ b/bzrlib/tests/blackbox/test_annotate.py	2007-06-28 23:31:34 +0000
@@ -156,3 +156,14 @@
         os.chdir('tree')
         out, err = self.run_bzr('annotate', 'empty')
         self.assertEqual('', out)
+
+    def test_annotate_nonexistant_file(self):
+        tree = self.make_branch_and_tree('tree')
+        self.build_tree(['tree/file'])
+        tree.add(['file'])
+        tree.commit('add a file')
+
+        os.chdir('tree')
+        out, err = self.run_bzr("annotate doesnotexist", retcode=3)
+        self.assertEqual('', out)
+        self.assertEqual("bzr: ERROR: doesnotexist is not versioned\n", err)



More information about the bazaar-commits mailing list