Kaydet (Commit) 27a58d1b authored tarafından Enrico Tröger's avatar Enrico Tröger

Add support for retrieving the SVN revision number also when using a git-svn.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2823 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst dd51f0ea
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> 2008-07-25 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/interface.c, src/ui_utils.c, geany.glade: * src/interface.c, src/ui_utils.c, geany.glade:
......
...@@ -46,11 +46,25 @@ AC_CHECK_FUNCS([gethostname ftruncate fgetpos mkstemp regcomp strerror strstr]) ...@@ -46,11 +46,25 @@ AC_CHECK_FUNCS([gethostname ftruncate fgetpos mkstemp regcomp strerror strstr])
# autoscan end # autoscan end
# get svn revision # get svn revision (try GIT first, then check for SVN)
SVN=`which svn 2>/dev/null` REVISION="r0"
if test -d ".svn" -a "x${SVN}" != "x" -a -x "${SVN}" GIT=`which git 2>/dev/null`
if test -d ".git" -a "x${GIT}" != "x" -a -x "${GIT}"
then
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 then
REVISION=r`$SVN info|grep 'Last Changed Rev'|cut -d' ' -f4`
# force debug mode for a SVN working copy # force debug mode for a SVN working copy
CFLAGS="-g -DGEANY_DEBUG $CFLAGS" CFLAGS="-g -DGEANY_DEBUG $CFLAGS"
else else
......
...@@ -95,20 +95,33 @@ geany_sources = [ ...@@ -95,20 +95,33 @@ geany_sources = [
def configure(conf): def configure(conf):
def conf_get_svn_rev(): def conf_get_svn_rev():
try: # try GIT
p = subprocess.Popen(['svn', 'info', '--non-interactive'], stdout=subprocess.PIPE, \ if os.path.exists('.git'):
stderr=subprocess.STDOUT, close_fds=False, env={'LANG' : 'C'}) cmds = [ 'git svn find-rev HEAD 2>/dev/null',
stdout = p.communicate()[0] 'git svn find-rev origin/trunk 2>/dev/null',
'git svn find-rev trunk 2>/dev/null',
if p.returncode == 0: '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) lines = stdout.splitlines(True)
for line in lines: for line in lines:
if line.startswith('Last Changed Rev'): if line.startswith('Last Changed Rev'):
key, value = line.split(': ', 1) key, value = line.split(': ', 1)
return value.strip() return value.strip()
return '-1' except:
except: pass
return '-1' else
pass
return '-1'
def conf_get_pkg_ver(pkgname): def conf_get_pkg_ver(pkgname):
ret = os.popen('PKG_CONFIG_PATH=$PKG_CONFIG_PATH pkg-config --modversion %s' % pkgname).read().strip() ret = os.popen('PKG_CONFIG_PATH=$PKG_CONFIG_PATH pkg-config --modversion %s' % pkgname).read().strip()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment