libp4u.sh #4

  • //
  • guest/
  • perforce_software/
  • sdp/
  • main/
  • Server/
  • Unix/
  • p4/
  • common/
  • lib/
  • libp4u.sh
  • View
  • Commits
  • Open Download .zip Download (1 KB)
# shellcheck disable=SC2148 disable=SC2034
declare Version=2.2.0
#==============================================================================
# Copyright and license info is available in the LICENSE file included with
# the Server Deployment Package (SDP), and also available online:
# https://swarm.workshop.perforce.com/projects/perforce-software-sdp/view/main/LICENSE
#------------------------------------------------------------------------------

#==============================================================================
# Library Functions.

#------------------------------------------------------------------------------
# Function: getLocalPath
#
# Input:
# $1 - p4Path in depot or client syntax, e.g. "//depot/main/foo.c"
#
# Usage Example: localPath=$(getLocalPath "//depot/main/foo.c")
#------------------------------------------------------------------------------
function getLocalPath {
   declare p4Path=$1
   declare localPath

   [[ -n "$p4Path" ]] || return

   localPath=$(p4 -ztag where "$p4Path"|grep "^\.\.\. path"|tail -1)
   localPath=${localPath#... path }
   localPath=${localPath%\/\.\.\.}
   echo -n "$localPath"
}
# Change User Description Committed
#4 26403 C. Thomas Tyler Released SDP 2019.3.26400 (2020/03/28).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#3 15856 C. Thomas Tyler Replaced the big license comment block with a shortened
form referencing the LICENSE file included with the SDP
package, and also by the URL for the license file in
The Workshop.
#2 13587 C. Thomas Tyler Copy up of recent minor dev branch changes to auxiliary scripts
and comments.  No core SDP functionality changes.
#1 10148 C. Thomas Tyler Promoted the Perforce Server Deployment Package to The Workshop.