Rev 3088: Diff handles missing files correctly, with no tracebacks in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Dec 6 19:15:19 GMT 2007


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

------------------------------------------------------------
revno: 3088
revision-id:pqm at pqm.ubuntu.com-20071206191512-6tvqmou1db89q6oi
parent: pqm at pqm.ubuntu.com-20071206175705-a3go0hme7nx1rr69
parent: abentley at panoramicfeedback.com-20071206182035-fsvtracks7b99c14
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2007-12-06 19:15:12 +0000
message:
  Diff handles missing files correctly, with no tracebacks
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
  bzrlib/tests/test_diff.py      testdiff.py-20050727164403-d1a3496ebb12e339
    ------------------------------------------------------------
    revno: 3087.1.1
    revision-id:abentley at panoramicfeedback.com-20071206182035-fsvtracks7b99c14
    parent: pqm at pqm.ubuntu.com-20071206175705-a3go0hme7nx1rr69
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's integration
    timestamp: Thu 2007-12-06 13:20:35 -0500
    message:
      Diff handles missing files correctly, with no tracebacks
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
      bzrlib/tests/test_diff.py      testdiff.py-20050727164403-d1a3496ebb12e339
=== modified file 'NEWS'
--- a/NEWS	2007-12-06 12:03:35 +0000
+++ b/NEWS	2007-12-06 18:20:35 +0000
@@ -192,6 +192,9 @@
    * Detect invalid transport reuse attempts by catching invalid URLs.
      (Vincent Ladeuil, #161819)
 
+   * Deleting a file without removing it shows a correct diff, not a traceback.
+     (Aaron Bentley)
+
    * Do no use timeout in HttpServer anymore.
      (Vincent Ladeuil, #158972).
 

=== modified file 'bzrlib/diff.py'
--- a/bzrlib/diff.py	2007-12-06 14:07:07 +0000
+++ b/bzrlib/diff.py	2007-12-06 18:20:35 +0000
@@ -743,11 +743,11 @@
         """
         try:
             old_kind = self.old_tree.kind(file_id)
-        except errors.NoSuchId:
+        except (errors.NoSuchId, errors.NoSuchFile):
             old_kind = None
         try:
             new_kind = self.new_tree.kind(file_id)
-        except errors.NoSuchId:
+        except (errors.NoSuchId, errors.NoSuchFile):
             new_kind = None
 
         result = DiffPath._diff_many(self.differs, file_id, old_path,

=== modified file 'bzrlib/tests/test_diff.py'
--- a/bzrlib/tests/test_diff.py	2007-12-06 14:07:07 +0000
+++ b/bzrlib/tests/test_diff.py	2007-12-06 18:20:35 +0000
@@ -612,6 +612,24 @@
             '--- old label\n+++ new label\n@@ -1,1 +1,1 @@\n-old\n+new\n\n',
             differ.to_file.getvalue())
 
+    def test_diff_deletion(self):
+        self.build_tree_contents([('old-tree/file', 'contents'),
+                                  ('new-tree/file', 'contents')])
+        self.old_tree.add('file', 'file-id')
+        self.new_tree.add('file', 'file-id')
+        os.unlink('new-tree/file')
+        self.differ.show_diff(None)
+        self.assertContainsRe(self.differ.to_file.getvalue(), '-contents')
+
+    def test_diff_creation(self):
+        self.build_tree_contents([('old-tree/file', 'contents'),
+                                  ('new-tree/file', 'contents')])
+        self.old_tree.add('file', 'file-id')
+        self.new_tree.add('file', 'file-id')
+        os.unlink('old-tree/file')
+        self.differ.show_diff(None)
+        self.assertContainsRe(self.differ.to_file.getvalue(), '\+contents')
+
     def test_diff_symlink(self):
         differ = DiffSymlink(self.old_tree, self.new_tree, StringIO())
         differ.diff_symlink('old target', None)




More information about the bazaar-commits mailing list