hg pull 只对当前工作目录进行操作吗?
我有多个 Mercurial 存储库,并使用 hg clone
在我们的文件服务器上创建它们的备份。现在我想编写一个批处理文件,通过在每个子目录上运行 hg pull -u
每天更新一次。
我想让这个备份脚本尽可能通用,因此它应该更新存储在我的 H:\BACKUPS\REPOS 文件夹中的所有备份存储库。这是我的 hgbackup.bat,存储在同一文件夹中:
for /f "delims=" %%i in ('dir /ad/b') do hg pull -u
问题:hg pull 似乎只在当前工作目录上操作,似乎没有开关来指定拉取的目标存储库。由于我讨厌 Windows 批处理脚本,因此我希望 .bat 尽可能简单并避免 cd'ing 到不同的目录。
有什么想法可以在不同的目录上运行 hg pull -u
吗?
I have multiple mercurial repositories and used hg clone
to create backups of them on our file server. Now I want to write a batch file that updates them once a day by running hg pull -u
on each subdirectory.
I want to keep this backup script as generic as possible, so it should update all backup repositories stored in my H:\BACKUPS\REPOS folder. This is my hgbackup.bat that is stored in the same folder:
for /f "delims=" %%i in ('dir /ad/b') do hg pull -u
The problem: hg pull only seems to operate on the current working directory, there seems to be no switch to specify the target repository for the pull. As I hate Windows Batch Scripting, I want to keep my .bat as simple as possible and avoid cd'ing to the different directories.
Any ideas how I can run hg pull -u
on a different directory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
-R
-switch:请参阅
hg -v help pull
了解hg pull
的所有命令行选项(-v< /code> 开关告诉帮助包含全局选项)。
Use the
-R
-switch:See
hg -v help pull
for all command line options ofhg pull
(the-v
switch tells help to include global options).很久之后发现了这个问题,因为我正在为自己的计算机编写一个脚本,而不是批处理脚本,我是在 PowerShell 中完成的(因为您提到它在服务器上,所以我假设 PS 可用)。这可以处理 Subversion 和 Mercurial 存储库:
Found this question quite a bit later due to a script I was working on for my own computer, and rather than a batch script, I did it in PowerShell (since you mentioned it's on a server, I assumed PS was available). This handles both Subversion and Mercurial repositories: