Run hg pull over all subdirectories
Asked Answered
A

3

5

How can I update multiple mercurial (hg) repositories from their shared parent's directory?

/plugins/search
/plugins/overview
/plugins/chart

I want to change a branch to default one and update them all at once

cd /plugins/search
hg update -C default
hg pull -u
Astonishment answered 22/11, 2017 at 11:53 Comment(0)
A
2

Run the following from the parent directory, plugins in this case:

find . -type d -maxdepth 1 -exec hg update -C default -R {} \;
find . -type d -maxdepth 1 -exec hg pull -u -R {} \;

To clarify:

  • find . searches the current directory
  • -type d to find directories, not files
  • -maxdepth 1 for a maximum depth of one sub-directory
  • -exec {} \; runs a custom command for every find
  • hg update -C default -R {} hg changes branch to default in each repository
  • hg pull -u -R {} hg updates to new branch head if changesets were pulled in each repository
Astonishment answered 22/11, 2017 at 11:53 Comment(0)
I
2

Finding repositories deeper in the directory tree

find . -type d -iname .hg -exec echo \; -exec hg pull -u -R {}/.. \;

The initial -exec echo \; is only there to keep the output clean.

Click here for more find galore.

Isodynamic answered 14/2, 2018 at 15:11 Comment(0)
L
0

Run this command on your root directory of project which is plugin

find . -maxdepth 1 -type d -print -execdir git --git-dir={}/.git --work-tree=$PWD/{} pull origin develop;

Languor answered 24/7, 2021 at 20:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.