#! /bin/sh ############################################################################## # Name : changefilename.sh # Purpose : Change file name after sync adding to it CHG list Number + Rev Number # Done for : Direct Solution # By : Ilya Rokhkin # Date : 22-Aug-2004 # Arguments : 1 - Filename in OS format # (get input as argument - selected (highlighted) # Installation : 1)Copy file changefilename.sh to any directory # For example: D:\Perforce_scripts. # 2)Open P4Win, click menu:Tools:Customize:Add and put Menu Label: # "Change File Name" # 3)Set "Menu Item is a Command" and click OK. # Put all Command attributes using example: # Command: # d:\cygwin\bin\bash.exe d:\Perforce_scripts\rollbackchg.sh # Initial Directory: # Console Application [ ] # Close Window upon exit [ ] # Prompt for Arguments [ ] # Refresh P4Win upon Exit [ ] # Add to context menus if enabled [v] # Arguments: %f # and click OK. # Using : Open P4Win, open "Depot" Tree pane, right click on # the File/s in Depot ############################################################################## # FLNAME - File name from Perforce in OS format FLNAME=$1 # Sync the file p4 sync $FLNAME # Calculate the file's latest revision and its changelist flnameadd=`p4 filelog $FLNAME | /usr/bin/head -2 | /usr/bin/sed '1d' | /usr/bin/awk '{print $4,$2}' | /usr/bin/sed 's/#/-/' | /usr/bin/sed 's/ //'` # Separate the filename before and after point . flbefore=`echo $FLNAME | /usr/bin/awk -F. '{print $1}'` flafter=`echo $FLNAME | /usr/bin/awk -F. '{print $2}'` # Copy the file to new filename + changelist + Revision + extension. cp $FLNAME $flbefore$flnameadd.$flafter
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 4522 | Ilya Rokhkin |
By Ilya Add my scripts |