Browse code

fix tag script problem. add mulle-bootstrap git

Nat! authored on 07-10-2016 17:35:37
Showing 5 changed files
... ...
@@ -23,6 +23,8 @@ life.
23 23
 * started on `mulle-bootstrap config`. First implemented setting is
24 24
 `warn_scripts`. You can turn off scripts warning, with
25 25
 `mulle-bootstrap config -on dont_warn_scripts`
26
+* added `git` command, so you can say `mulle-bootstrap git status`. Going to
27
+become more useful over time.
26 28
 * renamed hidden option **-r** to **-l** (sorry)
27 29
 * **-f** option removed from build/fetch options, as it didn't do anything. The
28 30
 **-f** for mulle-bootstrap is still there though.
... ...
@@ -209,6 +209,7 @@ bootstrap_main()
209 209
          -fr|--force-refresh)
210 210
             MULLE_BOOTSTRAP_NEEDS_REFRESH="YES"
211 211
          ;;
212
+
212 213
          -n|--dry-run)
213 214
             MULLE_EXECUTOR_DRY_RUN="YES"
214 215
          ;;
... ...
@@ -244,7 +245,7 @@ bootstrap_main()
244 245
          -t|--trace)
245 246
             MULLE_BOOTSTRAP_TRACE="1848"
246 247
             COPYMOVEFLAGS="-v"
247
-            GITFLAGS="-v"
248
+            GITFLAGS="${GITFLAGS} -v"
248 249
          ;;
249 250
 
250 251
          -V|--verbose-build)
... ...
@@ -254,25 +255,25 @@ bootstrap_main()
254 255
          -v|--verbose)
255 256
             MULLE_BOOTSTRAP_TRACE="VERBOSE"
256 257
             COPYMOVEFLAGS="-v"
257
-            GITFLAGS="-v"
258
+            GITFLAGS="${GITFLAGS} -v"
258 259
          ;;
259 260
 
260 261
          -vv|--very-verbose)
261 262
             MULLE_BOOTSTRAP_TRACE="FLUFF"
262 263
             COPYMOVEFLAGS="-v"
263
-            GITFLAGS="-v"
264
+            GITFLAGS="${GITFLAGS} -v"
264 265
          ;;
265 266
 
266 267
          -vvv|--very-verbose-with-settings)
267 268
             MULLE_BOOTSTRAP_TRACE="TRACE"
268 269
             COPYMOVEFLAGS="-v"
269
-            GITFLAGS="-v"
270
+            GITFLAGS="${GITFLAGS} -v"
270 271
          ;;
271 272
 
272 273
          -s|--silent)
273 274
             MULLE_BOOTSTRAP_TRACE=
274 275
             MULLE_BOOTSTRAP_TERSE="YES"
275
-            GITFLAGS="-q"
276
+            GITFLAGS="${GITFLAGS} -q"
276 277
          ;;
277 278
 
278 279
          -h|--help)
... ...
@@ -480,6 +481,12 @@ bootstrap_main()
480 481
          tag_main "$@" || exit 1
481 482
       ;;
482 483
 
484
+      git)
485
+         . mulle-bootstrap-scm.sh
486
+
487
+         git_main "$@" || exit 1
488
+      ;;
489
+
483 490
       version)
484 491
          echo "${MULLE_BOOTSTRAP_VERSION}" || exit 1
485 492
       ;;
... ...
@@ -216,6 +216,61 @@ svn_update()
216 216
 }
217 217
 
218 218
 
219
+run_git()
220
+{
221
+   local clonesdir
222
+
223
+   clonesdir="$1"
224
+   [ $# -eq 0 ] || shift
225
+
226
+   local i
227
+
228
+   for i in "${clonesdir}"/*
229
+   do
230
+      if [ -d "$i" ]
231
+      then
232
+         if [ -d "${i}/.git" -o -d "${i}/refs" ]
233
+         then
234
+            log_info "### $i:"
235
+            (cd "$i" ; exekutor git ${GITFLAGS} "$@" ) || fail "git failed"
236
+            log_info
237
+         fi
238
+      fi
239
+   done
240
+
241
+}
242
+
243
+
244
+git_main()
245
+{
246
+   log_fluff "::: git :::"
247
+
248
+   [ -z "${MULLE_BOOTSTRAP_LOCAL_ENVIRONMENT_SH}" ] && . mulle-bootstrap-local-environment.sh
249
+   [ -z "${MULLE_BOOTSTRAP_SCRIPTS_SH}" ] && . mulle-bootstrap-scripts.sh
250
+
251
+
252
+   while :
253
+   do
254
+      if [ "$1" = "-h" -o "$1" = "--help" ]
255
+      then
256
+         git_usage
257
+      fi
258
+
259
+      break
260
+   done
261
+
262
+   if dir_has_files "${CLONES_SUBDIR}"
263
+   then
264
+      log_fluff "Will git $* clones " >&2
265
+   else
266
+      log_info "There is nothing to run git over."
267
+      return 0
268
+   fi
269
+
270
+   run_git "${CLONES_SUBDIR}" "$@"
271
+}
272
+
273
+
219 274
 scm_initialize()
220 275
 {
221 276
    log_fluff ":scm_initialize:"
... ...
@@ -229,7 +229,7 @@ run_build_settings_script()
229 229
 
230 230
 
231 231
 #
232
-# various scripts runner for fetch, designed to only load in the build
232
+# various scripts runner for fetch, designed to source in the build
233 233
 # environment (slow on mingw, if needed)
234 234
 #
235 235
 fetch__run_script()
... ...
@@ -170,7 +170,7 @@ tag()
170 170
             if [ -d "${i}/.git" -o -d "${i}/refs" ]
171 171
             then
172 172
                log_info "Tagging \"`basename -- "${i}"`\" with \"${tag}\""
173
-               (cd "$i" ; exekutor git tag $GIT_FLAGS "$@" "${tag}" ) || fail "tag failed"
173
+               (cd "$i" ; exekutor git tag $GITFLAGS "$@" "${tag}" ) || fail "tag failed"
174 174
             fi
175 175
          fi
176 176
       done
... ...
@@ -185,7 +185,7 @@ tag_main()
185 185
    [ -z "${MULLE_BOOTSTRAP_LOCAL_ENVIRONMENT_SH}" ] && . mulle-bootstrap-local-environment.sh
186 186
    [ -z "${MULLE_BOOTSTRAP_SCRIPTS_SH}" ] && . mulle-bootstrap-scripts.sh
187 187
 
188
-   GIT_FLAGS=
188
+   GITFLAGS=
189 189
    TAG_OPERATION="tag"
190 190
 
191 191
    while :
... ...
@@ -197,7 +197,7 @@ tag_main()
197 197
 
198 198
       if [ "$1" = "-f" ]
199 199
       then
200
-         GIT_FLAGS="${GIT_FLAGS} $1"
200
+         GITFLAGS="${GITFLAGS} $1"
201 201
          TAG_OPERATION="force tag"
202 202
          [ $# -eq 0 ] || shift
203 203
          continue
... ...
@@ -205,7 +205,7 @@ tag_main()
205 205
 
206 206
       if [ "$1" = "-d" ]
207 207
       then
208
-         GIT_FLAGS="${GIT_FLAGS} $1"
208
+         GITFLAGS="${GITFLAGS} $1"
209 209
          TAG_OPERATION="delete the tag of"
210 210
          [ $# -eq 0 ] || shift
211 211
          continue
... ...
@@ -223,7 +223,7 @@ tag_main()
223 223
       tag_usage
224 224
    fi
225 225
 
226
-   if [ -z "${GIT_FLAGS}" ]
226
+   if [ -z "${GITFLAGS}" ]
227 227
    then
228 228
       ensure_tags_unknown "${CLONES_SUBDIR}" "${TAG}"
229 229
    fi
... ...
@@ -231,15 +231,15 @@ tag_main()
231 231
 
232 232
    if dir_has_files "${CLONES_SUBDIR}"
233 233
    then
234
-      echo "Will ${TAG_OPERATION} clones with ${TAG}" >&2
234
+      log_fluff "Will ${TAG_OPERATION} clones with ${TAG}"
235 235
    else
236 236
       log_info "There is nothing to tag."
237 237
       return 0
238 238
    fi
239 239
 
240
-   run_fetch_settings_script "pre-tag"
240
+   fetch__run_fetch_settings_script "pre-tag"
241 241
 
242 242
    tag "${CLONES_SUBDIR}" "${TAG}" "$@"
243 243
 
244
-   run_fetch_settings_script "pre-tag"
244
+   fetch__run_fetch_settings_script "pre-tag"
245 245
 }