Merge
authorAlpar Juttner <alpar@cs.elte.hu>
Mon, 22 Sep 2008 08:37:23 +0100
changeset 276b4784a66a8e6
parent 271 cea3cb3bbcd7
parent 275 0821fea54d53
child 277 7abfb55f1ecc
Merge
     1.1 --- a/CMakeLists.txt	Sun Sep 21 18:26:25 2008 +0100
     1.2 +++ b/CMakeLists.txt	Mon Sep 22 08:37:23 2008 +0100
     1.3 @@ -1,16 +1,7 @@
     1.4  CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
     1.5  
     1.6 -#EXECUTE_PROCESS(
     1.7 -#  COMMAND hg id -i
     1.8 -#  OUTPUT_VARIABLE HG_REVISION
     1.9 -#  OUTPUT_STRIP_TRAILING_WHITESPACE)
    1.10 -
    1.11  SET(PROJECT_NAME "LEMON")
    1.12 -SET(PROJECT_VERSION_MAJOR "0")
    1.13 -SET(PROJECT_VERSION_MINOR "99")
    1.14 -SET(PROJECT_VERSION_PATCH "0")
    1.15 -SET(PROJECT_VERSION
    1.16 -  "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
    1.17 +SET(PROJECT_VERSION "hg-tip" CACHE STRING "The version string.")
    1.18  
    1.19  PROJECT(${PROJECT_NAME})
    1.20  
    1.21 @@ -39,15 +30,12 @@
    1.22      "LEMON - Library of Efficient Models and Optimization in Networks")
    1.23    SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
    1.24  
    1.25 -  SET(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
    1.26 -  SET(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
    1.27 -  SET(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
    1.28    SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
    1.29  
    1.30    SET(CPACK_PACKAGE_INSTALL_DIRECTORY
    1.31 -    "${PROJECT_NAME} ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
    1.32 +    "${PROJECT_NAME} ${PROJECT_VERSION}")
    1.33    SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
    1.34 -    "${PROJECT_NAME} ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
    1.35 +    "${PROJECT_NAME} ${PROJECT_VERSION}")
    1.36  
    1.37    # Variables to generate a component-based installer.
    1.38    #SET(CPACK_COMPONENTS_ALL headers library html_documentation)
     2.1 --- a/configure.ac	Sun Sep 21 18:26:25 2008 +0100
     2.2 +++ b/configure.ac	Mon Sep 22 08:37:23 2008 +0100
     2.3 @@ -1,9 +1,15 @@
     2.4  dnl Process this file with autoconf to produce a configure script.
     2.5  
     2.6  dnl Version information.
     2.7 -m4_define([lemon_version_number], [])
     2.8 +m4_define([lemon_version_number],
     2.9 +	[m4_normalize(esyscmd([echo ${LEMON_VERSION}]))])
    2.10 +dnl m4_define([lemon_version_number], [])
    2.11 +m4_define([lemon_hg_path], [m4_normalize(esyscmd([./scripts/chg-len.py]))])
    2.12  m4_define([lemon_hg_revision], [m4_normalize(esyscmd([hg id -i]))])
    2.13 -m4_define([lemon_version], [ifelse(lemon_version_number(), [], [lemon_hg_revision()], [lemon_version_number()])])
    2.14 +m4_define([lemon_version], [ifelse(lemon_version_number(),
    2.15 +			   [],
    2.16 +			   [lemon_hg_path().lemon_hg_revision()],
    2.17 +			   [lemon_version_number()])])
    2.18  
    2.19  AC_PREREQ([2.59])
    2.20  AC_INIT([LEMON], [lemon_version()], [lemon-user@lemon.cs.elte.hu], [lemon])
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/scripts/chg-len.py	Mon Sep 22 08:37:23 2008 +0100
     3.3 @@ -0,0 +1,39 @@
     3.4 +#! /usr/bin/env python
     3.5 +
     3.6 +import sys
     3.7 +import os
     3.8 +
     3.9 +if len(sys.argv)>1 and sys.argv[1] in ["-h","--help"]:
    3.10 +    print """
    3.11 +This utility just prints the length of the longest path
    3.12 +in the revision graph from revison 0 to the current one.
    3.13 +"""
    3.14 +    exit(0)
    3.15 +plist = os.popen("hg parents --template='{rev}\n'").readlines()
    3.16 +if len(plist)>1:
    3.17 +    print "You are in the process of merging"
    3.18 +    exit(1)
    3.19 +PAR = int(plist[0])
    3.20 +
    3.21 +f = os.popen("hg log -r 0:tip --template='{rev} {parents}\n'").readlines()
    3.22 +REV = -1
    3.23 +lengths=[]
    3.24 +for l in f:
    3.25 +    REV+=1
    3.26 +    s = l.split()
    3.27 +    rev = int(s[0])
    3.28 +    if REV != rev:
    3.29 +        print "Something is seriously wrong"
    3.30 +        exit(1)
    3.31 +    if len(s) == 1:
    3.32 +        par1 = par2 = rev - 1
    3.33 +    elif len(s) == 2:
    3.34 +        par1 = par2 = int(s[1].split(":")[0])
    3.35 +    else:
    3.36 +        par1 = int(s[1].split(":")[0])
    3.37 +        par2 = int(s[2].split(":")[0])
    3.38 +    if rev == 0:
    3.39 +        lengths.append(0)
    3.40 +    else:
    3.41 +        lengths.append(max(lengths[par1],lengths[par2])+1)
    3.42 +print lengths[PAR]