SWSBB Posted October 13, 2011 Report Share Posted October 13, 2011 Hi there, i need a way to get the paths of all files updated. As i see this, the environment variable PLASTIC_UPDATE_PATH holds only the folder/workspace path which was updated. As there are many, many, many files in these folders, and i need to process a conversion on some of the files updated, it would be a real pain in (you know where), to scan the folder and process every file in there. Is there a way to get a list of all files, which have be updated? For example switching a branch, cause the file E:\workspace\stuff.txt to be updated. But all i get from PLASTIC_UPDATE_PATH is E:\workspace Kind regards, Benjamin Link to comment Share on other sites More sharing options...
manu Posted October 13, 2011 Report Share Posted October 13, 2011 Hi SWSBB! The update trigger output is only 0 or non zero if the trigger fails. You can also use also the PLASTIC_USER, PLASTIC_CLIENTMACHINE and PLASTIC_UPDATE_PATH environment variables to know about the update scenario. So, if you are looking to get the paths of all the files updated the update trigger output seems that is not your best candidate. Try using the formatted update output: --format: Sets a given output format. {0} path, {1} date, {2} owner, {3} comment, {4} changeset. So if you want to have the involved path just issue: cm update . --format={0} regards! Link to comment Share on other sites More sharing options...
SWSBB Posted October 13, 2011 Author Report Share Posted October 13, 2011 Hi manu, cm update . --format={0} this would be the command line command, or not? I've set up a trigger, which triggers on updates (via the gui or explorer extension). I want this trigger to know about the files, which were updated. Is there any change this could work? You aren't pushing the files throght the standard input stream of the script called by the trigger, are you? regards, Benjamin Link to comment Share on other sites More sharing options...
manu Posted October 13, 2011 Report Share Posted October 13, 2011 Hi SWSBB, I get now what you are talking about, that functionality is not available right now BUT it's really a good idea and we have to code it. So, I'm going to schedule the task and I'll return to you when it's done. regards. Link to comment Share on other sites More sharing options...
SWSBB Posted October 24, 2011 Author Report Share Posted October 24, 2011 Hi manu, any idea how long this could take? I'm kind of in a hurry. As we plan to BUY and USE plastic scm in the next two weeks =P When will be your next release of the version 3? Could it be in there already? Thank you very much. Kind regards, Benjamin Link to comment Share on other sites More sharing options...
manu Posted October 24, 2011 Report Share Posted October 24, 2011 Hi SWSBB, for sure you'll have the change in two weeks. Please can you contact us through sales at codicesoftware dot com with your switching plans? Regards, manu Link to comment Share on other sites More sharing options...
deanaug Posted October 24, 2011 Report Share Posted October 24, 2011 I wrote a trigger script (called it log_update.bat) to address this functionality, it runs both on before-update and after-update events (takes an argument, either "before" or "after" to determine which event is being handled): @echo off setlocal ENABLEDELAYEDEXPANSION REM ************************************************************************** REM Batch file run for Plastic SCM before-update and after-update triggers REM (runs on Plastic client, on user's machine) REM REM Creates a log of all directory/file changes resulting from the update, REM for the workspace being updated. REM ************************************************************************** REM ************************************************************************** REM "main" routine REM ************************************************************************** REM Define file locations set trigpath=C:\PlasticSCM\Triggers set outfile=%trigpath%\log_update.txt set beforefile=%trigpath%\update_before.txt set afterfile=%trigpath%\update_after.txt set logfile=%trigpath%\update_changes.txt echo ***Update Info*** > %outfile% echo Plastic server: %PLASTIC_SERVER% >> %outfile% echo Plastic client: %PLASTIC_CLIENTMACHINE% >> %outfile% REM Get date/time of update from current Windows date and time for /f "tokens=2-4 delims=/ " %%a in ('date /t') do ( set currdate=%%a/%%b/%%c ) for /f "tokens=1-2 delims=:" %%a in ('time /t') do ( set currtime=%%a:%%b ) set currdatetime=%currdate% %currtime% echo Date: %currdatetime% >> %outfile% echo. >> %outfile% REM Get root of update path from PLASTIC_UPDATE_PATH environment variable set wspath=%PLASTIC_UPDATE_PATH% echo Client workspace path: >> %outfile% echo %wspath% >> %outfile% echo. >> %outfile% cd %wspath% REM Do before-update or after-update steps, as specified if "%1"=="before" ( goto before_update ) else ( goto after_update ) REM For before-update, just save directory of workspace before update is done :before_update dir /s > %beforefile% goto all_done REM For after-update, save directory of workspace after update was done, REM compare the before and after directories, and log a cleaned up version REM of the before and after directory differences :after_update dir /s > %afterfile% fc /c /n /t /w %beforefile% %afterfile% > %logfile% echo Workspace changes resulting from update: >> %outfile% echo. >> %outfile% echo Note: >> %outfile% echo See specified lines of %beforefile% for "Before:" details >> %outfile% echo See specified lines of %afterfile% for "After:" details >> %outfile% set line1text="" set line2text="" set line3text="" set line1type=none set line2type=none set line3type=none set lastout=none set filetext=After: set dispfile=true set /a numchanges=0 REM Process each line in directory difference file (skipping first line): REM Note that a 3-line "buffer" is used to evaluate which lines from the REM file should be presented in the cleaned up difference listing. for /f "skip=1 tokens=*" %%a in (%logfile%) do ( REM Get next line from file (line 3 of buffer) set line3text=%%a REM Determine type of line for /f "tokens=1-2* delims= " %%a in ("!line3text!") do ( if "%%a"=="*****" ( if "%%b"=="" ( REM If just "*****" line is a separator set line3type=separator REM If "*****" followed by more text, line is a file name ) else ( set line3type=filename ) ) else ( REM If text contains "Directory", line is a directory name if "%%b"=="Directory" ( set line3type=dirname ) else ( REM Otherwise text indicates a directory/file change set line3type=change ) ) REM Special case for single line indicating no differences if "%%a"=="FC:" set line3type=nodiff ) REM Handle all cases of when difference file contents should be reported REM in cleaned up version of differences: REM For special case of no differences, log no difference message if "!line3type!"=="nodiff" ( echo. >> %outfile% echo ***No workspace differences after update*** >> %outfile% set lastout=nodiff ) REM If all three lines of buffer are for changes, log the second line REM of the buffer as a change (preceded by "before" or "after" indication REM if that has not been displayed yet for this set of changes) if "!line3type!"=="change" ( if "!line2type!"=="change" ( if "!line1type!"=="change" ( if "!dispfile!"=="true" ( echo. >> %outfile% echo !filetext! >> %outfile% set dispfile=false ) echo !line2text! >> %outfile% set lastout=change set /a numchanges+=1 ) ) ) REM If current line is a separator, log a separator unless last thing REM logged was also a separator if "!line3type!"=="separator" ( if not "!lastout!"=="separator" ( echo. >> %outfile% echo !line3text! >> %outfile% set lastout=separator ) ) REM If current line is a file name AND previous line was a directory REM name, log the current line of the buffer as a directory change REM (preceded by "before" or "after" indication if that has not been REM displayed yet for this set of changes) if "!line3type!"=="dirname" ( if "!line2type!"=="filename" ( if "!dispfile!"=="true" ( echo. >> %outfile% echo !filetext! >> %outfile% set dispfile=false ) echo !line3text! >> %outfile% set lastout=filename ) ) REM If current line is a file name, set text appropriately for next REM "before" or "after" file indication if "!line3type!"=="filename" ( if "!filetext!"=="After:" ( set filetext=Before: ) else ( set filetext=After: ) set dispfile=true ) REM Shift contents of 3-line buffer for next line of difference file set line1type=!line2type! set line1text=!line2text! set line2type=!line3type! set line2text=!line3text! ) REM For special case of no differences logged, log no difference message IF REM that message was not already logged above if !numchanges! EQU 0 ( if not "!lastout!"=="nodiff" ( echo. >> %outfile% echo ***No workspace differences after update*** >> %outfile% set lastout=nodiff ) ) REM del /q %beforefile% REM del /q %afterfile% REM del /q %logfile% :all_done exit 0 Before the update, all it does is a (recursive) dir listing of the workspace (saved in update_before.txt). After the update, it first does another (recursive) dir listing (saved in update_after.txt). Those files are then diffed using fc to get the resulting workspace changes (saved in update_changes.txt). The rest of the script pretties up the fc output. The net results of the script execution are saved in log_update.txt. Looking forward to actually having this functionality as part of Plastic! (BTW will this be included in a 3.0 release, or are such changes all being added to 4.0?) Thanks!!! Dean Link to comment Share on other sites More sharing options...
manu Posted October 24, 2011 Report Share Posted October 24, 2011 Awesome work Dean!!!! Link to comment Share on other sites More sharing options...
manu Posted October 24, 2011 Report Share Posted October 24, 2011 Looking forward to actually having this functionality as part of Plastic! (BTW will this be included in a 3.0 release, or are such changes all being added to 4.0?) Thanks!!! Dean It will be included in PlasticSCM 3.0 and 4.0. Link to comment Share on other sites More sharing options...
deanaug Posted October 24, 2011 Report Share Posted October 24, 2011 It will be included in PlasticSCM 3.0 and 4.0. Awesome work Manu!!!! Link to comment Share on other sites More sharing options...
SWSBB Posted October 25, 2011 Author Report Share Posted October 25, 2011 Hi all, thank you all so much. I think i found a way, pretty close to what deanaug showed up there. and thank you manu, I'm in contact with Francisco now Regards, Benjamin Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.