Location: LEMON/LEMON-official/scripts/chg-len.py - annotation
Load file history
Fixes for MSVC 2008 in grap_adaptors.h and edge_set.h (#194)
Several renamings and changes in adaptors and edge sets
- Fixing scope usage for MSVC
- ResidualDigraph based on SubDigraph instead of FilterArcs
- Use initialize() in adaptors and edge sets
- Wrap ListDigraph for edge set tests
r272:e63a95b68827 r272:e63a95b68827 r272:e63a95b68827 r390:4b2382fd80ef r390:4b2382fd80ef r439:62c1ed05e83f r439:62c1ed05e83f r439:62c1ed05e83f r272:e63a95b68827 r272:e63a95b68827 r272:e63a95b68827 r272:e63a95b68827 r272:e63a95b68827 r272:e63a95b68827 r272:e63a95b68827 r272:e63a95b68827 r390:4b2382fd80ef r390:4b2382fd80ef r390:4b2382fd80ef r390:4b2382fd80ef r390:4b2382fd80ef r390:4b2382fd80ef r390:4b2382fd80ef r390:4b2382fd80ef r272:e63a95b68827 r390:4b2382fd80ef r390:4b2382fd80ef r390:4b2382fd80ef r272:e63a95b68827 r390:4b2382fd80ef r390:4b2382fd80ef r390:4b2382fd80ef | #! /usr/bin/env python
import sys
from mercurial import ui, hg
from mercurial import util
util.rcpath = lambda : []
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)
u = ui.ui()
r = hg.repository(u, ".")
N = r.changectx(".").rev()
lengths=[0]*(N+1)
for i in range(N+1):
p=r.changectx(i).parents()
if p[0]:
p0=lengths[p[0].rev()]
else:
p0=-1
if len(p)>1 and p[1]:
p1=lengths[p[1].rev()]
else:
p1=-1
lengths[i]=max(p0,p1)+1
print lengths[N]
|