scripts/sync_repos
authorTomas Zeman <tzeman@volny.cz>
Thu, 30 Aug 2012 12:47:52 +0200
changeset 24 48bc2f12bcc5
parent 23 5eaf174f21fa
child 25 e35b2a48aabf
scripts/sync_repos
scripts/sync_repos
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/sync_repos	Thu Aug 30 12:47:52 2012 +0200
@@ -0,0 +1,23 @@
+#!/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