Revision: 2823 http://geany.svn.sourceforge.net/geany/?rev=2823&view=rev Author: eht16 Date: 2008-07-27 18:38:21 +0000 (Sun, 27 Jul 2008)
Log Message: ----------- Add support for retrieving the SVN revision number also when using a git-svn.
Modified Paths: -------------- trunk/ChangeLog trunk/configure.in trunk/wscript
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-07-25 15:10:53 UTC (rev 2822) +++ trunk/ChangeLog 2008-07-27 18:38:21 UTC (rev 2823) @@ -1,3 +1,10 @@ +2008-07-27 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * configure.in, wscript: + Add support for retrieving the SVN revision number also + when using a git-svn. + + 2008-07-25 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/interface.c, src/ui_utils.c, geany.glade:
Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2008-07-25 15:10:53 UTC (rev 2822) +++ trunk/configure.in 2008-07-27 18:38:21 UTC (rev 2823) @@ -46,11 +46,25 @@ # autoscan end
-# get svn revision -SVN=`which svn 2>/dev/null` -if test -d ".svn" -a "x${SVN}" != "x" -a -x "${SVN}" +# get svn revision (try GIT first, then check for SVN) +REVISION="r0" +GIT=`which git 2>/dev/null` +if test -d ".git" -a "x${GIT}" != "x" -a -x "${GIT}" then - REVISION=r`$SVN info|grep 'Last Changed Rev'|cut -d' ' -f4` + REVISION=r`git svn find-rev origin/trunk 2>/dev/null || + git svn find-rev trunk 2>/dev/null || git svn find-rev HEAD 2>/dev/null || + git svn find-rev master 2>/dev/null || echo 0` +fi +if test "x${REVISION}" = "xr0" +then + SVN=`which svn 2>/dev/null` + if test -d ".svn" -a "x${SVN}" != "x" -a -x "${SVN}" + then + REVISION=r`$SVN info|grep 'Last Changed Rev'|cut -d' ' -f4` + fi +fi +if test "x${REVISION}" != "xr0" +then # force debug mode for a SVN working copy CFLAGS="-g -DGEANY_DEBUG $CFLAGS" else
Modified: trunk/wscript =================================================================== --- trunk/wscript 2008-07-25 15:10:53 UTC (rev 2822) +++ trunk/wscript 2008-07-27 18:38:21 UTC (rev 2823) @@ -95,20 +95,33 @@
def configure(conf): def conf_get_svn_rev(): - try: - p = subprocess.Popen(['svn', 'info', '--non-interactive'], stdout=subprocess.PIPE, \ - stderr=subprocess.STDOUT, close_fds=False, env={'LANG' : 'C'}) - stdout = p.communicate()[0] - - if p.returncode == 0: + # try GIT + if os.path.exists('.git'): + cmds = [ 'git svn find-rev HEAD 2>/dev/null', + 'git svn find-rev origin/trunk 2>/dev/null', + 'git svn find-rev trunk 2>/dev/null', + 'git svn find-rev master 2>/dev/null' ] + for c in cmds: + try: + stdout = Utils.cmd_output(c) + if stdout: + return stdout.strip() + except: + pass + # try SVN + elif os.path.exists('.svn'): + try: + stdout = Utils.cmd_output('svn info --non-interactive', {'LANG' : 'C'}) lines = stdout.splitlines(True) for line in lines: if line.startswith('Last Changed Rev'): key, value = line.split(': ', 1) return value.strip() - return '-1' - except: - return '-1' + except: + pass + else + pass + return '-1'
def conf_get_pkg_ver(pkgname): ret = os.popen('PKG_CONFIG_PATH=$PKG_CONFIG_PATH pkg-config --modversion %s' % pkgname).read().strip()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.