Getting latest revision from a batch file

1,833 views
Skip to first unread message

Greg McCarthy

unread,
Jul 18, 2010, 12:22:40 PM7/18/10
to us...@tortoisesvn.tigris.org
I'm busying trying to automate a svn update using a batch file. If the
revision number has changed then I need to compile the application.

So far the svn update is easy using:
TortoiseProc.exe /command:update /path:"c:\svn" /closeonend:1

I would however like to get the latest revision number via a batch
file and into a variable so if its changed then call the compile
script.

Is there a easy way to do this. I found a post on another site for a
different svn app and they use:

svn info --revision HEAD

and then a FOR in the batch file to get the revision version. Can this
somehow be applied to tortoise?

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2634775

To unsubscribe from this discussion, e-mail: [users-un...@tortoisesvn.tigris.org].

Kevin Grover

unread,
Jul 18, 2010, 2:54:24 PM7/18/10
to us...@tortoisesvn.tigris.org

This is probably an FAQ. TSVN is a GUI (graphical user interface),
not a CLI (command line interface). Just get the CLI interface and
install it and then you will have 'svn', 'svnadmin', ...

These can be used from batch files/scripts. There is an included
utility called 'svnversion' that it what you want.

IMO it would be _really_ nice if TSVN included the CLI binaries ---
it's a pain for me to have to DL and install the CLI binaries when I
update TSVN. I've heard reasons why they are not included (size and
most people probably don't want them). It's not a criticism, just a
personal preference. I'm wondering what the TSVN group uses for CLI
binaries, I find it hard to believe that 'power users' would not want
a CLI interface for scripting.

The windows binaries on the Subversion site are old. I get them from
the Slik SVN site (http://www.sliksvn.com/en/download). They are very
current and easy to install. There are several other sites where you
can get current builds, most also over some sort of svn services.

Cheers

- Kevin

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2634847

Stefan Küng

unread,
Jul 18, 2010, 3:04:42 PM7/18/10
to us...@tortoisesvn.tigris.org
On 18.07.2010 18:22, Greg McCarthy wrote:
> I'm busying trying to automate a svn update using a batch file. If the
> revision number has changed then I need to compile the application.
>
> So far the svn update is easy using:
> TortoiseProc.exe /command:update /path:"c:\svn" /closeonend:1
>
> I would however like to get the latest revision number via a batch
> file and into a variable so if its changed then call the compile
> script.
>
> Is there a easy way to do this. I found a post on another site for a
> different svn app and they use:
>
> svn info --revision HEAD
>
> and then a FOR in the batch file to get the revision version. Can this
> somehow be applied to tortoise?

Use the SubWCRev tool that comes with TSVN:
http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-subwcrev.html

Stefan

--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest Interface to (Sub)Version Control
/_/ \_\ http://tortoisesvn.net

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2634850

Greg McCarthy

unread,
Jul 18, 2010, 3:09:53 PM7/18/10
to us...@tortoisesvn.tigris.org
Awesome. Thanks. Just what I was looking for.

On 18/07/2010 21:04 PM, Stefan Küng wrote:
>
> Use the SubWCRev tool that comes with TSVN:
> http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-subwcrev.html
>
> Stefan
>
>

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2634852

Alexander

unread,
Jul 18, 2010, 11:25:14 PM7/18/10
to us...@tortoisesvn.tigris.org
On Jul 19, 1:09 am, Greg McCarthy <mccarthy.g...@gmail.com> wrote:
> Awesome. Thanks. Just what I was looking for.

You got already some useful hints, but I think - you had not so
correct imagination about your real task
Let's think
1. If YOU commit into repo - revision will change
2. If ANYBODY commit into monitored by you repository tree - revision
will change
Thus - you haven't test revision number changing - it happens ALWAYS

So, good plan (for me) may be
1. Post-commit hook in TSVN for rebuild project after your own commits
2. CommitMonitor (thanks to Stefan) for monitoring other commits with
"script, when new revisions detected" ("svn update", "build" -
identical to action in post-commit hook)
3. Nothing more!

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2634954

Reply all
Reply to author
Forward
0 new messages