convert: force svn:executable when execute-bit is not supported
authorPatrick Mezard <pmezard@gmail.com>
Sun, 11 Nov 2007 19:34:00 +0100
changeset 5536 fdee5d614fcc
parent 5535 7501ef26402b
child 5537 e01c748cb632
convert: force svn:executable when execute-bit is not supported The util.is_exec fallback would be to ask subversion for the current value of svn:executable. Setting it directly is just simpler.
hgext/convert/subversion.py
--- a/hgext/convert/subversion.py	Sun Nov 11 14:17:30 2007 +0100
+++ b/hgext/convert/subversion.py	Sun Nov 11 19:34:00 2007 +0100
@@ -740,6 +740,7 @@
         self.opener = util.opener(self.wc)
         self.wopener = util.opener(self.wc)
         self.childmap = mapfile(ui, self.join('hg-childmap'))
+        self.is_exec = util.checkexec(self.wc) and util.is_exec or None
 
         if created:
             hook = os.path.join(created, 'hooks', 'pre-revprop-change')
@@ -761,7 +762,15 @@
             except OSError:
                 pass
             self.wopener(filename, 'w').write(data)
-            was_exec = util.is_exec(self.wjoin(filename))
+
+            if self.is_exec:
+                was_exec = self.is_exec(self.wjoin(filename))
+            else:
+                # On filesystems not supporting execute-bit, there is no way
+                # to know if it is set but asking subversion. Setting it
+                # systematically is just as expensive and much simpler.
+                was_exec = 'x' not in flags
+
             util.set_exec(self.wjoin(filename), 'x' in flags)
             if was_exec:
                 if 'x' not in flags: