Merge "Tidy the do-it script to conform to bash8"
This commit is contained in:
		
							
								
								
									
										32
									
								
								do-it.sh
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								do-it.sh
									
									
									
									
									
								
							@@ -1,17 +1,17 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# provide debugging output when desired
 | 
					# provide debugging output when desired
 | 
				
			||||||
function DEBUG() {
 | 
					function DEBUG {
 | 
				
			||||||
    [ "$GITDM_DEBUG" == "on" ] && echo "DEBUG: $1"
 | 
					    [ "$GITDM_DEBUG" == "on" ] && echo "DEBUG: $1"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# enable/disable debugging output
 | 
					# enable/disable debugging output
 | 
				
			||||||
GITDM_DEBUG=${GITDM_DEBUG:-"off"}
 | 
					GITDM_DEBUG=${GITDM_DEBUG:-"off"}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# determine if a given parameter is a date matching the format YYYY-MM-DD, 
 | 
					# determine if a given parameter is a date matching the format YYYY-MM-DD,
 | 
				
			||||||
# i.e. 2013-09-13   This is used to decide if git should specify a start
 | 
					# i.e. 2013-09-13   This is used to decide if git should specify a start
 | 
				
			||||||
# date with '--since YYYY-MM-DD' rather than use an absolute changeset id
 | 
					# date with '--since YYYY-MM-DD' rather than use an absolute changeset id
 | 
				
			||||||
function IS_DATE() {
 | 
					function IS_DATE {
 | 
				
			||||||
    [[ $1 =~ ^[0-9][0-9][0-9][0-9]\-[0-9][0-9]\-[0-9][0-9]$ ]]
 | 
					    [[ $1 =~ ^[0-9][0-9][0-9][0-9]\-[0-9][0-9]\-[0-9][0-9]$ ]]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -47,13 +47,13 @@ if [ "$UPDATE_GIT" = "y" ]; then
 | 
				
			|||||||
    fi
 | 
					    fi
 | 
				
			||||||
    grep -v '^#' ${CONFIGDIR}/${RELEASE} |
 | 
					    grep -v '^#' ${CONFIGDIR}/${RELEASE} |
 | 
				
			||||||
        while read project x; do
 | 
					        while read project x; do
 | 
				
			||||||
          if [ ! -d ${GITBASE}/${project} ] ; then
 | 
					            if [ ! -d ${GITBASE}/${project} ] ; then
 | 
				
			||||||
              DEBUG "Cloning missing ${project} from ${REPOBASE}/${project}"
 | 
					                DEBUG "Cloning missing ${project} from ${REPOBASE}/${project}"
 | 
				
			||||||
              git clone ${REPOBASE}/${project} ${GITBASE}/${project}
 | 
					                git clone ${REPOBASE}/${project} ${GITBASE}/${project}
 | 
				
			||||||
          fi
 | 
					            fi
 | 
				
			||||||
          cd ${GITBASE}/${project}
 | 
					            cd ${GITBASE}/${project}
 | 
				
			||||||
          DEBUG "Fetching updates to ${project}"
 | 
					            DEBUG "Fetching updates to ${project}"
 | 
				
			||||||
          git fetch origin 2>/dev/null
 | 
					            git fetch origin 2>/dev/null
 | 
				
			||||||
        done
 | 
					        done
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -63,8 +63,8 @@ if [ "$GIT_STATS" = "y" ] ; then
 | 
				
			|||||||
        while read project revisions excludes x; do
 | 
					        while read project revisions excludes x; do
 | 
				
			||||||
            DEBUG "Generating git commit log for ${project}"
 | 
					            DEBUG "Generating git commit log for ${project}"
 | 
				
			||||||
            cd ${GITBASE}/${project}
 | 
					            cd ${GITBASE}/${project}
 | 
				
			||||||
            # match possible dates of the format YYYY-MM-DD to use in 
 | 
					            # match possible dates of the format YYYY-MM-DD to use in
 | 
				
			||||||
            # supplying git with a '--since DATE' paramter instead of a 
 | 
					            # supplying git with a '--since DATE' paramter instead of a
 | 
				
			||||||
            # range of changeset ids
 | 
					            # range of changeset ids
 | 
				
			||||||
            if IS_DATE $revisions; then
 | 
					            if IS_DATE $revisions; then
 | 
				
			||||||
                DEBUG "Matched a git --since date of '${revisions}'"
 | 
					                DEBUG "Matched a git --since date of '${revisions}'"
 | 
				
			||||||
@@ -141,8 +141,8 @@ if [ "$GERRIT_STATS" = "y" ] ; then
 | 
				
			|||||||
    grep -v '^#' ${CONFIGDIR}/${RELEASE} |
 | 
					    grep -v '^#' ${CONFIGDIR}/${RELEASE} |
 | 
				
			||||||
        while read project revisions x; do
 | 
					        while read project revisions x; do
 | 
				
			||||||
            cd "${GITBASE}/${project}"
 | 
					            cd "${GITBASE}/${project}"
 | 
				
			||||||
            # match possible dates of the format YYYY-MM-DD to use in 
 | 
					            # match possible dates of the format YYYY-MM-DD to use in
 | 
				
			||||||
            # supplying git with a '--since DATE' paramter instead of a 
 | 
					            # supplying git with a '--since DATE' paramter instead of a
 | 
				
			||||||
            # range of changeset ids
 | 
					            # range of changeset ids
 | 
				
			||||||
            if IS_DATE $revisions; then
 | 
					            if IS_DATE $revisions; then
 | 
				
			||||||
                DEBUG "Matched a git --since date of '${revisions}'"
 | 
					                DEBUG "Matched a git --since date of '${revisions}'"
 | 
				
			||||||
@@ -171,8 +171,8 @@ if [ "$GERRIT_STATS" = "y" ] ; then
 | 
				
			|||||||
        while read project revisions x; do
 | 
					        while read project revisions x; do
 | 
				
			||||||
            DEBUG "Generating a list of commit IDs for ${project}"
 | 
					            DEBUG "Generating a list of commit IDs for ${project}"
 | 
				
			||||||
            cd "${GITBASE}/${project}"
 | 
					            cd "${GITBASE}/${project}"
 | 
				
			||||||
            # match possible dates of the format YYYY-MM-DD to use in 
 | 
					            # match possible dates of the format YYYY-MM-DD to use in
 | 
				
			||||||
            # supplying git with a '--since DATE' paramter instead of a 
 | 
					            # supplying git with a '--since DATE' paramter instead of a
 | 
				
			||||||
            # range of changeset ids
 | 
					            # range of changeset ids
 | 
				
			||||||
            if IS_DATE $revisions; then
 | 
					            if IS_DATE $revisions; then
 | 
				
			||||||
                DEBUG "Matched a git --since date of '${revisions}'"
 | 
					                DEBUG "Matched a git --since date of '${revisions}'"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user