Ticket #5610: hgsvnrevision.patch

File hgsvnrevision.patch, 1.2 KB (added by andreasf, 15 years ago)

proposed patch

  • build/jam/FileRules

    # HG changeset patch
    # User Andreas Färber <andreas.faerber@web.de>
    # Date 1269174979 -3600
    # Node ID 1830c98fd4540278d2931a6842eefde613242f77
    # Parent  004cba5117a2c9ab35112ffe0b9c2d1e1d68538d
    Retrieve SVN revision from hg log
    
    diff -r 004cba5117a2 -r 1830c98fd454 build/jam/FileRules
    a b  
    315315        local gitIndex = <haiku-rootdir-git>index ;
    316316        SEARCH on $(gitIndex) = [ FDirName $(HAIKU_TOP) .git ] ;
    317317        Depends $(target) : $(gitIndex) ;
     318    } else if [ Glob [ FDirName $(HAIKU_TOP) .hg ] : store ] {
     319        local hgStore = <haiku-rootdir-hg>store ;
     320        SEARCH on $(hgStore) = [ FDirName $(HAIKU_TOP) .hg ] ;
     321        Depends $(target) : $(hgStore) ;
    318322    }
    319323
    320324    HAIKU_INCLUDE_IN_IMAGE on $(target)
     
    342346                grep "git-svn-id:" | cut -d '@' -f 2 |
    343347                    awk '{printf $1}'`
    344348    fi
     349    if [ "$revision" = 0 -o "$revision" = "" ]; then
     350        # Try searching hg log for last svn commit
     351        # Extract from "(svn r12345) ..." line
     352        revision=`(cd $(HAIKU_TOP) &&
     353            hg log --no-merges --template "{desc|firstline}\n") 2> /dev/null |
     354            grep --max-count=1 "(svn r" |
     355            sed -n -e 's,(svn r\(.*\)).*,\1,p'`
     356    fi
    345357    if [ "$revision" = "" ]; then
    346358        revision=0
    347359    fi