scripts/chg-len.py
author Alpar Juttner <alpar@cs.elte.hu>
Wed, 25 Aug 2010 21:34:58 +0200
changeset 742 16d466589b54
parent 376 4b2382fd80ef
permissions -rwxr-xr-x
Backport the CMAKE related changesets from the main branch

[e20fecd1945f] Add check target for CMake (#388)
[e74b5db4f2c6] Put the output of chg-len.py in the version string (#389)
[7d166b8b8018] Safer call of ./scripts/chg-len.py on Windows (#389)
[659ba4805a48] Make CMAKE config more consistent with configure.ac (#390)
[63e4468c680e] Add 'Maintainer' CMAKE build type (#388, #390)
[a725503acfe9] Allow CPACK configuration on all platforms
[10242c611190] Create and install lemon.pc (#393)
[48e29534cf03] The deafult target doesn't build lp_test and mip_test (#388)
[0fbbdd578c06] Full path for DoxygenLayout.xml in Doxyfile.in (#395)
[481496e6d71f] SOURCE_BROWSER Doxygen switch is configurable from CMAKE (#395)
[09282720100b] update-external-tags CMAKE target (#395)
     1 #! /usr/bin/env python
     2 
     3 import sys
     4 
     5 from mercurial import ui, hg
     6 from mercurial import util
     7 
     8 util.rcpath = lambda : []
     9 
    10 if len(sys.argv)>1 and sys.argv[1] in ["-h","--help"]:
    11     print """
    12 This utility just prints the length of the longest path
    13 in the revision graph from revison 0 to the current one.
    14 """
    15     exit(0)
    16 
    17 u = ui.ui()
    18 r = hg.repository(u, ".")
    19 N = r.changectx(".").rev()
    20 lengths=[0]*(N+1)
    21 for i in range(N+1):
    22     p=r.changectx(i).parents()
    23     if p[0]:
    24         p0=lengths[p[0].rev()]
    25     else:
    26         p0=-1
    27     if len(p)>1 and p[1]:
    28         p1=lengths[p[1].rev()]
    29     else:
    30         p1=-1
    31     lengths[i]=max(p0,p1)+1
    32 print lengths[N]