Translate

lunes, 10 de octubre de 2016

Update all your mercurial repos at once

The following is a bash command to update repositories located in subdirectories from the current directory.

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
Se ha producido un error en este gadget.