AW: [cvsnt] Beautify source at commit

Pink Dietmar dietmar at sip.co.at
Tue Sep 2 07:19:11 BST 2003


Community technical support mailing list was retired 2010 and replaced with a professional technical support team. For assistance please contact: Pre-sales Technical support via email to sales@march-hare.com.


I solved the problem yesterday. Here is what I have done.

At following line to the commitinfo file (The path must point to your
repository):

ALL	E:\cvsrepo\Test\CVSROOT\beautify_commit.bat

Create a file named beautify_commit.bat with the following content:


@echo off
:: Takes a variable amount of filenames as parameters and decides by
their 
:: extensions if the sourcesytler should be called or not

:: First argument is module path, so we skip this
shift
:initial
if "%1"   == ""     goto done
if "%~x1" == ".c"   goto lsourcestyler
if "%~x1" == ".cpp" goto lsourcestyler
if "%~x1" == ".h"   goto lsourcestyler

:: Take next argument
shift
goto initial

:lsourcestyler

:: The cvsnt already converted to unix linefeets, so we change back to
DOS.
echo unix2dos %1
start /WAIT unix2dos %1

:: If we had problems we abort the commit
if %errorlevel% NEQ 0 exit 1

:: Here we are using the propietary sourcestyler C++ (should also work
with indent)
echo beautify %1
start /WAIT sourcestylercmd -s SIPchkin %1 %1

:: If we had problems we abort the commit
if %errorlevel% NEQ 0 exit 1

:: Now we change back to unix format
echo dos2unix %1
start /WAIT dos2unix %1

:: If we had problems we abort the commit
if %errorlevel% NEQ 0 exit 1

:: Take next argument
shift
goto initial

:done
exit 0

The unix2dos converters are found in the network, I set the path to them
in the environment variables. Also the path to the sourcestyler is set.
So this bat file can be used in any repository without changing.

At the following line to the checkoutlist file:

beautify_commit.bat  Unable to check out 'beautify_commit.bat' in
CVSROOT.

Now at the beautify_commit.bat file to the CVSROOT of your repository
and commit the changed files to rebuild the administrative database.

NOTE: The thing which confused me most, is that you can't see the
changes when you are only doing a update command. Because your local
revisionnumber and the repository revisionnumber are the same, the cvs
doesn’t update the working copy even when they are different. When you
have everything commited you have to drop your working copy and check
out the module or file to get the changes.

Dietmar Pink

-----Ursprüngliche Nachricht-----
Von: Glen Starrett [mailto:grstarrett at cox.net] 
Gesendet: Montag, 01. September 2003 20:37
An: 'Dietmar Pink'; cvsnt at cvsnt.org cvsnt downloads at march-hare.com @CVSNT on Twitter CVSNT on Facebook
Betreff: RE: [cvsnt] Beatify source at commit

> I want to run a source beautifier at each commit the repository.

You probably want to run your beautifier as postcommit, and I think
you'll have to set it up to have a local sandbox, update it, beautify,
then commit it.  I think.  I've never done anything like that--maybe
someone else who has could be of more help.

Glen Starrett






More information about the cvsnt mailing list
Download the latest CVSNT, TortosieCVS, WinCVS etc. for Windows 8 etc.
@CVSNT on Twitter   CVSNT on Facebook