开发者

Calling Tortoise from command line and build if new code (how to know if tortoise updated anything)?

I am writing a batch file which is supposed to update the source files from tortoise and - if anything new was gotten - bu开发者_运维百科ild the solution. Should be a very simple task.

My batchfile looks like this (I've removed the non-essentials)

set updatepath=%1
set solution=%2
set output=%3.txt

call TortoiseProc.exe /command:update /path:%updatepath% /closeonend:2    
call %devenv% %solution% /Build Debug /Out %output%

Now, I'd like to know if tortoise actually got new code for me and the not build if it didn't. How do I do this?

I am running Windows Vista

(The batch script is called from another batch script about 7 times - one for each project I need updated and - perhaps - build).


Using tortoise is probably not the best way to resolve the problem.

To begin with, it would help knowing which SCM you're using (Mercurial, Subversion, CVS...). Most (all?) SCM tools come with a command-line interface, as opposed to the tortoise shell extension. If you used e.g. mercurial, this is how you would check if the local files need updating:

d:\projects\myproj> hg incoming <main repository path>

You could then parse the output to check if there are pending changes. A similar approach would work with other SCMs.


TortoiseProc is not meant for this kind of automation:

Remember that TortoiseSVN is a GUI client, and this automation guide shows you how to make the TortoiseSVN dialogs appear to collect user input. If you want to write a script which requires no input, you should use the official Subversion command line client instead.

http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-automation.html

So, first, get the command line client ( SlikSVN is my favourite). Note that update in TortoiseProc doesn't bring the dialog in the way you are using, but calling it seven times, you are better off using svn command line client.

Second, use svn status -u to see if there are updates in the repo. --show-updates or -u places an asterisk next to items that are out of date. You can probably grep it.

If so, use svn update to update your working copy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜