| author | Tomas Zeman <tomas@functionals.cz> |
| Tue, 15 Dec 2020 09:22:21 +0100 | |
| changeset 60 | 4267602e8494 |
| parent 24 | 48bc2f12bcc5 |
| permissions | -rwxr-xr-x |
| 24 | 1 |
#!/bin/sh |
2 |
||
3 |
# Finds all repositories in $HOME and pulls/pushes to remote repos based on |
|
4 |
# destination (optional) |
|
5 |
# |
|
6 |
# Usage: sync_repos [destination] |
|
7 |
# |
|
8 |
||
9 |
iterate() {
|
|
10 |
# $1 destination |
|
11 |
dst=$1 |
|
12 |
find $HOME/ -xdev -maxdepth 5 -name .hg | \ |
|
13 |
sed -e 's{.hg${{'| \
|
|
14 |
while read repo; do |
|
15 |
echo "==> Sync repo: $repo" |
|
16 |
hg pull -v -u --cwd $repo $dst; |
|
17 |
hg push -v --cwd $repo $dst; |
|
18 |
done |
|
19 |
} |
|
20 |
||
21 |
dst=$1 |
|
22 |
||
23 |
iterate $dst |