#!/bin/bash # Get changelist from labels, cfl.sh. Version=1.0.4 # Determine the mapping of ClearCase Labels to Perforce changelist numbers and # branch paths after a BBI import. This relies on change descriptions reliably # following a standard, which is a reasonable assumption for generated changelists # related to a BBI import. # The expected format, as seen from a 'p4 changes' command, looks something # like this, where REL3.2 is a sample label name: # # p4import@bbi_import.common 'Import REL3.2.' # declare Depot=${1:-Unset} #------------------------------------------------------------------------------ # Get labels in a given depot. #------------------------------------------------------------------------------ function get_labels_in_depot () { #echo "CALL get_labels_in_depot($*)" declare depot=$1 declare tmpFile=/tmp/cfl.$depot.$$.$RANDOM declare streamShortName= declare C= declare L= declare S= echo p4 -ztag -F "%change%:%desc%" changes //$depot/... |grep "Import " > $tmpFile p4 -ztag -F "%change%:%desc%" changes //$depot/... |grep "Import " > $tmpFile # Get Changelist, label, and path. while read data; do C=${data%%:*} L=$(p4 -ztag -F %desc% describe -s $C 2>/dev/null) L=${L#Import } L=${L%\.} streamShortName=$(p4 -ztag -F %depotFile0% describe -m 1 -s $C|cut -d '/' -f 4) S=//$depot/$streamShortName printf "%-42s %-32s %-s %-s\n" "$S" "$L" "@$C" done < $tmpFile /bin/rm -f $tmpFile } #------------------------------------------------------------------------------ # Get labels for all depots (considering only depots of type 'stream'). #------------------------------------------------------------------------------ function get_labels_in_all_depots () { #echo "CALL get_labels_in_all_depots($*)" declare depotData=/tmp/cfl.DepotData.$$.$RANDOM declare depotName= p4 -ztag depots > $depotData while read data; do [[ $data == "... name "* ]] && depotName=${data##... name } [[ $data == "... type stream" ]] || continue get_labels_in_depot $depotName done < $depotData /bin/rm -f $depotData } echo -e "$(basename $0) v$Version" echo -e "\nStream Label Changelist\n------------------------------------------ -------------------------------- ----------------\n" if [[ $Depot != Unset ]]; then get_labels_in_depot $Depot else get_labels_in_all_depots fi echo -e "\n\n"
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 30968 | C. Thomas Tyler |
Migration from Classic to Streams with: p4 copy -b P4BBI_Classic_to_Streams |
||
//guest/perforce_software/p4bbi/main/cfl.sh | |||||
#1 | 15968 | C. Thomas Tyler |
Copy Up to main from dev using: p4 copy -r -b perforce-software-p4bbi-dev |
||
//guest/perforce_software/p4bbi/dev/cfl.sh | |||||
#3 | 12911 | C. Thomas Tyler | Fixed issue capturing long label names. | ||
#2 | 12550 | C. Thomas Tyler |
Updated to get stream path, and revise to use changelist description convention of: 'Import <Label>' |
||
#1 | 12527 | C. Thomas Tyler | Addd script to get changelits from baseline labels after a BBI import. |