[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [TSVN] Feature Request: SubWCRev reads a config file...

From: Nathan Kidd <nathan-svn_at_spicycrypto.ca>
Date: 2005-08-10 22:14:24 CEST

Peter Mounce wrote:
>
> I'm playing with sed at the moment, and will let you know if I can get
> it doing what we want. Well, I say "at the moment", but I probably mean
> tomorrow ;)

In case you're not familiar with sed syntax, you basically want:

s/REPLACE THIS/WITH THIS/g
 or
/ON LINES MATCHING THIS/s/REPLACE THIS/WITH THIS/g

We use this in our build scripts all the time.

You could use something like:

--
set filesWithVersion=src\version.in src\version.h
for %%i in (%filesWithVersion%) do (
  call :replaceVersionStrings %%i
)
goto :eof
:: replace version values in a file, using sed
:replaceVersionStrings
setlocal
  set "file=%~1"
  if not exist "%file%" goto :error
  copy "%file%" "%file%.orig" || goto :error
  sed "s/\$Version_Placeholder/%VERSION_NUMBER%/g" "%file%.orig" >
"%file%" || goto :error
  del "%file%.orig"
endlocal
goto :eof
:error
  echo Error in :replaceVersionStrings "%file%"!
endlocal
goto :eof
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Wed Aug 10 22:14:19 2005

This is an archived mail posted to the TortoiseSVN Dev mailing list.