Looking-up trunk release number to use in a program script

19 views
Skip to first unread message

tsuc...@googlemail.com

unread,
Feb 28, 2020, 2:21:48 PM2/28/20
to TortoiseSVN
At first, I apologise profusely if I'm asking something well documented.  I've found various pages in the TortoiseSVN manual that may point to a solution, but I'm just not clever enough to understand well.  .(-_-).

I want to find out the HEAD release number of an SVN repository, in a form that I can access from another program.
For example, if there way of looking-up the HEAD revision at the command line and writing it to a file that could be read by another script, that would be fine.

In case it's helpful background
- We are building a JS application using the 'MS Studio Code' editor.
- Sometimes we make an obfuscated build from the HEAD code one one repository, and commit it to a different repository.  And in the commit to the latter repo, we want to include the revision number on which it is based, without entering it by hand.

If there's some hint anybody can offer, I'd really appreciate it.

Stefan

unread,
Feb 28, 2020, 2:25:42 PM2/28/20
to TortoiseSVN
you don't want the HEAD revision but the revision your working copy is on, because you're building your project in your working copy. Imagine you use HEAD but you missed that someone else committed a change (or even multiple changes) while you build your project. Then HEAD would be pointing to a revision which changes you don't have in your build.

What you want is the SubWCRev tool that is included in TSVN:
and use the $WCREV$ keyword.

Stefan

tsuc...@googlemail.com

unread,
Feb 28, 2020, 3:23:32 PM2/28/20
to TortoiseSVN
Thanks very much Stefan... that puts me very much on the right track.  Really fantastic!!

Niemann, Hartmut

unread,
Mar 2, 2020, 2:56:42 AM3/2/20
to TortoiseSVN

Hello!

 

I use

                svnversion <workingcopypath>

for that.

As I need to contruct file names from that, I need to handle ranges and the “modified-“M specially. You might to do that differently.

On windows, this goes like this:

 

(%1 is the path I need to get info from)

 

SET SVNREVISION=%1 not found

 

FOR /F "usebackq" %%V IN (`svnversion %1`) DO SET SVNREVISION=%%V

:: das kann auch 4321M oder 4321:4333M sein!

 

SET SVNREVISION=%SVNREVISION::=-%

:: SVNREVISION ist ein gültiger Dateinamensbestandteil, weil das Skript den Doppelpunkt durch Minuszeichen ersetzt

 

:: Check auf Buchstaben oder Doppelpunkt (SVN-Range)

 

 

 

SET SV__TMO__=X

SET /A SV__TMO__=%SVNREVISION% + 0

IF %SV__TMO__%==%SVNREVISION% (

                ECHO %1: Single Version found: %SVNREVISION%

                set SVNVERSION=%SVNREVISION%

) ELSE (

                echo %1: Version range %SVNREVISION% found, setting SVNVERSION to 9999

                SET SVNVERSION=9999

                EXIT /B 1

)

EXIT /B 0

 

Hope that helps

 

Hartmut.

--
You received this message because you are subscribed to the Google Groups "TortoiseSVN" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tortoisesvn...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tortoisesvn/35fd2072-f4e5-4f00-aef5-16974479a315%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages