0
2
1
1 |
#! /usr/bin/env python |
|
2 |
|
|
3 |
import sys |
|
4 |
import os |
|
5 |
|
|
6 |
if len(sys.argv)>1 and sys.argv[1] in ["-h","--help"]: |
|
7 |
print """ |
|
8 |
This utility just prints the length of the longest path |
|
9 |
in the revision graph from revison 0 to the current one. |
|
10 |
""" |
|
11 |
exit(0) |
|
12 |
plist = os.popen("hg parents --template='{rev}\n'").readlines() |
|
13 |
if len(plist)>1: |
|
14 |
print "You are in the process of merging" |
|
15 |
exit(1) |
|
16 |
PAR = int(plist[0]) |
|
17 |
|
|
18 |
f = os.popen("hg log -r 0:tip --template='{rev} {parents}\n'").readlines() |
|
19 |
REV = -1 |
|
20 |
lengths=[] |
|
21 |
for l in f: |
|
22 |
REV+=1 |
|
23 |
s = l.split() |
|
24 |
rev = int(s[0]) |
|
25 |
if REV != rev: |
|
26 |
print "Something is seriously wrong" |
|
27 |
exit(1) |
|
28 |
if len(s) == 1: |
|
29 |
par1 = par2 = rev - 1 |
|
30 |
elif len(s) == 2: |
|
31 |
par1 = par2 = int(s[1].split(":")[0]) |
|
32 |
else: |
|
33 |
par1 = int(s[1].split(":")[0]) |
|
34 |
par2 = int(s[2].split(":")[0]) |
|
35 |
if rev == 0: |
|
36 |
lengths.append(0) |
|
37 |
else: |
|
38 |
lengths.append(max(lengths[par1],lengths[par2])+1) |
|
39 |
print lengths[PAR] |
1 | 1 |
CMAKE_MINIMUM_REQUIRED(VERSION 2.6) |
2 | 2 |
|
3 |
#EXECUTE_PROCESS( |
|
4 |
# COMMAND hg id -i |
|
5 |
# OUTPUT_VARIABLE HG_REVISION |
|
6 |
# OUTPUT_STRIP_TRAILING_WHITESPACE) |
|
7 |
|
|
8 | 3 |
SET(PROJECT_NAME "LEMON") |
9 |
SET(PROJECT_VERSION_MAJOR "0") |
|
10 |
SET(PROJECT_VERSION_MINOR "99") |
|
11 |
SET(PROJECT_VERSION_PATCH "0") |
|
12 |
SET(PROJECT_VERSION |
|
13 |
|
|
4 |
SET(PROJECT_VERSION "hg-tip" CACHE STRING "The version string.") |
|
14 | 5 |
|
15 | 6 |
PROJECT(${PROJECT_NAME}) |
16 | 7 |
|
... | ... |
@@ -39,15 +30,12 @@ |
39 | 30 |
"LEMON - Library of Efficient Models and Optimization in Networks") |
40 | 31 |
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") |
41 | 32 |
|
42 |
SET(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) |
|
43 |
SET(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) |
|
44 |
SET(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) |
|
45 | 33 |
SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) |
46 | 34 |
|
47 | 35 |
SET(CPACK_PACKAGE_INSTALL_DIRECTORY |
48 |
"${PROJECT_NAME} ${ |
|
36 |
"${PROJECT_NAME} ${PROJECT_VERSION}") |
|
49 | 37 |
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY |
50 |
"${PROJECT_NAME} ${ |
|
38 |
"${PROJECT_NAME} ${PROJECT_VERSION}") |
|
51 | 39 |
|
52 | 40 |
# Variables to generate a component-based installer. |
53 | 41 |
#SET(CPACK_COMPONENTS_ALL headers library html_documentation) |
1 | 1 |
dnl Process this file with autoconf to produce a configure script. |
2 | 2 |
|
3 | 3 |
dnl Version information. |
4 |
m4_define([lemon_version_number], |
|
4 |
m4_define([lemon_version_number], |
|
5 |
[m4_normalize(esyscmd([echo ${LEMON_VERSION}]))]) |
|
6 |
dnl m4_define([lemon_version_number], []) |
|
7 |
m4_define([lemon_hg_path], [m4_normalize(esyscmd([./scripts/chg-len.py]))]) |
|
5 | 8 |
m4_define([lemon_hg_revision], [m4_normalize(esyscmd([hg id -i]))]) |
6 |
m4_define([lemon_version], [ifelse(lemon_version_number(), |
|
9 |
m4_define([lemon_version], [ifelse(lemon_version_number(), |
|
10 |
[], |
|
11 |
[lemon_hg_path().lemon_hg_revision()], |
|
12 |
[lemon_version_number()])]) |
|
7 | 13 |
|
8 | 14 |
AC_PREREQ([2.59]) |
9 | 15 |
AC_INIT([LEMON], [lemon_version()], [lemon-user@lemon.cs.elte.hu], [lemon]) |
0 comments (0 inline)