[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools - cvsloader.py:1.3 locationmap.py:1.2

Fred L. Drake, Jr. fred at zope.com
Tue Mar 9 13:54:04 EST 2004


Update of /cvs-repository/Packages/zpkgtools/zpkgtools
In directory cvs.zope.org:/tmp/cvs-serv18043

Modified Files:
	cvsloader.py locationmap.py 
Log Message:
move the join() method from RepositoryUrl to CvsUrl; each revision control
system needs to define an appropriate .join() method; it does not make sense
for RepositoryUrl to know about all of them


=== Packages/zpkgtools/zpkgtools/cvsloader.py 1.2 => 1.3 ===
--- Packages/zpkgtools/zpkgtools/cvsloader.py:1.2	Fri Mar  5 19:34:56 2004
+++ Packages/zpkgtools/zpkgtools/cvsloader.py	Tue Mar  9 13:53:33 2004
@@ -159,6 +159,20 @@
             url = "%s:%s" % (url, self.tag)
         return url
 
+    def join(self, relurl):
+        assert isinstance(relurl, RepositoryUrl)
+        cvsurl = copy.copy(self)
+        if relurl.path:
+            path = posixpath.normpath(relurl.path)
+            if path[:1] == "/":
+                newpath = path[1:]
+            else:
+                newpath = posixpath.join(cvsurl.path, relurl.path)
+            cvsurl.path = posixpath.normpath(newpath)
+        if relurl.tag:
+            cvsurl.tag = relurl.tag
+        return cvsurl
+
 
 class RepositoryUrl:
     def __init__(self, path, tag=None):
@@ -171,21 +185,6 @@
             url = "%s:%s" % (url, self.tag)
         return url
 
-    def join(self, cvsurl):
-        cvsurl = copy.copy(cvsurl)
-        if self.path:
-            path = posixpath.normpath(self.path)
-            if path[:1] == "/":
-                newpath = path[1:]
-            else:
-                newpath = posixpath.join(cvsurl.path, self.path)
-        else:
-            newpath = cvsurl.path
-        cvsurl.path = posixpath.normpath(newpath)
-        if self.tag:
-            cvsurl.tag = self.tag
-        return cvsurl
-
 
 class CvsLoader:
 
@@ -213,7 +212,7 @@
                     "load() requires a cvs or repository URL; received %r"
                     % url)
         if isinstance(url, RepositoryUrl):
-            cvsurl = url.join(self.cvsurl)
+            cvsurl = self.cvsurl.join(url)
         elif isinstance(url, CvsUrl):
             cvsurl = copy.copy(url)
         else:
@@ -279,7 +278,7 @@
 
     def isFileResource(self, cvsurl):
         if isinstance(cvsurl, RepositoryUrl):
-            cvsurl = cvsurl.join(self.cvsurl)
+            cvsurl = self.cvsurl.join(cvsurl)
         if not cvsurl.path:
             # The whole repository is always a directory
             return False


=== Packages/zpkgtools/zpkgtools/locationmap.py 1.1 => 1.2 ===
--- Packages/zpkgtools/zpkgtools/locationmap.py:1.1	Tue Mar  9 10:20:37 2004
+++ Packages/zpkgtools/zpkgtools/locationmap.py	Tue Mar  9 13:53:33 2004
@@ -94,7 +94,7 @@
                         "repository: URLs are not supported"
                         " without a cvs: base URL",
                         lineno)
-                cvsurl = cvsurl.join(cvsbase)
+                cvsurl = cvsbase.join(cvsurl)
             url = cvsurl.getUrl()
 
         # We only want to add it once, so that loading several




More information about the Zope-CVS mailing list