hgext/convert/subversion.py
changeset 41617 36ee0d6d64c5
parent 41616 2c13e91ede6e
child 41759 aaad36b88298
--- a/hgext/convert/subversion.py	Thu Feb 07 18:57:54 2019 +0300
+++ b/hgext/convert/subversion.py	Thu Feb 07 21:48:50 2019 +0300
@@ -1206,10 +1206,18 @@
                     os.unlink(filename)
             except OSError:
                 pass
+
+            if self.is_exec:
+                # We need to check executability of the file before the change,
+                # because `vfs.write` is able to reset exec bit.
+                wasexec = False
+                if os.path.exists(self.wjoin(filename)):
+                    wasexec = self.is_exec(self.wjoin(filename))
+
             self.wopener.write(filename, data)
 
             if self.is_exec:
-                if self.is_exec(self.wjoin(filename)):
+                if wasexec:
                     if 'x' not in flags:
                         self.delexec.append(filename)
                 else: