windowsmercurialcross-platformfilesystemsfat32

Setting Mercurial's execute bit on Windows


I work on a Mercurial repository that is checked out onto an Unix filesystem such as ext3 on some machines, and FAT32 on others.

In Subversion, I can set the svn:executable property to control whether a file should be marked executable when checked out on a platform that supports such a bit. I can do this regardless of the platform I'm running SVN on or the filesystem containing my working copy.

In Mercurial, I can chmod +x to get the same effect if the clone is on a Unix filesystem. But how can I set (or remove) the executable bit on a file on a FAT filesystem?


Solution

  • Mercurial tracks the execute bit as part of the file metdata. There's no way to explictly set it in mercurial, but it tracks changes made by chmod on unix. Files added on windows will have the execute bit set by default, but the windows attrib command doesn't let you set them.

    If you do a hg log -p --git you'll see the patch format that shows the altering of the execute bit, which looks like this:

    $ hg log --git -p
    changeset:   1:0d9a70aadc0a
    tag:         tip
    user:        Ry4an Brase <ry4an-hg@ry4an.org>
    date:        Sat Apr 24 10:05:23 2010 -0500
    summary:     added execute
    
    diff --git a/that b/that
    old mode 100644
    new mode 100755
    
    changeset:   0:06e25cb66089
    user:        Ry4an Brase <ry4an-hg@ry4an.org>
    date:        Sat Apr 24 10:05:09 2010 -0500
    summary:     added no execute
    
    diff --git a/that b/that
    new file mode 100644
    --- /dev/null
    +++ b/that
    @@ -0,0 +1,1 @@
    +this
    

    If you're not able to get on to a unix system to set them, you could probably fake up a patch like that and hg import it, but that's definitely sub optimal.