Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Extracted operations to functions and implemented recursion

  • Loading branch information...
commit 78ff9458ed37c27bbc62b6a900f17cf13bdb609f 1 parent 93dc397
@TrevorBramble authored
Showing with 58 additions and 23 deletions.
  1. +32 −16 git-svn-externals-check
  2. +26 −7 git-svn-externals-update
View
48 git-svn-externals-check
@@ -1,19 +1,35 @@
#!/bin/bash
-for dir in *; do
+function checkDir
+{
+ cd $1
+ STATUS=$(git status)
+ UNPUSHED=$(git-svn-check-unpushed)
+ if [ $(echo $STATUS|grep -c "clean") -lt 1 -o \
+ $(echo $UNPUSHED|grep -c "No unpushed") -lt 1 ]; then
+ printStatus $1
+ else
+ echo $1 'is clean'
+ crawlTree
+ fi
+ cd ..
+}
+
+function crawlTree
+{
+ for dir in *; do
if [ -d $dir ]; then
- cd $dir
- STATUS=$(git status)
- UNPUSHED=$(git-svn-check-unpushed)
- if [ $(echo $STATUS|grep -c "clean") -lt 1 -o \
- $(echo $UNPUSHED|grep -c "No unpushed") -lt 1 ]; then
- echo '>>>>>>>>>>>>>>>>' $dir '<<<<<<<<<<<<<<<<'
- git status
- git-svn-check-unpushed
- echo '----------------------------------------'
- else
- echo $dir 'is clean'
- fi
- cd ..
- fi
-done
+ checkDir $dir
+ fi
+ done
+}
+
+function printStatus
+{
+ echo '>>>>>>>>>>>>>>>>' $1 '<<<<<<<<<<<<<<<<'
+ git status
+ git-svn-check-unpushed
+ echo '----------------------------------------'
+}
+
+crawlTree
View
33 git-svn-externals-update
@@ -1,11 +1,30 @@
#!/bin/bash
-for dir in *; do
+function checkDir
+{
+ cd $1
+ if [ -d ./.git ]; then
+ updateDir $1
+ else
+ crawlTree
+ fi
+ cd ..
+}
+
+function crawlTree
+{
+ for dir in *; do
if [ -d $dir ]; then
- cd $dir
- echo $dir
- git svn fetch
- git svn rebase
- cd ..
+ checkDir $dir
fi
-done
+ done
+}
+
+function updateDir
+{
+ echo $1
+ git svn fetch
+ git svn rebase
+}
+
+crawlTree
Please sign in to comment.
Something went wrong with that request. Please try again.