Commits

Takayuki KONDO committed 8de5035

add get-hg-changegroup.sh

  • Participants
  • Parent commits e4b0c34

Comments (0)

Files changed (1)

File get-hg-changegroup.sh

+#!/bin/bash
+
+if [[ -z $1 ]]; then
+    echo "Usage: $0 repository"
+    exit 1;
+fi
+
+function getFirstRev  # $1: Repository path
+{
+    if [[ $(uname -s) = MINGW* ]]; then
+	export LANGUAGE=C
+    else
+	export LANG=C
+    fi
+
+    TMP=/tmp/tmp.hg.$$
+    hg rollback --dry-run -R$1 > $TMP
+    
+    rollbackrev=`sed -e 's/repository tip rolled back to revision \([0-9-]*\) (undo commit)/\1/' $TMP`
+    rm $TMP
+
+    firstrev=`expr $rollbackrev + 1`
+
+    echo $firstrev
+}
+
+### for example (after a changegroup has been added via pull)
+HG_NODE=`getFirstRev $1`
+hg log -r "$HG_NODE:tip" -R$1
+