On Thu, Jan 6, 2011 at 6:16 AM, James Paige <b...@hamsterrepublic.com> wrote: > On Thu, Jan 06, 2011 at 08:02:20AM +1300, Ralph Versteegen wrote: >> However f you don't build out of an svn or git repository (for >> example, if you download the nightly source) then you'll get a >> revision number of 0, which is awfully inconvenient. It would be nice >> the the build system cached the last know revision number somehow. >> Maybe this could also solve the problem of 'git svn info' taking >> longer than the actual compile under Windows! git-svn is written in >> fork-crazy perl, and spawning a process is something like thousands of >> times slower than it is on any Unix. just for comparison: 'git svn info' on the git-svn mirror of OHRRPGCE takes about 4 seconds.
>> >> Anyway, if that problem is solved, I'm much in favour of it. what about 'git log --grep=git-svn-id |grep -oEe 'ohrrpgce/.+@([0-9]+)'|head -n 1|grep -oEe '[0-9]+' ' ? (as a demo) outputs '4085' on my current checkout. Designed to handle the case where you have one or more commits that haven't yet been committed to SVN, only locally, as well as the case where you don't. The idea, if you don't speak grep-ese, is simply to find the log entries with 'git-svn-id' on some line, take the first one, and extract the bit of text following 'ohrrpgce/SVNBRANCHNAME@' (stopping at the next space) Writing a little FB program to do that would probably be the most portable solution. .. it's been ages since I actually wrote any BASIC. pseudo-ish code follows: ' ** get the output of "git log --grep=git-svn-id" (could be done in advance by the build system) ** ' ** read lines until INSTR (thisline, "git-svn-id") > 0 ** ' and now find the part of the line we want svnspecstart = INSTR (thisline, "svn://") svnspecnumstart = INSTR (thisline, '@', svnspecstart) + 1 svnspecnumend = INSTR (thisline, ' ', svnspecnumstart) version = MID (thisline, svnspecnumstart, svnspecnumend - svnspecnumstart) PRINT version _______________________________________________ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org