scripts/sync_repos
author Tomas Zeman <tomas@functionals.cz>
Tue, 15 Dec 2020 09:22:21 +0100
changeset 60 4267602e8494
parent 24 48bc2f12bcc5
permissions -rwxr-xr-x
fs2json: directory structure -> json object converter. E.g. to be used instead of erica / py-Couchapp (interaction with couchdb is left to the user).

#!/bin/sh

# Finds all repositories in $HOME and pulls/pushes to remote repos based on
# destination (optional)
#
# Usage: sync_repos [destination]
#

iterate() {
	# $1 destination
	dst=$1
	find $HOME/  -xdev -maxdepth 5 -name .hg | \
	sed -e 's{.hg${{'| \
	while read repo; do 
		echo "==> Sync repo: $repo"
		hg pull -v  -u --cwd $repo $dst;
		hg push -v  --cwd $repo $dst;
	done
}

dst=$1

iterate $dst