Trying to build a cmdline tool for reviewing TFS changesets. Currently I have this:
rem I know there's redundancy here, but don't care for now
set /A curr=%1
set /A prev=%curr%
set /A prev-=1
for /f "tokens=2" %g in ('tf changeset /noprompt %curr%') do tf diff /noprompt /format:unified /version:C%prev%~C%curr% %g
Which gives the following result:
g:\>tfdiffchangeset.bat 2458
currunified was unexpected at this time.
I'm not even sure why the : is turning into "curr", but if I remove /format, I get the same thing happening in /version.
Secondarily, if I just replace the :'s with spaces assuming I'll deal with that later, I get this error
g:\>tfdiffchangeset.bat 2458
The following usage of the path operator in batch-parameter
substitution is invalid: %~C%curr% %g
For valid formats type CALL /? or FOR /?
The syntax of the command is incorrect.
Is it time to write tfdiffchangeset.pl?
Final Version:
@ECHO off
set /A CURR=%1
rem Note - just using one changeset less doesn't necessarily work, because branches also use the same changeset numbers
set /A PREV=%CURR%-1
echo diffs for %CURR%
tf changeset /noprompt %CURR%
for /f "tokens=2" %%g in ('tf changeset /noprompt %CURR%') do tf diff /noprompt /format:unified /version:"C%PREV%~C%CURR%" %%g
From serverfault
Tom
-
Try:
for /f "tokens=2" %%g in ('tf changeset /noprompt %curr%') do tf diff /noprompt /format:unified /version:C%prev%~C%curr% %%g
From
HELP FOR
:To use the FOR command in a batch program, specify %%variable instead
of %variable. Variable names are case sensitive, so %i is different
from %I.Tom : Seems you got rid of the issue with the :, now there's the ~ issue.
g:\eddynet\EddynetDependent>tfdiffchangeset 2464
The following usage of the path operator in batch-parameter substitution is invalid: %~C%curr% %g
For valid formats type CALL /? or FOR /?
The syntax of the command is incorrect.Tom : Actually, I'll give you the answer, since you made me look at the help, which told me to use upper case to deal with the ~From Dennis Williamson
0 comments:
Post a Comment