Merge
authorAlpar Juttner <alpar@cs.elte.hu>
Mon, 22 Sep 2008 08:12:44 +0100
changeset 2750821fea54d53
parent 274 2a33883915bb
parent 273 5d12d5c80ac9
child 276 b4784a66a8e6
Merge
     1.1 --- a/configure.ac	Sun Sep 21 18:23:07 2008 +0100
     1.2 +++ b/configure.ac	Mon Sep 22 08:12:44 2008 +0100
     1.3 @@ -1,9 +1,15 @@
     1.4  dnl Process this file with autoconf to produce a configure script.
     1.5  
     1.6  dnl Version information.
     1.7 -m4_define([lemon_version_number], [])
     1.8 +m4_define([lemon_version_number],
     1.9 +	[m4_normalize(esyscmd([echo ${LEMON_VERSION}]))])
    1.10 +dnl m4_define([lemon_version_number], [])
    1.11 +m4_define([lemon_hg_path], [m4_normalize(esyscmd([./scripts/chg-len.py]))])
    1.12  m4_define([lemon_hg_revision], [m4_normalize(esyscmd([hg id -i]))])
    1.13 -m4_define([lemon_version], [ifelse(lemon_version_number(), [], [lemon_hg_revision()], [lemon_version_number()])])
    1.14 +m4_define([lemon_version], [ifelse(lemon_version_number(),
    1.15 +			   [],
    1.16 +			   [lemon_hg_path().lemon_hg_revision()],
    1.17 +			   [lemon_version_number()])])
    1.18  
    1.19  AC_PREREQ([2.59])
    1.20  AC_INIT([LEMON], [lemon_version()], [lemon-user@lemon.cs.elte.hu], [lemon])
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/scripts/chg-len.py	Mon Sep 22 08:12:44 2008 +0100
     2.3 @@ -0,0 +1,39 @@
     2.4 +#! /usr/bin/env python
     2.5 +
     2.6 +import sys
     2.7 +import os
     2.8 +
     2.9 +if len(sys.argv)>1 and sys.argv[1] in ["-h","--help"]:
    2.10 +    print """
    2.11 +This utility just prints the length of the longest path
    2.12 +in the revision graph from revison 0 to the current one.
    2.13 +"""
    2.14 +    exit(0)
    2.15 +plist = os.popen("hg parents --template='{rev}\n'").readlines()
    2.16 +if len(plist)>1:
    2.17 +    print "You are in the process of merging"
    2.18 +    exit(1)
    2.19 +PAR = int(plist[0])
    2.20 +
    2.21 +f = os.popen("hg log -r 0:tip --template='{rev} {parents}\n'").readlines()
    2.22 +REV = -1
    2.23 +lengths=[]
    2.24 +for l in f:
    2.25 +    REV+=1
    2.26 +    s = l.split()
    2.27 +    rev = int(s[0])
    2.28 +    if REV != rev:
    2.29 +        print "Something is seriously wrong"
    2.30 +        exit(1)
    2.31 +    if len(s) == 1:
    2.32 +        par1 = par2 = rev - 1
    2.33 +    elif len(s) == 2:
    2.34 +        par1 = par2 = int(s[1].split(":")[0])
    2.35 +    else:
    2.36 +        par1 = int(s[1].split(":")[0])
    2.37 +        par2 = int(s[2].split(":")[0])
    2.38 +    if rev == 0:
    2.39 +        lengths.append(0)
    2.40 +    else:
    2.41 +        lengths.append(max(lengths[par1],lengths[par2])+1)
    2.42 +print lengths[PAR]