[PATCH 12 of 12] Track executable bit

Edouard Gomez ed.gomez at free.fr
Tue Dec 19 06:05:53 UTC 2006


# HG changeset patch
# User Edouard Gomez <ed.gomez at free.fr>
# Date 1166511815 -3600
# Node ID 7173260c9c059de3298b2d72343f80a0899e9f0d
# Parent  8a1695aef27b7106f483c947cb793816464fafe8
Track executable bit

diff -r 8a1695aef27b -r 7173260c9c05 hg-cvs-import
--- a/hg-cvs-import	Tue Dec 19 08:03:35 2006 +0100
+++ b/hg-cvs-import	Tue Dec 19 08:03:35 2006 +0100
@@ -127,15 +127,16 @@ def start_checkout(file, rev):
             os.unlink(os.path.join(hgpath, file))
         except OSError:
             pass
-        return None
+        return (None, None)
+    executable = util.is_exec(cvsfile + ',v', None)
     cvsfile = cvsfile.replace("'", "\'")
     f = os.popen("co -q -p %s -r%s '%s'" % (expandkeyword, rev, cvsfile), 'r', 262144)
     if not f:
         sys.stderr.write("os.popen failed for %s\n" % cvsfile)
         sys.exit(1)
-    return f
-
-def finish_checkout(f, file):
+    return (f, executable)
+
+def finish_checkout(f, file, executable):
     buf = f.read()
     ret = f.close()
     if ret:
@@ -144,6 +145,7 @@ def finish_checkout(f, file):
     wf = repo.wopener(file, "w")
     wf.write(buf)
     wf.close()
+    util.set_exec(repo.wjoin(file), executable)
 
 def addtag(tag, rev):
     global alltags
@@ -235,19 +237,19 @@ def addrev(branch, tag, r, user, date, l
     if not n:
         fps = []
         for x in files:
-            fp = start_checkout(x[0], x[1])
+            fp, exe = start_checkout(x[0], x[1])
             if fp:
-                fps.append((fp, x[0]))
+                fps.append((fp, x[0], exe))
             if len(fps) > 10:
                 while fps:
-                    fp, fname = fps.pop()
+                    fp, fname, exe = fps.pop()
                     if not fp:
                         sys.stderr.write("fname %s fp none\n" % fname)
                         sys.exit(1)
-                    finish_checkout(fp, fname)
+                    finish_checkout(fp, fname, exe)
         while fps:
-            fp, fname = fps.pop()
-            finish_checkout(fp, fname)
+            fp, fname, exe = fps.pop()
+            finish_checkout(fp, fname, exe)
         filelist = [x[0] for x in files]
 
         dateconv = str(int(time.mktime(time.strptime(date,



More information about the Mercurial-devel mailing list