Rev 52: Fix bug #270219 by handling content changes during renames. in http://bazaar.launchpad.net/%7Ebzr-upload-devs/bzr-upload/trunk

Vincent Ladeuil v.ladeuil+lp at free.fr
Tue Sep 16 07:51:10 BST 2008


At http://bazaar.launchpad.net/%7Ebzr-upload-devs/bzr-upload/trunk

------------------------------------------------------------
revno: 52
revision-id: v.ladeuil+lp at free.fr-20080916065108-gphtn20znbgo7lzz
parent: argentina at gmail.com-20080802191426-qcbt585z8u1rdxml
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: upload
timestamp: Tue 2008-09-16 08:51:08 +0200
message:
  Fix bug #270219 by handling content changes during renames.
  
  * tests/test_upload.py:
  (TestUploadMixin.test_rename_and_change_file): Reproduce bug
  #270219.
  
  * __init__.py:
  (BzrUploader.upload_tree): Content modifications can be a special
  case of renames.
modified:
  __init__.py                    __init__.py-20080307145942-xx1xgifrreovahgz-1
  tests/test_upload.py           test_upload.py-20080307145942-xx1xgifrreovahgz-2
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2008-08-02 15:54:28 +0000
+++ b/__init__.py	2008-09-16 06:51:08 +0000
@@ -58,7 +58,7 @@
     )
 """)
 
-version_info = (0,1,0)
+version_info = (0, 1, 1)
 plugin_name = 'upload'
 
 
@@ -279,6 +279,10 @@
 
             for (old_path, new_path, id, kind,
                  content_change, exec_change) in changes.renamed:
+                if content_change:
+                    # We update the old_path content because renames and
+                    # deletions are differed.
+                    self.upload_file(old_path, id)
                 self.rename_remote(old_path, new_path)
             self.finish_renames()
             self.finish_deletions()

=== modified file 'tests/test_upload.py'
--- a/tests/test_upload.py	2008-08-02 15:54:28 +0000
+++ b/tests/test_upload.py	2008-09-16 06:51:08 +0000
@@ -301,6 +301,19 @@
 
         self.assertUpFileEqual('foo', 'goodbye')
 
+    def test_rename_and_change_file(self):
+        self.make_local_branch()
+        self.add_file('hello', 'foo')
+        self.do_full_upload()
+        self.rename_any('hello', 'goodbye')
+        self.modify_file('goodbye', 'bar')
+
+        self.assertUpFileEqual('foo', 'hello')
+
+        self.do_upload()
+
+        self.assertUpFileEqual('bar', 'goodbye')
+
     def test_rename_two_files(self):
         self.make_local_branch()
         self.add_file('a', 'foo')



More information about the bazaar-commits mailing list