Location: LEMON/LEMON-official/scripts/chg-len.py

Load file history
gravatar
ladanyi@tmit.bme.hu
Revert to the canonical way of customizing CXXFLAGS A default list of compiler flags is set via AM_CXXFLAGS Automake variable. However this gets overridden by per-target CXXFLAGS variables (e.g. foo_CXXFLAGS in case the foo target). Because of this you should append $(AM_CXXFLAGS) to the end of the per-target CXXFLAGS variables (e.g. foo_CXXFLAGS = ... $(AM_CXXFLAGS)). After this default list of flags the contents of the CXXFLAGS user variable is passed to the compiler. This variable has a default value determined by configure (in case of g++ it is '-g -O2'). You can override this by specifying CXXFLAGS when invoking make (e.g. make CXXFLAGS='-O3').
#! /usr/bin/env python
import sys
import os
if len(sys.argv)>1 and sys.argv[1] in ["-h","--help"]:
print """
This utility just prints the length of the longest path
in the revision graph from revison 0 to the current one.
"""
exit(0)
plist = os.popen("HGRCPATH='' hg parents --template='{rev}\n'").readlines()
if len(plist)>1:
print "You are in the process of merging"
exit(1)
PAR = int(plist[0])
f = os.popen("HGRCPATH='' hg log -r 0:tip --template='{rev} {parents}\n'").\
readlines()
REV = -1
lengths=[]
for l in f:
REV+=1
s = l.split()
rev = int(s[0])
if REV != rev:
print "Something is seriously wrong"
exit(1)
if len(s) == 1:
par1 = par2 = rev - 1
elif len(s) == 2:
par1 = par2 = int(s[1].split(":")[0])
else:
par1 = int(s[1].split(":")[0])
par2 = int(s[2].split(":")[0])
if rev == 0:
lengths.append(0)
else:
lengths.append(max(lengths[par1],lengths[par2])+1)
print lengths[PAR]