什么导致SVN“工作副本<路径>被锁定”?

sab*_*669 4 tortoise-svn svn batch-file

我编写了一个控制台应用程序,它使用 SharpSVN 来更新我的存储库中的 3 个文件夹。想将其转换为批处理脚本以消除对 SharpSVN 的依赖。

想出了这个:

CD C:\Program Files\TortoiseSVN\bin\
START TortoiseProc.exe /command:update /path:"C:\AMG\trunk\AMG_AccountManager\AMC\Core" /closeonend:0
START TortoiseProc.exe /command:update /path:"C:\AMG\trunk\AMG_AccountManager\AMC\Modules" /closeonend:0
START TortoiseProc.exe /command:update /path:"C:\AMG\trunk\AMG_AccountManager\MW" /closeonend:0
Run Code Online (Sandbox Code Playgroud)

我发现这是另一个 SO 问题的答案。当我运行它时,我从 Tortoise 中弹出 3 个窗口。

一个说:

Error: Working copy 'C:\AMG\trunk\AMG_AccountManager\AMC' locked.
Error: 'C:\AMG\trunk\AMG_AccountManager\AMC' is already locked.

第二个说:

Error: Working copy 'C:\AMG\trunk\AMG_AccountManager' locked.
Error: 'C:\AMG\trunk\AMG_AccountManager\AMC' is already locked.

第三个成功更新了 Modules 文件夹。有谁知道是什么导致前两个被锁定?

sab*_*669 5

找到了我的问题的答案。基本上,Tortoise 会在尝试执行某些操作时锁定文件夹。我的脚本只是立即启动了 3 个更新程序,而没有等待前一个更新程序完成。

START命令有一个/wait标志,等待它运行的任何内容退出,所以我修改了我的脚本如下:

CD C:\Program Files\TortoiseSVN\bin\
START /wait TortoiseProc.exe /command:update /path:"C:\AMG\trunk\AMG_AccountManager\AMC\Core" /closeonend:1
START /wait TortoiseProc.exe /command:update /path:"C:\AMG\trunk\AMG_AccountManager\AMC\Modules" /closeonend:1
START /wait TortoiseProc.exe /command:update /path:"C:\AMG\trunk\AMG_AccountManager\MW" /closeonend:1
Run Code Online (Sandbox Code Playgroud)

不幸的是,我必须关闭 Tortoise 打开的更新窗口才能使脚本完全自动化。这意味着我无法观察修改或添加了哪些文件。