#!/bin/bash #------------------------------------------------------------------------------ set -u #------------------------------------------------------------------------------ # Functions function msg () { echo -e "$*"; } function errmsg () { msg "\\nError: ${1:-Unknown Error}\\n"; ErrorCount +=1; } function bail () { errmsg "${1:-Unknown Error}"; exit "${2:-1}"; } function cmd () { declare cmdAndArgs="${1:-echo}" declare desc="${2:-}" declare -i exitCode=0 [[ -n "$desc" ]] && msg "$desc" msg "Executing: $cmdAndArgs" $cmdAndArgs || exitCode="$?" return "$exitCode" } #------------------------------------------------------------------------------ # Declarations declare Version="1.0.1" declare PopulationBranch="SDP_Split_2019.2" declare -i LegacySDPFileCount declare -i SDPFileCount declare -i HMSFileCount declare -i HxAdminFileCount declare -i TotalBranchedFileCount declare -i FilesUnaccountedFor #------------------------------------------------------------------------------ # Main Program msg "Started ${0##*/} v$Version at $(date).\\n" LegacySDPFileCount=$(p4 files -e //guest/perforce_software/sdp/main/...|wc -l) SDPFileCount="$(p4 -ztag -F %fileCount% populate -n -b SDP_Split_2019.2 //sdp/main/...)" HxAdminFileCount="$(p4 -ztag -F %fileCount% populate -n -o -b SDP_Split_2019.2 //hxadmin_tools/main/...)" HMSFileCount="$(p4 -ztag -F %fileCount% populate -n -o -b SDP_Split_2019.2 //hms/main/...)" TotalBranchedFileCount=$((SDPFileCount+HMSFileCount+HxAdminFileCount)) FilesUnaccountedFor=$((LegacySDPFileCount-TotalBranchedFileCount)) msg "This script verifies the branch spec: $PopulationBranch to split the SDP per https://swarm.workshop.perforce.com/jobs/SDP-356. The intent is to ensure that every single file is accounted for. Files to be branched to: //sdp/main: $SDPFileCount //hxadmin_tools/main: $HxAdminFileCount //hms/main: $HMSFileCount Legacy SDP files to branch: $LegacySDPFileCount Files accounted for in spec: $TotalBranchedFileCount Files unaccounted for: $FilesUnaccountedFor Legacy SDP files to branch includes files currently in the SDP dev branch, excluding deleted files. This branch spec will be used immediately after an SDP release, when dev and main are in sync.\\n" if [[ "$FilesUnaccountedFor" -eq 0 ]]; then msg "All files accounted for. Good to go!" else msg "There are $FilesUnaccountedFor files unaccounted for. Get back to work!" fi exit 0
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 26506 | C. Thomas Tyler | Removed obsolete SDP refactor tool. | ||
#1 | 25080 | C. Thomas Tyler |
Added tool to ensure the coming SDP refactor is comprehensive of all files. |