Skip to content

Instantly share code, notes, and snippets.

@clucle
Last active June 22, 2022 01:26
Show Gist options
  • Save clucle/bedeff3e96b75c37eb095b81d52203ac to your computer and use it in GitHub Desktop.
Save clucle/bedeff3e96b75c37eb095b81d52203ac to your computer and use it in GitHub Desktop.
WORKSPACENAME=$1
CHANGELIST=$2
P4="p4 -C utf8 -u username -P password"
describe=$(eval "$P4 -Ztag describe $CHANGELIST")
state="..."
index=0
array_depot_file=()
array_type=()
array_action=()
for val in $describe; do
case "$state" in
"...")
substr_depot_file="${val:0:9}"
if [ "$substr_depot_file" = "depotFile" ]; then
state="depotFile"
substr_index="${val:9}"
index=$((substr_index+0))
fi
substr_type="${val:0:4}"
if [ "$substr_type" = "type" ]; then
state="type"
substr_index="${val:4}"
index=$((substr_index+0))
fi
substr_action="${val:0:6}"
if [ "$substr_action" = "action" ]; then
state="action"
substr_index="${val:6}"
index=$((sub_str_index+0))
fi
;;
"depotFile")
array_depot_file[$index]=$val
state="..."
;;
"type")
array_type[$index]=$val
state="..."
;;
"action")
array_action[$index]=$val
state="..."
;;
esac
done
check=0
for (( i=0; i <${#array_depot_file[@]}; i++ ));
do
ext="${array_depot_file[$i]##*.}"
if [ "$ext" = "uasset" ] && [ "${array_action[$i]}" != "delete" ]; then
if [[ "${array_type[$i]}" == *"+"*"l"* ]]; then
:
else
echo "${array_depot_file[$i]} 파일은+l 속성이어야 합니다"
check=$((check+1))
fi
fi
done
if (( $check > 0 )); then
echo "파일 타입 변경이 필요합니다"
exit 1
fi
exit 0
@clucle
Copy link
Author

clucle commented Jun 18, 2022

$p4 triggers

Triggers:
        uasset_file_type change-submit //YOUR_STREAM/... "/YOUR_PATH/p4_trigger_check_file_type.sh %client% %changelist%"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment