[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools - loader.py:1.13

Fred L. Drake, Jr. fred at zope.com
Fri May 7 15:33:27 EDT 2004


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

Modified Files:
	loader.py 
Log Message:


- new function: fromPath(); this works with files that are in either
  CVS or Subversion, returning None for files that aren't in either




=== Packages/zpkgtools/zpkgtools/loader.py 1.12 => 1.13 ===
--- Packages/zpkgtools/zpkgtools/loader.py:1.12	Thu May  6 23:27:18 2004
+++ Packages/zpkgtools/zpkgtools/loader.py	Fri May  7 15:33:25 2004
@@ -342,6 +342,23 @@
 #################################################################
 
 
+def fromPath(path):
+    """Get a revision-control URL from a working copy.
+
+    This can support either CVS or Subversion checkouts.
+
+    :param path: Path to a directory or file checked out from a
+      supported revision-control system.
+    :type path: path
+
+    :return: Parsed URL object, or `None`.
+    """
+    url = cvsloader.fromPath(path)
+    if url is None:
+        url = svnloader.fromPath(path)
+    return url
+
+
 def parse(url):
     """Parse a revision-control URL.
 
@@ -360,6 +377,7 @@
         return cvsloader.parse(url)
     except ValueError:
         return svnloader.parse(url)
+
 
 def join(base, relurl):
     """Join a base and relative URL.




More information about the Zope-CVS mailing list