如何用ant自动更新几十个mercurial仓库?
我有一个遗留产品,分布在数十个存储库中。我目前正在尝试重构(并理解......)给定的构建过程。第一步是从旧的版本控制系统迁移到 Mercurial,这是令人鼓舞且简单的。
构建过程主要使用 ant 构建脚本(好消息),但必须在存储库文件结构上运行(坏消息...),因为 ant 脚本从所有存储库获取文件,并将工件留在..可以说,几个地方...但这并不是一个障碍。
在触发构建之前(现在使用 hudson CI),我必须确保所有存储库都已更新到提示或选定的标签。我可以(再次)编写脚本/批处理或编写自定义 ant 任务,但是,我不想(再次)忽略现有功能:
是否可以使用现有 ant 任务或 Mercurial 功能来更新一组 Mercurial 存储库?所有存储库都位于一个文件夹中(例如 /repo
),并具有公共前缀(例如 SYSTEMNAME_module
),因此可以轻松找到它们/创建文件集。
I have a legacy product, spread across dozens of repositories. I'm currently trying to refactor (and understand...) the given build process. First step was moving from the old version control system to mercurial, which was encouraging and easy.
The build process mainly uses ant build scripts (good news) but has to run 'on' the repository file structure (bad news...) because the ant scripts take files from all repositories and leave artifacts on .. lets say, several places... But that's not a blocker.
Before I trigger the build (now with hudson CI), I have to make sure, that all repositories are updated to the tip or a selected tag. I could write a script/batch or write a custom ant task (again) but, I don't want to ignore existing features (again):
is it possible to update a set of mercurial repositories by using existing ant tasks or mercurial features? All repositories are located in one folder (like /repo
) and have a common prefix (like SYSTEMNAME_module
) so it's easy to locate them/create a fileset.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我找到了一个不同的基于蚂蚁的解决方案,基于“应用”任务:
感谢亚伦,他非常有帮助的答案向我展示了正确的方向。
I found a different ant based solution, based on the 'apply' task:
Thanks to Aaron, his very helpful answer showed me the right direction.
我认为这将是更新 Mercurial depo 的更灵活的方式。它从一组目录中选择哪些是软件仓库并更新它们。请注意,您也可以使用 ant contrib 的 foreach 标签来执行此操作,但“for”似乎消耗的内存要少得多。
I think this would be a more flexible way to update a mercurial depo. From a set of directories it chooses which ones are depots and updates those. Note that you can also do this with the foreach tag of ant contrib but the 'for' seems to consume a lot less memory.
今天最简单的解决方案是从 Ant 启动
hg
可执行文件(使用exec
任务。注意:MacroDef 是你的朋友)。只需在其中一个项目中创建一个“主”构建文件,更改到父目录(您可以在其中访问所有本地副本),然后更新每个项目。The most simple solution today is to start the
hg
executable from Ant (using theexec
task. Note: MacroDef is your friend). Just create a "main" build file in one of the projects, change to the parent directory (where you can access all the local copies) and then update each one.