view SCRIPTS/include.sh @ 130:d659ed4b9197

Another point to run repoint
author Chris Cannam
date Thu, 07 Feb 2019 11:48:53 +0000
parents b107ed308636
children
line wrap: on
line source
#!/bin/bash

vcs_id() {
    dir="$1"
    ( cd "$dir" ;
      if [ -d .hg ]; then
	  tag=$(hg id -t -r 'parents(.)') # tag is always followed by tag-commit
	  if [ "$tag" != "" ]; then
	      echo "${tag#$dir-}" # strip dir- prefix from tag if present
	  else 
	      hg id | awk '{ print $1; }'
	  fi
      elif [ -d .git ]; then
	  git rev-parse --short HEAD
      elif [ -d .svn ]; then
	  svn info | grep ^Revision | awk '{ print $2; }'
      else
	  echo "unknown"
      fi
    )
}