Rev 823: Fix kind changes that don't change contents. in file:///data/jelmer/bzr-svn/0.4/

Jelmer Vernooij jelmer at samba.org
Fri Jan 18 04:05:52 GMT 2008


At file:///data/jelmer/bzr-svn/0.4/

------------------------------------------------------------
revno: 823
revision-id:jelmer at samba.org-20071222212752-yu06lwc69u4jke0d
parent: jelmer at samba.org-20071221230158-c2189vvc3dsc5c3d
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sat 2007-12-22 22:27:52 +0100
message:
  Fix kind changes that don't change contents.
modified:
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
  tests/test_fetch.py            test_fetch.py-20070624210302-luvgwjmlfysk5qeq-1
=== modified file 'NEWS'
--- a/NEWS	2007-12-21 20:19:24 +0000
+++ b/NEWS	2007-12-22 21:27:52 +0000
@@ -24,6 +24,8 @@
 
    * Don't mask exception in fetch code. (#165177)
 
+   * Deal with kind changes that don't change file contents. (#178149)
+
 bzr-svn 0.4.5	2007-12-01
 
   IMPROVEMENTS

=== modified file 'fetch.py'
--- a/fetch.py	2007-12-21 20:19:24 +0000
+++ b/fetch.py	2007-12-22 21:27:52 +0000
@@ -371,11 +371,13 @@
         ie.revision = self.revid
 
         if self.is_symlink:
+            ie.kind = 'symlink'
             ie.symlink_target = lines[0][len("link "):]
             ie.text_sha1 = None
             ie.text_size = None
             ie.text_id = None
         else:
+            ie.kind = 'file'
             ie.text_sha1 = osutils.sha_strings(lines)
             ie.text_size = sum(map(len, lines))
             if self.is_executable is not None:

=== modified file 'tests/test_fetch.py'
--- a/tests/test_fetch.py	2007-11-26 11:32:01 +0000
+++ b/tests/test_fetch.py	2007-12-22 21:27:52 +0000
@@ -1352,6 +1352,35 @@
         self.assertEqual('symlink', inv1[inv1.path2id("mylink")].kind)
         self.assertEqual('bla', inv1[inv1.path2id("mylink")].symlink_target)
 
+    def test_fetch_symlink_kind_change(self):
+        repos_url = self.make_client('d', 'dc')
+        self.build_tree({'dc/bla': "data", "dc/mylink": "link bla"})
+        self.client_add("dc/bla")
+        self.client_add("dc/mylink")
+        self.client_commit("dc", "My Message")
+        ra = SvnRaTransport(repos_url)
+        def done(rev, date, author):
+            pass
+        editor = ra.get_commit_editor({"svn:log": "msg"}, done, None, False)
+        root_baton = editor.open_root(1)
+        baton = editor.open_file("mylink", root_baton, 1)
+        editor.change_file_prop(baton, "svn:special", "*")
+        editor.close_file(baton, None)
+        editor.close_directory(root_baton)
+        editor.close()
+        oldrepos = Repository.open("svn+"+repos_url)
+        dir = BzrDir.create("f",format.get_rich_root_format())
+        newrepos = dir.create_repository()
+        oldrepos.copy_content_into(newrepos)
+        self.assertTrue(newrepos.has_revision(
+            oldrepos.generate_revision_id(1, "", "none")))
+        inv1 = newrepos.get_inventory(
+                oldrepos.generate_revision_id(1, "", "none"))
+        inv2 = newrepos.get_inventory(
+                oldrepos.generate_revision_id(2, "", "none"))
+        self.assertEqual('file', inv1[inv1.path2id("mylink")].kind)
+        self.assertEqual('symlink', inv2[inv2.path2id("mylink")].kind)
+        self.assertEqual('bla', inv2[inv2.path2id("mylink")].symlink_target)
 
     def test_fetch_executable_separate(self):
         repos_url = self.make_client('d', 'dc')




More information about the bazaar-commits mailing list