SVN Revision # in sysinfo and debug logs
#1
Not really a bug so much as a question. Now that SVN is in use, each commit changes the Revision # for the project. This gives us something approximating a version number. Are people going to start using the Revision # as a way to quickly identify the build you are running? It would seem to me this would speed up debugging since if you know what revision someone is running you know exactly what commits they do and do not have.
Reply
#2
I believe T3CH tacked the revision number on the end of their last build (at least in the .rar name)

Not sure whether we can get it to show the revision number in sysinfo or not (and on boot etc.), but yes - bug reports with revision numbers would be helpful. Dates ofcourse are more "people friendly".

Anyone know how to automate that?
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
Currently I have this in my customized Build.bat:
svn info SVN>"SVN\BUILD\SVN Info.txt"
That outputs the following text to "SVN Info.txt":

Path: SVN
URL: https://XBMC.svn.sourceforge.net/svnroot...trunk/XBMC
Repository Root: https://XBMC.svn.sourceforge.net/svnroot/xbmc
Repository UUID: 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Revision: 7323
Node Kind: directory
Schedule: normal
Last Changed Author: darkdonno
Last Changed Rev: 7323
Last Changed Date: 2006-12-07 04:33:02 -0800 (Thu, 07 Dec 2006)


I haven't successfully found any command-line utilities to process that output down to just the # so it can be dumped into a variable for use within the batch. I got close, but basically there is no simple string processing utility for the windows command-line. I need to get off the ground with programming and then perhaps I could write one, since I basically just need a command-line wrapper for the standard string methods, but blah.
For now, I am just putting the file SVN Info.txt in the root of my builds so I can take a look at it as needed...
Reply
#4
The last line of a successful checkout is
"Checked out revision 7341."

This might be easier to parse with built in dos commands.

HTH
J
Reply
#5
I actually have the issue ALMOST figured out, just can't remember the syntax to set a variable from a file's contents. I know this is do-able, as I had it working in one of my older scripts, but lost my scripts folder when I accidentally deleted it Sad I will post my working script probably tomorrow...
Reply
#6
I am using a command-line text processor called Swiss File Knife (AKA sfk.exe) to do the text processing.
here's my code:
Quote:svn info SVN|sfk filter -!Path -!URL -!Rep -!Node -!Sche -!Last -replace _"Revision: "__>Revision.txt
SET /P REVISION=<Revision.txt
DEL Revision.txt /Q
ECHO YO IT BE %REVISION%
of course, this is just example code, I am using the %REVISION% variable to do the filenaming of the 7zip archive my batch outputs. Also, the directory where my local source is stored is named SVN, thus the first command "svn info SVN"
Reply
#7
have you tried

svn propget svn:log --revision

not sure about the format
Reply
#8
could never work out the syntax for that.
here's the Help on PropGet:
propget (pget, pg): Print the value of a property on files, dirs, or revisions.
usage: 1. propget PROPNAME [TARGET[@REV]...]
2. propget PROPNAME --revprop -r REV [TARGET]

1. Prints versioned props. If specified, REV determines in which
revision the target is first looked up.
2. Prints unversioned remote prop on repos revision.
TARGET only determines which repository to access.

By default, this subcommand will add an extra newline to the end
of the property values so that the output looks pretty. Also,
whenever there are multiple paths involved, each property value
is prefixed with the path with which it is associated. Use
the --strict option to disable these beautifications (useful,
for example, when redirecting binary property values to a file).

Valid options:
-R [--recursive] : descend recursively
-r [--revision] arg : ARG (some commands also take ARG1:ARG2 range)
A revision argument can be one of:
NUMBER revision number
'{' DATE '}' revision at start of the date
'HEAD' latest in repository
'BASE' base rev of item's working copy
'COMMITTED' last commit at or before BASE
'PREV' revision just before COMMITTED
--revprop : operate on a revision property (use with -r)
--strict : use strict semantics
--username arg : specify a username ARG
--password arg : specify a password ARG
--no-auth-cache : do not cache authentication tokens
--non-interactive : do no interactive prompting
--config-dir arg : read user configuration files from directory ARG

My method works, so I am pleased with it. I added a fork to my script to check to see if a new build is neccessary, that was fun Smile
Reply
#9
What in unix would look like:

REVISION=`grep Revision Revision.txt | awk '{print $2}'`

...would be in Windows:

Create a bat-file looking like:

@echo OFF
cscript c:\Revision.vbs > NULL
set revision=%errorlevel%

and

then a vbs-script called Revision.vbs

Code:
Option Explicit

'-----------------------------------------
' Constants
'-----------------------------------------    


    Const FilePath = "C:\"
    Const FileName = "Revision.txt"
    Const SearchString = "revision"

'-----------------------------------------
' Variables
'-----------------------------------------    

    Dim fso
    Dim Filehandle
    Dim i
    Dim strNextLine
    Dim z
    Dim pos
    Dim RetStr

'-----------------------------------------
' Initialize
'-----------------------------------------

    Set fso = Wscript.CreateObject("Scripting.FileSystemObject")

'-----------------------------------------
' Code Begin
'-----------------------------------------

i = 0
z = 0

If(fso.FileExists(FilePath & FileName)) Then
    Set Filehandle = fso.OpenTextFile(FilePath & FileName, 1, 0)

    Do Until Filehandle.AtEndOfStream
        strNextLine = Filehandle.Readline
        i = i + 1
    Loop

    Filehandle.Close

    Set Filehandle = fso.OpenTextFile(FilePath & FileName, 1, 0)
    
    Do While z < i
        strNextLine = FileHandle.Readline
        z = z + 1
        pos = InStr(strNextLine, SearchString)
        If pos <> 0 Then
            pos = InStrRev(strNextLine, " ")
            RetStr = Right(strNextLine, (Len(strNextLine) - pos))
        End If            
    Loop
Else
    msgbox "File Not Found"
End If

Wscript.Quit (RetStr)
Reply
#10
You can do this with DOS batch commands.

The first .svn folder in your checkout folder has a file called "entries". This file has the last revision number at line 4.

So I use the following, where %WorkFolder% is the checkout folder (If anyone knows how to redirect to the set command and bypass the file creation or limit the FOR command to line 4 please post):

Code:
TYPE "%WorkFolder%\.svn\entries" | FIND /v /n "&_&_&_&" | FIND "[4]" > "%WorkFolder%\revision.txt"
FOR /F "UseBackQ Tokens=2 Delims=]" %%r IN ("%WorkFolder%\revision.txt") DO SET Revision=%%r
DEL "%WorkFolder%\revision.txt"
If /I "%IncludeDate%"=="y" (
If NOT "%Filename%"=="" (
Set Filename=%Filename%_%Revision%
Set ReplaceString=%ReplaceString% ^(%BuildDate%^)
) Else (
Set Filename=%Revision%
)
)
Reply

Logout Mark Read Team Forum Stats Members Help
SVN Revision # in sysinfo and debug logs0