scripts/sync_repos
changeset 24 48bc2f12bcc5
equal deleted inserted replaced
23:5eaf174f21fa 24:48bc2f12bcc5
       
     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