I'd like to export only the files that were changed in a hg changeset, to make a patch - but I'm not sure how to do this. I'm using bitbucket as a hosting service - how do I go about this?
Thanks!
I'd like to export only the files that were changed in a hg changeset, to make a patch - but I'm not sure how to do this. I'm using bitbucket as a hosting service - how do I go about this?
Thanks!
该hg export
命令实际上会生成一个补丁(统一差异格式),但还包括一些额外的信息,如作者和提交消息,以防你想将它与hg import
.
如果您只想要从变更集生成的没有额外信息的补丁,那么它很简单:
hg diff -c REV
由于您只想在修订版中更改文件hg archive
,我想我想出了以下 bourne shell 脚本:
#!/bin/sh
mkdir -p $2
for i in $(hg log -r $1 --template '{files}')
do
mkdir -p $2/$(dirname $i)
hg cat -r $1 $i >$2/$i
done
它有两个参数:要导出的版本和要保存文件的目录。您可以在类似的脚本中实现相同的功能,但使用hg archive
一堆-I
参数。但是,我认为建议的脚本更直观一点,至少对我来说是这样。
注意:从存储库中移动或删除文件时,此脚本将无法正常工作。
我只是使用这个命令:
hg archive -I "set:added() or modified()" -r <rev-number> -t files /path/to/directory/for/export