From e003c8a1a4375e0031b0ccccf051deaab4a93aa2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 7 Aug 2007 10:52:55 -0300 Subject: Add a consistency check tool into hgimport From: Mauro Carvalho Chehab Add a consistency tool into hgimport. This tool will follow the node IDs to determine if a patch series follows the same origin, or if there were some merge inside the patch series. This tool helps to check if something wrong might be happen into a patch series, or if troubles will be expected during the -git patchset generation procedures. Signed-off-by: Mauro Carvalho Chehab --- hgimport | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/hgimport b/hgimport index e286f374b..1a36f3abb 100755 --- a/hgimport +++ b/hgimport @@ -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 -- cgit v1.2.3