Ticket #2860: 0001-Fix-extracting-revision-number-with-git-svn.patch

File 0001-Fix-extracting-revision-number-with-git-svn.patch, 1.8 KB (added by andreasf, 15 years ago)

Proposed patch

  • build/jam/FileRules

    From e7663c9b13d807799d1d6c5824d6e40a99e42809 Mon Sep 17 00:00:00 2001
    From: =?utf-8?q?Andreas=20F=C3=A4rber?= <andreas.faerber@web.de>
    Date: Mon, 1 Jun 2009 14:44:45 +0200
    Subject: [PATCH] Fix extracting revision number with git-svn
    
    `git svn info` has identical output to `svn info`,
    so reunify both invocations to re-assure they get the same postprocessing.
    
    While at it, assure that the second git executes inside the repository,
    fixing out-of-tree builds.
    ---
     build/jam/FileRules |   19 ++++++++++++-------
     1 files changed, 12 insertions(+), 7 deletions(-)
    
    diff --git a/build/jam/FileRules b/build/jam/FileRules
    index 6d13780..bb8f011 100644
    a b rule CopySetHaikuRevision target : source  
    315315actions CopySetHaikuRevision1
    316316{
    317317    $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
    318     revision=`LC_ALL=C LANG=C svn info $(HAIKU_TOP) 2> /dev/null |
    319         grep Revision | awk '{printf $2}'`
     318    # Try svn or git-svn
     319    # Extract from "Revision: 12345" line
     320    revision=`(LC_ALL=C LANG=C svn info $(HAIKU_TOP) ||
     321        (cd $(HAIKU_TOP) && LC_ALL=C LANG=C git svn info)) 2> /dev/null |
     322            grep Revision | awk '{printf $2}'`
    320323    if [ "$revision" = 0 -o "$revision" = "" ]; then
    321         revision=`(cd $(HAIKU_TOP) && LC_ALL=C LANG=C git svn info)
    322                 2> /dev/null ||
    323             (git log --max-count=1 --grep="git-svn-id:" 2> /dev/null |
    324                 grep git-svn-id: | cut -d '@' -f 2 |
    325                     awk '{printf $1}') 2> /dev/null`
     324        # git-svn not present or not configured for this repository
     325        # Try searching git logs for last git-svn commit
     326        # Extract from " git-svn-id: .../haiku/trunk@12345 ..." line
     327        revision=`cd $(HAIKU_TOP) &&
     328            git log --max-count=1 --grep="git-svn-id:" 2> /dev/null |
     329                grep "git-svn-id:" | cut -d '@' -f 2 |
     330                    awk '{printf $1}'`
    326331    fi
    327332    if [ "$revision" = "" ]; then
    328333        revision=0