scripts/chg-len.py
author Balazs Dezso <deba@inf.elte.hu>
Tue, 02 Dec 2008 22:48:28 +0100
changeset 459 ed54c0d13df0
parent 376 4b2382fd80ef
child 733 abf31e4af617
permissions -rwxr-xr-x
Thorough redesign of the LP/MIP interface (#44)

- Redesigned class structure
- Redesigned iterators
- Some functions in the basic interface redesigned
- More complete setting functions
- Ray retrieving functions
- Lot of improvements
- Cplex common env
- CLP macro definition to config.h.in
- Update lp.h to also use soplex and clp
- Remove default_solver_name
- New solverName() function in solvers
- Handle exceptions for MipCplex test
- Rename tolerance parameter to epsilon
- Rename MapIt to CoeffIt
- Lot of documentation improvements
- Various bugfixes
     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]