diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-08-07 10:52:55 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-08-07 10:52:55 -0300 |
commit | e003c8a1a4375e0031b0ccccf051deaab4a93aa2 (patch) | |
tree | 5207ae0b03935c081c18ed4e95ad04a3b8955a26 | |
parent | 7c165b05620d90e63714f08a523edc5533644838 (diff) | |
download | mediapointer-dvb-s2-e003c8a1a4375e0031b0ccccf051deaab4a93aa2.tar.gz mediapointer-dvb-s2-e003c8a1a4375e0031b0ccccf051deaab4a93aa2.tar.bz2 |
Add a consistency check tool into hgimport
From: Mauro Carvalho Chehab <mchehab@infradead.org>
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 <mchehab@infradead.org>
-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 |