diff options
-rwxr-xr-x | hgimport | 30 |
1 files changed, 28 insertions, 2 deletions
@@ -31,7 +31,7 @@ else fi if [ "$DIR" != "" ]; then - CS="`hg outgoing -R $DIR .|grep 'changeset:'|cut -f2 -d:`" + CS="`hg outgoing -R $DIR .|grep 'changeset:'|cut -f3 -d:`" else CS="`hg incoming $SITE |grep 'changeset:'|cut -f3 -d:`" fi @@ -42,13 +42,39 @@ echo Number of patches: $NUM j=1 for i in $CS; do name=$TMP/hg_${TREE}_$(printf %0${#NUM}d ${j}).patch - echo $name with cs=$i + echo -n "$name with cs=$i " if [ "$DIR" != "" ]; then hg export -R $DIR $i >$name else wget -q -O $name "$SITE?cmd=changeset;node=$i;style=raw" fi + # Do a simple consistency check + node_id=`cat $name|perl -ne 'if (m/# Node ID (.*)/) { print $1; }'` + parents="`cat $name|perl -ne 's/(# Parent .*)# Parent/\1/; if (m/# Parent (.*)/) { print "$1 "; }' | perl -ne 's/\s+/ /g; s/^\s+//; s/\s+$//; print $_'`" + + if [ "$old_id" != "" ]; then + if [ "$parents" == "$old_id" ]; then + echo "Ok." + else + echo "Nok/Merge:" + echo -e "\t\tOld node ID: $old_id" + echo -e "\t\tNode parents $parents" + fi + else + last="`hg log -r -1|grep changeset`" + par="`hg log -r $parents|grep changeset`" + + if [ "$last" == "$par" ]; then + echo "First against tip." + else + echo "First patch." + echo -e "Patch against an older patch:" + hg log -r $parents + fi + fi + + old_id=$node_id; j=$((j+1)) done |