[cvsnt] How to capture new IP addres of the CVSNT server intomy copy?

Michael Wojcik Michael.Wojcik at microfocus.com
Mon Jan 8 14:03:48 GMT 2007


> From: cvsnt-bounces at cvsnt.org 
> [mailto:cvsnt-bounces at cvsnt.org] On Behalf Of David Somers
> Sent: Monday, 08 January, 2007 06:27
> To: cvsnt at cvsnt.org
> Subject: Re: [cvsnt] How to capture new IP addres of the 
> CVSNT server intomy copy?
> 
> Petr Prikryl wrote:
> 
> > Is there any way how to update my local copy so that the new IP
address
> > of the CVSNT server was captured into many CVS/Root files in many
> > subdirectories?
> 
> If your referred to the host by name, then you don't need to do
anything
> (since it stores the hostname and not its resolved IP address)

I don't think Petr said the hostname hadn't changed.

We recently had to update all of our Root files due to server
relocation.  The old CVS server is still used for a number of other
purposes, so it had to keep its old hostname.  Addressing by name does
not prevent all future issues.

Now, had the old server been originally addressed using an alias (DNS
CNAME) that was used exclusively for CVS purposes, *that* name could
have been transferred to the new server.  (Any problem can be solved by
another level of indirection...)  But the CVS admins didn't think of
that.

> If you referred to the host by a dotted-IP address, and that address
has
> changed, then you could use WinCVS as that has a macro to make the
changes
> to your sandbox.

Alternatively, here's a Windows cmd script (XP or later) which can be
used to change the server name in the Root file:

-----
@echo off
rem Change all CVS/Root files in or below current directory that
currently
rem point to old-server to point to new-server instead.

setlocal enabledelayedexpansion

for /r . %%f in (Root) do (
   if exist %%f (
      echo %%f
      for /f %%l in (%%~sf) do (
         set root=%%l
         if exist "%%f.old" del "%%f.old"
         ren "%%f" Root.old
         echo !root:old-server=new-server!> "%%f"
         )
      )
   )

endlocal
-----

Edit it to change the names "old-server" and "new-server" to the old and
new server names.  This script is relatively robust - it handles
directory components with spaces, for example.  (I don't know *why*
anyone would create spacy directories in their CVS repository, but some
of my coworkers have.  Sigh.)

-- 
Michael Wojcik
Principal Software Systems Developer, Micro Focus


More information about the cvsnt mailing list