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")
folder="$(dirname "$hg_dir")";
cd $folder && \
echo "Updating ${folder} ..." &&\
hg pull -u && \
cd -;

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

1 comentario:

  1. Did you know about the Octave Forge "super" repository? Maybe a similar approach would be useful for you too.