1 | 1 |
#! /usr/bin/env python |
2 | 2 |
|
3 | 3 |
import sys |
4 | 4 |
import os |
5 | 5 |
|
6 | 6 |
if len(sys.argv)>1 and sys.argv[1] in ["-h","--help"]: |
7 | 7 |
print """ |
8 | 8 |
This utility just prints the length of the longest path |
9 | 9 |
in the revision graph from revison 0 to the current one. |
10 | 10 |
""" |
11 | 11 |
exit(0) |
12 |
plist = os.popen("hg parents --template='{rev}\n'").readlines() |
|
12 |
plist = os.popen("HGRCPATH='' hg parents --template='{rev}\n'").readlines() |
|
13 | 13 |
if len(plist)>1: |
14 | 14 |
print "You are in the process of merging" |
15 | 15 |
exit(1) |
16 | 16 |
PAR = int(plist[0]) |
17 | 17 |
|
18 |
f = os.popen("hg log -r 0:tip --template='{rev} {parents}\n'"). |
|
18 |
f = os.popen("HGRCPATH='' hg log -r 0:tip --template='{rev} {parents}\n'").\ |
|
19 |
readlines() |
|
19 | 20 |
REV = -1 |
20 | 21 |
lengths=[] |
21 | 22 |
for l in f: |
22 | 23 |
REV+=1 |
23 | 24 |
s = l.split() |
24 | 25 |
rev = int(s[0]) |
25 | 26 |
if REV != rev: |
26 | 27 |
print "Something is seriously wrong" |
27 | 28 |
exit(1) |
28 | 29 |
if len(s) == 1: |
29 | 30 |
par1 = par2 = rev - 1 |
30 | 31 |
elif len(s) == 2: |
31 | 32 |
par1 = par2 = int(s[1].split(":")[0]) |
32 | 33 |
else: |
33 | 34 |
par1 = int(s[1].split(":")[0]) |
34 | 35 |
par2 = int(s[2].split(":")[0]) |
0 comments (0 inline)