[Pkg-bazaar-commits] ./bzr/unstable r767: - files are only reported as modified if their name or parent has changed,

Martin Pool mbp at sourcefrog.net
Fri Apr 10 08:13:44 UTC 2009


------------------------------------------------------------
revno: 767
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Fri 2005-06-24 17:06:38 +1000
message:
  - files are only reported as modified if their name or parent has changed,
    not if their parent is renamed
modified:
  bzrlib/diff.py
-------------- next part --------------
=== modified file 'bzrlib/diff.py'
--- a/bzrlib/diff.py	2005-06-22 07:56:30 +0000
+++ b/bzrlib/diff.py	2005-06-24 07:06:38 +0000
@@ -19,6 +19,10 @@
 from errors import BzrError
 
 
+# TODO: Rather than building a changeset object, we should probably
+# invoke callbacks on an object.  That object can either accumulate a
+# list, write them out directly, etc etc.
+
 def internal_diff(old_label, oldlines, new_label, newlines, to_file):
     import difflib
     
@@ -267,6 +271,10 @@
     Files that are both modified and renamed are listed only in
     renamed, with the text_modified flag true.
 
+    Files are only considered renamed if their name has changed or
+    their parent directory has changed.  Renaming a directory
+    does not count as renaming all its contents.
+
     The lists are normally sorted when the delta is created.
     """
     def __init__(self):
@@ -392,6 +400,9 @@
             old_path = old_inv.id2path(file_id)
             new_path = new_inv.id2path(file_id)
 
+            old_ie = old_inv[file_id]
+            new_ie = new_inv[file_id]
+
             if specific_files:
                 if (not is_inside_any(specific_files, old_path) 
                     and not is_inside_any(specific_files, new_path)):
@@ -410,7 +421,8 @@
             # the same and the parents are unchanged all the way up.
             # May not be worthwhile.
             
-            if old_path != new_path:
+            if (old_ie.name != new_ie.name
+                or old_ie.parent_id != new_ie.parent_id):
                 delta.renamed.append((old_path, new_path, file_id, kind,
                                       text_modified))
             elif text_modified:



More information about the Pkg-bazaar-commits mailing list