是否有内置的 Mercurial 或扩展程序可以删除所有“非 Mercurial”来自存储库根目录的文件?
我想要存储库根文件夹下的所有文件(除了 .hg/、.hgignore、.hgtags 等)。是否有 Mercurial 内置或现有扩展可以执行此操作?
我已经实现了一个带有硬编码“mercurial 文件”的非 hg 脚本,但我想要一种排除 Mercurial 相关文件的编程方法。
我正在尝试通过定期删除所有文件,从 Starteam 进行干净的签出,然后运行 hg addremove,然后签入来镜像非 Mercurial 配置管理服务器(Starteam)。
I'd like all files under the repo's root folder except .hg/, .hgignore, .hgtags, etc. Is there a mercurial built-in or existing extension to do this?
I have implemented a non-hg script with hard-code "mercurial files", but I'd like a programmatic method of excluding the mercurial related files.
I'm trying to mirror a non-mercurial configuration management server (Starteam) by periodically deleting all files, doing a clean checkout from Starteam and then running hg addremove, then checkin.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这并不完全是您正在寻找的内容,但
hg update -r null
将您带到第一个变更集之前的修订版,该变更集显然不包含任何文件。这将使您的 .hg 保留在原位,但 .hgtags 和 .hgignore 将消失。但是,它们是被跟踪的文件,因此它们会像任何其他文件一样返回hg 更新
。It's not exactly what you're looking for but
hg update -r null
takes your to the revision before the first changeset, which obviously contains no files. That'll leave your .hg in place but .hgtags and .hgignore will be-gone. However, they're tracked files so they'll come back with ahg update
the same as any other files.对于您从 Starteam 获取的每个版本,我建议创建一个新目录。
在此目录中,执行
hg clone -U< /code>
来自您之前的目录。这将克隆存储库,但不会签出任何文件。之后,复制您的 Starteam 文件,然后执行
hg addremove
。For each version you pull from Starteam, I'd suggest creating a new directory.
In this directory, do a
hg clone -U
from your previous directory. This will clone the repository, but not checkout any files. After which, copy your Starteam files and then do anhg addremove
.将整个 Starteam 内容复制到存储库根文件夹的子文件夹中。
像这样:
所以你只需要删除这个单一的“Starteam”文件夹,而不需要显式忽略 Mercurial 特定文件。
Copy the whole Starteam stuff into a subfolder of your repo's root folder.
Like this:
So you only have to delete this single "Starteam" folder, without the need to explicitly ignore Mercurial specific files.