Any way to pull/update all subrepos?
Asked Answered
C

3

12

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...

Caeoma answered 11/6, 2012 at 21:49 Comment(0)
C
12

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

Caeoma answered 11/6, 2012 at 22:2 Comment(1)
Yep, that's how you do it :) Also, if you have mixed subrepos (some Mercurial, some Git, some Svn), you can run things like: hg onsub -t hg "hg pull -u" hg onsub -t git "git pull"Munmro
D
3

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
Deanadeanda answered 31/1, 2017 at 18:52 Comment(0)
C
1

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
Chairborne answered 12/2, 2015 at 11:28 Comment(1)
This script is non-portable, only works for Microsoft's windows and dos.Grissel

© 2022 - 2024 — McMap. All rights reserved.