在Windows上设置Mercurial的执行位 [英] Setting Mercurial's execute bit on Windows

查看:164
本文介绍了在Windows上设置Mercurial的执行位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个Mercurial仓库上工作,这个仓库被签出到一个Unix文件系统上,比如某些机器上的ext3,其他机器上的FAT32。

在Subversion中,我可以设置svn:executable属性来控制一个文件在一个支持这样一个位的平台上签出时是否应该被标记为可执行文件。我可以做到这一点,无论我运行SVN的平台或包含我的工作副本的文件系统。

在Mercurial中,我可以通过chmod + x来获得相同的效果如果克隆在Unix文件系统上。但是,如何设置(或删除)FAT文件系统上文件的可执行位?

解决方案

Mercurial跟踪执行位作为文件metdata的一部分。没有办法将它明确地设置在mercurial中,但它跟踪由unix上的 chmod 所做的更改。在Windows上添加的文件将默认设置执行位,但windows attrib命令不允许您设置它们。

如果您执行 hg log -p --git 你会看到补丁格式,显示执行位的变化,如下所示:

  $ hg log --git -p 
changeset:1:0d9a70aadc0a
tag:tip
user:Ry4an Brase< ry4an-hg @ ry4an。有机>
date:Sat Apr 24 10:05:23 2010 -0500
summary:添加执行

diff --git a / that b / that
旧模式100644
新模式100755

变更集:0:06e25cb66089
用户:Ry4an Brase< ry4an-hg@ry4an.org>
日期:4月24日星期六10:05:09 2010 -0500
汇总:添加不执行

diff --git a / that b / that
new file模式100644
--- / dev / null
+++ b / that
@@ -0,0 +1,1 @@
+ this

如果您无法进入unix系统来设置它们,您可能会像这样修补一个补丁和 hg import ,但这绝对是次优。


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?

解决方案

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.

这篇关于在Windows上设置Mercurial的执行位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆