Rev 1450: Fix regression in executable bits. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk

Jelmer Vernooij jelmer at samba.org
Mon Jul 7 23:46:41 BST 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/trunk

------------------------------------------------------------
revno: 1450
revision-id: jelmer at samba.org-20080707224641-cdyimns3q451ty9s
parent: jelmer at samba.org-20080707173455-ugl6vgfzvv1t6q39
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Tue 2008-07-08 00:46:41 +0200
message:
  Fix regression in executable bits.
modified:
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
  tests/test_fetch.py            test_fetch.py-20070624210302-luvgwjmlfysk5qeq-1
=== modified file 'fetch.py'
--- a/fetch.py	2008-07-04 10:34:05 +0000
+++ b/fetch.py	2008-07-07 22:46:41 +0000
@@ -364,7 +364,7 @@
             # properties.PROP_EXECUTABLE_VALUE, but that's not 
             # how SVN behaves. It appears to consider the presence 
             # of the property sufficient to mark it executable.
-            self.is_executable = (value != None)
+            self.is_executable = (value is not None)
         elif (name == properties.PROP_SPECIAL):
             self.is_symlink = (value != None)
         elif name == properties.PROP_ENTRY_COMMITTED_REV:
@@ -401,6 +401,8 @@
         assert self.is_symlink in (True, False)
 
         if self.file_id in self.editor.inventory:
+            if self.is_executable is None:
+                self.is_executable = self.editor.inventory[self.file_id].executable
             del self.editor.inventory[self.file_id]
 
         if self.is_symlink:
@@ -418,8 +420,7 @@
             ie.text_sha1 = osutils.sha_strings(lines)
             ie.text_size = sum(map(len, lines))
             assert ie.text_size is not None
-            if self.is_executable is not None:
-                ie.executable = self.is_executable
+            ie.executable = self.is_executable
 
         self.file_stream = None
 

=== modified file 'tests/test_fetch.py'
--- a/tests/test_fetch.py	2008-07-06 02:17:56 +0000
+++ b/tests/test_fetch.py	2008-07-07 22:46:41 +0000
@@ -1585,6 +1585,31 @@
         self.assertTrue(inv1[inv1.path2id("bla")].executable)
         self.assertTrue(inv1[inv1.path2id("blie")].executable)
 
+    def test_fetch_executable_persists(self):
+        repos_url = self.make_repository('d')
+
+        dc = self.get_commit_editor(repos_url)
+        bla = dc.add_file("bla")
+        bla.modify('data')
+        bla.change_prop("svn:executable", "*")
+        dc.close()
+
+        dc = self.get_commit_editor(repos_url)
+        dc.open_file("bla").modify("data2")
+        dc.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)
+        mapping = oldrepos.get_mapping()
+        inv1 = newrepos.get_inventory(
+                oldrepos.generate_revision_id(1, "", mapping))
+        self.assertTrue(inv1[inv1.path2id("bla")].executable)
+        inv2 = newrepos.get_inventory(
+                oldrepos.generate_revision_id(2, "", mapping))
+        self.assertTrue(inv2[inv2.path2id("bla")].executable)
+
     def test_fetch_symlink(self):
         if not has_symlinks():
             return




More information about the bazaar-commits mailing list