using mercurial instead of TortoiseHg

Issue #56 resolved
jb_alvarado created an issue

Hello everybody, I hope this is the right place for that question. In the past I use TortoiseHg to clone the repo from x265 and that works fine. But now I will change to the internal mercurial from msys2. I can clone with them and pull/update but when I try to configure with cmake it stops with errors, because it doesn't get the version information. On the place where normally the version stays it is this:

x265 version +-

Is there a way to fix that?

Regards! jb_

Comments (8)

  1. Former user Account Deleted

    On the place where normally the version stays it is this: x265 version +-

    I have similar trouble. Used dirty solution: just commented this lines in x265/source/CMakeLists.txt

    #list(GET VERSION_LIST 0 X265_VERSION_MAJOR)
    #list(GET VERSION_LIST 1 X265_VERSION_MINOR)
    

    And manually wrote versions in x265/build/msys/x265.rc

     FILEVERSION    1,1,0,1
     PRODUCTVERSION 1,1,0,1
    
  2. jb_alvarado reporter

    Hi den c, thank you for that tip! It is a good idea to do it in that way. But how you now then witch Version you have?

  3. Former user Account Deleted

    It is a good idea to do it in that way.

    Its quick'n'dirty workaround. We should get how to fix this. I suppose ERROR_QUIET in ../cmake/version.cmake should be replaced to ERROR_FILE version_errors.log and after that look what printed there.

    And second hint, which helps me. Since mercurial on windows has .bat extension Put this somewhere into cmake/version.cmake:

    set(HG_EXECUTABLE "${HG_EXECUTABLE}.bat")
    
  4. Former user Account Deleted

    Here patch

    --- a/source/cmake/version.cmake        Tue May 20 15:00:21 2014 -0500
    +++ b/source/cmake/version.cmake        Wed May 21 01:59:00 2014 +0300
    @@ -30,6 +30,12 @@
             set(X265_VERSION "${hg_latesttag}+${hg_latesttagdistance}-${hg_id}")
         endif()
     elseif(HG_EXECUTABLE AND EXISTS ${CMAKE_SOURCE_DIR}/../.hg)
    +       #windows check
    +       if(EXISTS "${HG_EXECUTABLE}.bat")
    +               set(HG_EXECUTABLE "${HG_EXECUTABLE}.bat")
    +       endif()
    +       message(STATUS "hg found at ${HG_EXECUTABLE}")
    +
         execute_process(COMMAND
             ${HG_EXECUTABLE} log -r. --template "{latesttag}"
             WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
    
  5. jb_alvarado reporter

    Ah, the new layout from bitkucket makes me confuse. I had write yesterday on the wrong wall. By me this patch doesn't work because inside of msys2 hg works over a python script(without extension), and this I can not use directly over cmake. Even python /bin/hg will not work. so I found a work around like that:

    Here is now my workaround, every time when the build gets update it makes this commands:
    
    sed -i '/set(X265_LATEST_TAG/d' source/cmake/version.cmake
    sed -i '/set(X265_TAG_DISTANCE/d' source/cmake/version.cmake
    sed -i '/set(HG_REVISION_ID/d' source/cmake/version.cmake
    
    cd .hg
    
    tag=`hg log -r. --template "{latesttag}"`
    distance=`hg log -r. --template "{latesttagdistance}"`
    node=`hg log -r. --template "{node|short}"`
    
    cd ..
    
    sed -i '/if(X265_LATEST_TAG MATCHES "^r")/i \
    set(X265_LATEST_TAG '\"$tag\"') \
    set(X265_TAG_DISTANCE '\"$distance\"') \
    set(HG_REVISION_ID '\"$node\"')' source/cmake/version.cmake
    
  6. jb_alvarado reporter

    Ok now a different solution, without this bad sed. I wrote my own hg.bat file like that:

    @echo off
    
    setlocal
    set HG=%~f0
    
    set PYTHONHOME=
    set in=%*
    set out=%in: {= "{%
    set out=%out:} =}" %
    
    %~dp0python2 %~dp0hg %out%
    

    Sadly the input lose by the first two inputs the quotation so I have to do a replacement.

  7. Log in to comment