Rev 5653: (vila) Annotate deleted files if they can be found in the specified in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Feb 9 08:51:33 UTC 2011


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

------------------------------------------------------------
revno: 5653 [merge]
revision-id: pqm at pqm.ubuntu.com-20110209085129-0qspgtdaj4gfu2qr
parent: pqm at pqm.ubuntu.com-20110208144422-qz2zctgn6n5apl33
parent: eurokang at gmail.com-20110210080517-7xya44a9akpica0n
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-02-09 08:51:29 +0000
message:
  (vila) Annotate deleted files if they can be found in the specified
   revision. (Andrew King)
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_annotate.py testannotate.py-20051013044000-457f44801bfa9d39
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2011-01-27 17:45:24 +0000
+++ b/bzrlib/builtins.py	2011-02-10 08:05:17 +0000
@@ -4714,19 +4714,19 @@
             self.add_cleanup(branch.lock_read().unlock)
         tree = _get_one_revision_tree('annotate', revision, branch=branch)
         self.add_cleanup(tree.lock_read().unlock)
-        if wt is not None:
+        if wt is not None and revision is None:
             file_id = wt.path2id(relpath)
         else:
             file_id = tree.path2id(relpath)
         if file_id is None:
             raise errors.NotVersionedError(filename)
-        file_version = tree.inventory[file_id].revision
         if wt is not None and revision is None:
             # If there is a tree and we're not annotating historical
             # versions, annotate the working tree's content.
             annotate_file_tree(wt, file_id, self.outf, long, all,
                 show_ids=show_ids)
         else:
+            file_version = tree.inventory[file_id].revision
             annotate_file(branch, file_version, file_id, long, all, self.outf,
                           show_ids=show_ids)
 

=== modified file 'bzrlib/tests/blackbox/test_annotate.py'
--- a/bzrlib/tests/blackbox/test_annotate.py	2010-05-02 20:10:25 +0000
+++ b/bzrlib/tests/blackbox/test_annotate.py	2011-02-09 11:44:03 +0000
@@ -245,6 +245,19 @@
         out, err = self.run_bzr('annotate empty')
         self.assertEqual('', out)
 
+    def test_annotate_removed_file(self):
+        tree = self.make_branch_and_tree('tree')
+        self.build_tree_contents([('tree/empty', '')])
+        tree.add('empty')
+        tree.commit('add empty file')
+        # delete the file.
+        tree.remove('empty')
+        tree.commit('remove empty file')
+        
+        os.chdir('tree')
+        out, err = self.run_bzr('annotate -r1 empty')
+        self.assertEqual('', out)
+
     def test_annotate_empty_file_show_ids(self):
         tree = self.make_branch_and_tree('tree')
         self.build_tree_contents([('tree/empty', '')])




More information about the bazaar-commits mailing list