535: Fix for CVS error "Absolute Module Reference Invalid"

Tony.*****@gmai***** (Google Code) (Is this you? Claim this profile.)
June 11, 2011
Pretty simple fix attached.  Full details are here:

http://groups.google.com/group/reviewboard/browse_thread/thread/d5fa15a9e93ef6a2

--Tony
Index: cvs.py
===================================================================
--- cvs.py	(revision 1392)
+++ cvs.py	(working copy)
@@ -127,6 +127,7 @@
 
 
 class CVSClient:
+    regex_repopath = re.compile(r'^(?P<hostname>.*):(?P<port>\d+)?(?P<path>.*)')
     def __init__(self, repository):
         self.tempdir = ""
         self.currentdir = os.getcwd()
@@ -145,6 +146,18 @@
         # working directory even though we force stdout with -p.
         self.tempdir = tempfile.mkdtemp()
         os.chdir(self.tempdir)
+        
+        # Do same regex as in CVSTool class at top of this file to get handle to repo location
+        m = self.regex_repopath.match(self.repository)
+        repo = m.group("path")
+        
+        # We strip the repo of of the fully qualified path as CVS does not like to be given absolute 
+        # paths
+        filename = filename.replace(repo,'')
+       
+        # Not sure why but we get the CVS ",v" version here instead of the plain file name.  Str
#1 matt.mc*******@gmai***** (Google Code) (Is this you? Claim this profile.)
Found two other problems:

1. If the path component of the cvs root isn't doesn't end with a '/', the resulting
file name will begin appear to be an absolute path, which CVS doesn't like.

2. If the files are in an 'Attic' directory, the 'Attic/' component of the path needs
to be removed.

The attached diff incorporates Tony's diff above and the changes I made for (1) and (2).

--mcc
  • +
    Index: cvs.py
    ===================================================================
    --- cvs.py	(revision 1392)
    +++ cvs.py	(working copy)
    @@ -127,6 +127,7 @@
     
     
     class CVSClient:
    +    regex_repopath = re.compile(r'^(?P<hostname>.*):(?P<port>\d+)?(?P<path>.*)')
         def __init__(self, repository):
             self.tempdir = ""
             self.currentdir = os.getcwd()
    @@ -145,7 +146,26 @@
             # working directory even though we force stdout with -p.
             self.tempdir = tempfile.mkdtemp()
             os.chdir(self.tempdir)
    +        
    +        # Do same regex as in CVSTool class at top of this file to get handle to repo location
    +        m = self.regex_repopath.match(self.repository)
    +        repo = m.group("path")
    +        
    +        # We strip the repo of of the fully qualified path as CVS does not like to be given absolute 
    +        # paths
    +        filename = filename.replace(repo,'')
    +      
    +        # Strip the leading '/'
    +        if filename[0] == '/':
    +            filename = filename[
david
#2 david
Fixed in r1394.
  • +Fixed
chipx86
#3 chipx86
Sounds like this broke again.
  • -Fixed
    +Confirmed
  • -Priority-Medium
    +Priority-High
    +Component-SCMTools
    +Milestone-Release1.5.x
david
#4 david
I haven't actually seen any additional bug reports or +1s on existing reports related to this in the last 2 years.
  • -Confirmed
    +Fixed
#5 gecker******@gmai***** (Google Code) (Is this you? Claim this profile.)
This is definitely broken in 1.6.1 using a newer version of cvsnt and its diff to generate the file:

Concurrent Versions System (CVSNT) 2.8.01 (Soolin) Build 4269 (client/server)

Copyright (c) 1989-2001 Brian Berliner, david d `zoo' zuhn,
                        Jeff Polk, and other authors
CVSNT version (Sep  2 2011) Copyright (c) 1999-2009 Tony Hoyle and others
see http://www.cvsnt.org