11 windows filesystems mercurial cross-platform fat32
我在一个Mercurial存储库上工作,该存储库被检出到Unix文件系统上,例如某些机器上的ext3,以及其他机器上的FAT32.
在Subversion中,我可以设置svn:executable属性来控制在支持这样一个位的平台上签出时是否应该将文件标记为可执行文件.无论我运行SVN的平台还是包含我的工作副本的文件系统,我都可以这样做.
在Mercurial中,如果克隆在Unix文件系统上,我可以chmod + x来获得相同的效果.但是如何在FAT文件系统上的文件上设置(或删除)可执行位?
如果文件系统不支持它,暂时不能更改执行位(我计划将来支持它).
Mercurial将执行位跟踪为文件metdata的一部分.没有办法明确地将它设置为mercurial,但它跟踪chmodunix上所做的更改.在Windows上添加的文件默认设置执行位,但是windows attrib命令不允许您设置它们.
如果您执行了操作,hg log -p --git您将看到显示执行位更改的修补程序格式,如下所示:
$ 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
Run Code Online (Sandbox Code Playgroud)
如果您无法使用unix系统来设置它们,那么您可能会伪装一个类似的补丁hg import,但这绝对是次优的.
对于 Windows,您需要创建一个补丁文件,然后应用它,就像Ry4an 所说的那样,但参数--bypass为hg import. 这可以通过创建一个 Powershell 脚本文件来完成,SetFileExecutable.ps1该文件中包含以下文本
param (
[String]$comment = "+execbit",
[Parameter(Mandatory=$true)][string]$filePathRelativeTo,
[Parameter(Mandatory=$true)][string]$repositoryRoot
)
if( Test-Path -Path "$($repositoryRoot)\.hg" -PathType Container )
{
if( Test-Path -Path "$($repositoryRoot)\$($filePathRelativeTo)" -PathType Leaf )
{
$filePathRelativeTo = $filePathRelativeTo.Replace( '\', '/' )
$diff = "$comment" + [System.Environment]::NewLine +
[System.Environment]::NewLine +
"diff --git a/$filePathRelativeTo b/$filePathRelativeTo" + [System.Environment]::NewLine +
"old mode 100644" + [System.Environment]::NewLine +
"new mode 100755"
Push-Location
cd $repositoryRoot
$diff | Out-File -Encoding 'utf8' $env:tmp\exebit.diff
hg import --bypass -m "$comment" $env:tmp\exebit.diff
Pop-Location
}
else
{
Write-Host "filePathRelativeTo must the location of a file relative to repositoryRoot"
}
}
else
{
Write-Host "repositoryRoot must be the location of the .hg folder"
}
Run Code Online (Sandbox Code Playgroud)
执行如下:
.\SetFileExecutable.ps1" -comment "Marking file as executable" -filePathRelativeTo mvnw -repositoryRoot "c:\myrepo"
Run Code Online (Sandbox Code Playgroud)
使用Mercurial的Bugzilla中Matt Harbison提供的解决方案
| 归档时间: |
|
| 查看次数: |
2767 次 |
| 最近记录: |