- @ECHO OFF
-
- SET VERSION=1.0.1
-
- :: Author: Tom Tyler <ttyler@perforce.com>
-
- :: This EXPERIMENTAL script is intended to simplify the process of pushing a
- :: large data set with 'p4 push' one changelist at a time, rather than the
- :: defaut 'p4 push' behaviour of pushing as a single, large atomic commit.
- :: A goal is to reduce the impact of the very large atomic push. Another goal
- :: is to make the push incremental so that, if any stoppages occur for
- :: whatever reason, at least some changes are successfully pushed. After the
- :: cause of the stoppage is addressed, the push can restart from where it
- :: left off.
- ::
- :: LICENSE: See: https://swarm.workshop.perforce.com/projects/perforce-software-sdp/files/main/LICENSE
- ::
- :: USAGE SYNOPSYS
- ::
- :: Usage: push_change_by_change.bat P4USER RemoteSpecName //DepotPath/...
- ::
- :: EXAMPLE
- ::
- :: Sample Usage:
- ::
- :: push_change_by_change.bat bruno PushMyBigDepot //BigProject/... > push.MyBigDepot.log 2>&1
- ::
- :: where:
- :: * bruno is the current user
- :: * PushMyBigDepot is the remote spec name
- :: * //BigProject/... is the depot path on the source server to scan for changelists to push.
- ::
- :: LIMITATIONS:
- ::
- :: This was coded for a specific one-time usage in mind, with no optimizations nor normal
- :: input validation, error handling, etc. It is also hoped that future enhancement to 'push'
- :: will make this sort of script unnecessary.
- ::
- :: This has the normal limitations of a push. The current user must be the only
- :: user pushing to the target paths defined in the remote spec.
- ::
- :: INTEGRATIONS:
- ::
- :: Thus can be configured as a Custom Tool in P4V.
- :: See: https://www.perforce.com/manuals/p4v/Content/P4V/advanced_options.custom.html
-
- IF %1x == x (
- ECHO Usage: push_change_by_change.bat P4USER RemoteSpecName //DepotPath/...
- EXIT /B 2
- ) ELSE (
- SET P4USER=%1
- )
-
- IF %2x == x (
- ECHO Usage: push_change_by_change.bat P4USER RemoteSpecName //DepotPath/...
- EXIT /B 2
- ) ELSE (
- SET RemoteSpec=%2
- )
-
- IF %3x == x (
- ECHO Usage: push_change_by_change.bat P4USER RemoteSpecName //DepotPath/...
- EXIT /B 2
- ) ELSE (
- SET DepotPath=%3
- )
-
- GOTO START
-
- :BAIL
- EXIT /B 1
-
- :START
-
- ECHO Started push_change_by_change.bat v%VERSION%
- ECHO Local P4USER: %P4USER%
- ECHO Remote Spec: %RemoteSpec%
- ECHO DepotPath: %DepotPath%
-
- SET TF1=%TEMP%\%DATE:~-4%-%DATE:~4,2%-%DATE:~7,2%-%RANDOM%%RANDOM%
-
- ECHO TF1=%TF1%
-
- p4 -ztag -F %%change%% changes -r -s submitted %DepotPath%>%TF1%
-
- ECHO Processing these changelists:
- TYPE %TF1%
-
- FOR /F %%F IN (%TF1%) DO (
- ECHO p4 -s push -r %RemoteSpec% //...@%%F,@%%F
- p4 -s push -r %RemoteSpec% //...@%%F,@%%F
- IF NOT ERRORLEVEL 0 (
- ECHO Aborting after failure to push change: %%F
- GOTO BAIL
- )
- )
-
- ECHO Success: All changes pushed.
# |
Change |
User |
Description |
Committed |
|
#1
|
31346 |
C. Thomas Tyler |
Added Windows batch shell script to push change-by-change. |
6 days ago
|
|