Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way to pull/update all subrepos?

I'm looking into the viability of switching from svn to mercurial for my organization, but there's one hangup I can't seem to find a solution for.

Is there any way to pull and update a repo and all subrepos without manually pulling and updating each one?

I'd like to switch to mercurial, but if that's not possible then it's a no-go for us.

Edit: Good god I must be tired today... two questions on SO for which I find the answers minutes after asking...

like image 577
carpat Avatar asked Jun 11 '12 21:06

carpat


3 Answers

Somehow missed this, and found it right after asking the question: https://www.mercurial-scm.org/wiki/OnsubExtension

like image 197
carpat Avatar answered Oct 30 '22 02:10

carpat


You can define a simple shell alias like the following

alias hgsub='find . -name ".hg" -type d | grep -v "\./\.hg" | \
xargs -n1 dirname | xargs -n1 -iREPO hg -R REPO '

and then do

hgsub tip
hgsub pull -u
like image 29
Sébastien Pierre Avatar answered Oct 30 '22 01:10

Sébastien Pierre


As an alterantive, a batch script might help:

@echo off
for /D %%d in (*) do (
  if exist %%d\.hg (
    echo Verzeichnis %%d
    cd %%d
    hg pull -u
    echo ----------------------------------------------
    cd ..  
  )
)
pause
like image 1
Stefan Avatar answered Oct 30 '22 03:10

Stefan