X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=pull-usrlocalsrc;h=2fb2f2f302b04640949acde416184096d7db4f24;hb=ec626ef9c99ce4adb4ddcb53b02fe95e950a61ca;hp=04f856df5e00ce2e44beb5b17e0e03916dfddb8e;hpb=47b2ea5de8376314dcfe11daec772834e80a33b4;p=git-scripts.git diff --git a/pull-usrlocalsrc b/pull-usrlocalsrc index 04f856d..2fb2f2f 100755 --- a/pull-usrlocalsrc +++ b/pull-usrlocalsrc @@ -1,9 +1,19 @@ #! /bin/sh +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 upstream && has_remote origin; then + git pull upstream master && git push origin master || exit 1 + else + git remote | xargs -I% git pull % master || exit 1 + fi done