[Linux-ha-dev] Mercurial changes getting lost
Lars Marowsky-Bree
lmb at suse.de
Mon May 21 15:43:50 MDT 2007
On 2007-05-17T07:44:55, Alan Robertson <alanr at unix.sh> wrote:
> Here's where you can see that:
So, one of the things which fell out of this thread is that "hg log"
doesn't pick up everything one might want it to pick up, and inquired
about it at the hg list.
I got a very nice explanation about how hg works in this regard from
Matt himself. The thread can be found at
http://selenic.com/pipermail/mercurial/2007-May/013230.html
I hacked up a script "hg_traverse" which does pick up what happened here
- if you call it within the dev repo as "hg_traverse lrm/lrmd/lrmd.c tip
500", it'll follow up to 500 changesets from the tip and filter out any
changes to lrmd.c. (I attached it here for convenience.)
It's bloody slow, but it works. Maybe someone will implement it in
python proper for hg.
Regards,
Lars
--
Teamlead Kernel, SuSE Labs, Research and Development
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
"Experience is the name everyone gives to their mistakes." -- Oscar Wilde
-------------- next part --------------
#!/bin/bash
F=${1:-lrm/lrmd/lrmd.c}
cur_rev=${2:-tip}
max_revs=${3:-100}
get_sha() {
hg manifest --debug $1 | grep $F | cut -f 1 -d ' '
}
diff_parent() {
local parent="$1"
if [ -z "$parent" ]; then
return 1
fi
local psha=$(get_sha "$parent")
if [ "$cur_sha" != "$psha" ]; then
return 0
fi
return 1
}
rev_cnt=0
while [ $rev_cnt -lt $max_revs ] ; do
r=$(hg log --template "{rev} {parents}\n" -r "$cur_rev")
cur_rev=$(echo $r | cut -f 1 -d ' ')
parent1=$(echo $r | cut -f 2 -s -d ' ' | cut -d ':' -f 1)
parent2=$(echo $r | cut -f 3 -s -d ' ' | cut -d ':' -f 1)
cur_sha=$(get_sha $cur_rev)
next_rev=${parent1:-$[cur_rev-1]}
ndiff=0
if diff_parent $parent2 ; then
echo "info: $cur_rev - following $parent2, not $next_rev" 1>&2
ndiff=1
next_rev=$parent2
else
if diff_parent $next_rev ; then
ndiff=1
fi
fi
if [ $ndiff -gt 0 ]; then
hg log -r $cur_rev
hg diff -r $next_rev -r $cur_rev -p $F
echo
fi
cur_rev=$next_rev
rev_cnt=$[rev_cnt+1]
done
exit 0
More information about the Linux-HA-Dev
mailing list