来自命令行的 TortoiseSVN 和“IF ERRORLEVEL”?

发布于 2024-07-29 03:45:23 字数 726 浏览 6 评论 0原文

我有一个批处理文件,正在 Windows XP w/service pack 3 工作站上运行,该文件使用 SQL 2005 中的 sqlcmd.exe 将 SQL 更改应用到数据库。

我有一个 TortoiseSVN 自动更新我的存储库的本地副本,如下所示:

tortoiseproc /command:update /path:"C:/SVN/My Code/Dev/2009.07.23" /closeonend:3

根据 文档,如果更新期间发生任何错误、冲突或合并,/closeonend:3 选项将使 TortoiseSVN 对话框保持打开状态。

如果确实发生这种情况,并且用户关闭对话框而不解决问题,他们可能会忽略我们想要应用于给定分支的测试数据库的更改。

当 TortoiseSVN 对话框因更新后出现错误、冲突或合并而关闭时,ERRORLEVEL 是否会设置为某个非零值,使我能够绕过批处理文件的其余部分? 或者即使代码不太正确,它也会高兴地返回 0 来表明它成功完成了工作?

I have a batch file I'm running from a Windows XP w/service pack 3 workstation which applies SQL changes to a database using sqlcmd.exe in SQL 2005.

I've got a command-line entry for TortoiseSVN to automatically update the local copy of my repository like so:

tortoiseproc /command:update /path:"C:/SVN/My Code/Dev/2009.07.23" /closeonend:3

According to the documentation, the /closeonend:3 option will leave the TortoiseSVN dialog box open if any errors, conflicts or merges occur during the update.

If such does occur, and the user closes the dialog without resolving the issues, they could potentially omit changes we want applied to a given branch's test database.

When the TortoiseSVN dialog box is closed in the case of an error, conflict, or merge following an update, will the ERRORLEVEL be set to some nonzero value, enabling me to bypass the rest of the batch file? Or will it happily return 0 to indicate it did its job successfully even if the code isn't quite right?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

各自安好 2024-08-05 03:45:23

老问题,但我今天遇到了同样的事情,并且有一个解决方案...

TortoiseProc 在错误时返回 -1,在成功时返回 0,所以以下内容为我解决了问题:

TortoiseProc /path:"%targetdir%" /command:update /closeonend:3
IF %ERRORLEVEL% NEQ 0 goto SvnError

:SvnSuccess
echo It worked!
goto Done

:SvnError
echo It didn't work!

:Done

Old question, but I encountered the same thing today and there is a solution...

TortoiseProc returns -1 on error and 0 on success, so the following solved the problem for me:

TortoiseProc /path:"%targetdir%" /command:update /closeonend:3
IF %ERRORLEVEL% NEQ 0 goto SvnError

:SvnSuccess
echo It worked!
goto Done

:SvnError
echo It didn't work!

:Done
淡水深流 2024-08-05 03:45:23

我最终只是在执行批处理文件中的其他操作之前手动更新本地 SVN 存储库。

I ended up just manually updating my local SVN repository prior to performing the other actions in the batch file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文