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>
* src/interface.c, src/ui_utils.c, geany.glade:
......
......@@ -46,11 +46,25 @@ AC_CHECK_FUNCS([gethostname ftruncate fgetpos mkstemp regcomp strerror strstr])
# 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`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
......
......@@ -95,19 +95,32 @@ geany_sources = [
def configure(conf):
def conf_get_svn_rev():
# 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:
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:
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:
pass
else
pass
return '-1'
def conf_get_pkg_ver(pkgname):
......
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