[Gambas-devel] [Gambas-user] Change to IDE to recognize CVS rootdir

Christopher Brian Jack brian at ...418...
Tue Nov 14 19:51:00 CET 2006


On Sat, 11 Nov 2006, Benoit Minisini wrote:

> There is a module named VersionControl in the IDE source code. There you will
> find all SVN commands executed when moving, renaming, creating and deleting a
> file that must be versioned. And you can tell me which CVS commands I should
> add to do the same thing for CVS.
>
> Regards,
>
> --
> Benoit Minisini

Only thing to beware of is that adding files in CVS requires the cvs add
<somefile> to be done AFTER the somefile exists and that cvs remove
<somefile> must be done BEFORE somefile is deleted.  Same goes for
directories.

Here's an updated VersionControl.module source:

===================== 8< ================================
' Gambas module file

PRIVATE $bSVN AS Boolean
PRIVATE $bCVS AS Boolean

'
'  TODO: When do these operations commit?
'

PUBLIC SUB Update()

  $bSVN = Exist(Project.Dir &/ ".svn")
  $bCVS = Exist(Project.Dir &/ "CVS") OR Exist(Project.Dir &/ "CVSROOT")

END

PUBLIC SUB AddFile(sPath AS String)

  IF $bSVN THEN
    SHELL "svn add " & Project.Quote(sPath) WAIT
  ENDIF
  IF $bCVS THEN
    'NB: For CVS file must already exist
    SHELL "cvs add " & Project.Quote(sPath) WAIT
  ENDIF

END

PUBLIC SUB AddDir(sPath AS String)

  IF $bSVN THEN
    SHELL "svn add " & Project.Quote(sPath) WAIT
  ENDIF
  IF $bCVS THEN
    'NB: For CVS, directory must already exist
    SHELL "cvs add " & Project.Quote(sPath) WAIT
  ENDIF

END

PUBLIC SUB RemoveFile(sPath AS String)

  IF $bSVN THEN
    SHELL "svn remove " & Project.Quote(sPath) WAIT
  ENDIF
  IF $bCVS THEN
    'NB: For CVS do 'cvs remove file' first then delete file
    SHELL "cvs remove " & Project.Quote(sPath) WAIT
  ENDIF

END

PUBLIC SUB RemoveDir(sPath AS String)

  IF $bSVN THEN
    SHELL "svn remove " & Project.Quote(sPath) WAIT
  ENDIF
  IF $bCVS THEN
    'NB: For CVS do 'cvs remove dirname' first then delete dirname
    SHELL "cvs remove " & Project.Quote(sPath) WAIT
  ENDIF

END


PUBLIC SUB MoveFile(sOld AS String, sNew AS String)

  IF $bSVN THEN
    AddFile(sNew)
    RemoveFile(sOld)
  ENDIF
  IF $bCVS THEN
    'NB: make sure the file is added BEFORE
    AddFile(sNew)
    'NB: make sure the file deleted AFTER
    RemoveFile(sOld)
  ENDIF

END
===================== 8< ================================

.=================================================.
|  Christopher BRIAN Jack aka "Gau of the Veldt"  |
+================================================='
| oevna at ...542...
`=================================================-
Hi Spambots, my email address is sputnik at ...418...
Hi Humans, my email address uses rot13 cipher




More information about the Devel mailing list