From 2c654e316392a8b3523ea0495902372d54548e1c Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Wed, 2 Nov 2016 22:53:04 +0300 Subject: [PATCH] pull-usrlocalsrc: pull from source, push to origin --- pull-usrlocalsrc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pull-usrlocalsrc b/pull-usrlocalsrc index 5ec06a0..0855206 100755 --- a/pull-usrlocalsrc +++ b/pull-usrlocalsrc @@ -2,10 +2,18 @@ PATH=/usr/local/src/Python/git-remote-hg:$PATH +has_remote() { + git remote show "$1" >/dev/null 2>&1 +} + prog_dir="`dirname \"$0\"`" && cat "$prog_dir"/locate-all.list | grep -F /usr/local/src | while read d; do echo "----- $d -----"; cd "$d" && - git remote | xargs -I'{}' git pull '{}' master || exit 1 + if has_remote source && has_remote origin; then + git pull source master && git push origin master || exit 1 + else + git remote | xargs -I'{}' git pull '{}' master || exit 1 + fi done -- 2.39.2