for hg_dir in $(find -maxdepth 2 -type d -name ".hg")
do
folder="$(dirname "$hg_dir")";
cd $folder && \
echo "Updating ${folder} ..." &&\
hg pull -u && \
cd -;
done
The use of && makes sure that updates will be run only if the directory change takes place.
The same works with git. Just change ".hg" with ".git" and hg pull -u with git pull