#!/bin/sh ############################################################################## # Name : recoverdeletedfolder.sh # Purpose : Recover all deleted files in folders from 1 changeist # Done for : Direct Solution # By : Ilya Rokhkin # Date : 28-Jul-2004 # Arguments : 1 - Submitted changelist # (get input as argument - selected (highlighted) # Installation : 1)Copy file recoverdeletedfolder.sh to any directory # For example: D:\Perforce_scripts. # 2)Open P4Win, click menu:Tools:Customize:Add and put Menu Label: # "Recover Deleted Files" # 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 [v] # Close Window upon exit [ ] # Prompt for Arguments [ ] # Refresh P4Win upon Exit [ ] # Add to context menus if enabled [v] # Arguments: %c # and click OK. # Using : Open P4Win, open "Submitted changelists" pane, right click on # the submitted changelist which Files should be recovered ############################################################################## CHG=$1 ## p4 change -o | /usr/bin/sed 's/<enter description here>/xxx/' | p4 change -i for i in `p4 describe -s $CHG | /usr/bin/grep "... //" | /usr/bin/awk '{print $2}'` do echo $i FILEN=`echo $i | /usr/bin/awk -F# '{print $1}'` REV=`echo $i | /usr/bin/awk -F# '{print $2-1}'` if [ $REV != "0" ] then echo $FILEN" - Previous revision = "$REV" , open this file for add" p4 sync $FILEN#$REV 1>/dev/null 2>&1 p4 add $FILEN echo "--------------------------" fi done p4 change -o | /usr/bin/sed 's/<enter description here>/Recover all Files from CHG $CHG/' | p4 submit -i exit 0
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 4522 | Ilya Rokhkin |
By Ilya Add my scripts |