[Digicool-CVS] CVS: CVSROOT - adjustlinks.py:1.4

Ken Manheimer klm@cvs.zope.org
Sat, 4 Aug 2001 14:23:27 -0400


Update of /cvs-repository/CVSROOT
In directory cvs.zope.org:/tmp/cvs-serv30222

Modified Files:
	adjustlinks.py 
Log Message:
all_containers(): Include the original path, as well as the symlinked
ones, to include the direct, non-symlink locations!

path_element_inodes(): Require the path or the directory containing
the path to exist, for it to qualify.


=== CVSROOT/adjustlinks.py 1.3 => 1.4 ===
 # Assume the repository root dir contains the CVSROOT script dir.
 REPO_ROOT = os.path.split(SCRIPT_DIR)[0]
-
 RECIPE_PATH = os.path.join(SCRIPT_DIR, RECIPE_NAME)
 
 EMPTY_DIR = REPO_ROOT + "/CVSROOT/Emptydir"
@@ -230,27 +229,28 @@
         # path, and identify all those links whose targets are one of those
         # directories.
 
+        got = {path: 1}
+
         if path[:len(os.sep)] == os.sep:
             path = path[len(os.sep):]
         path = os.path.join(REPO_ROOT, path)
 
-        got = []
         element_inodes = path_element_inodes(path)
         if element_inodes:
             for link, target, lineno in self._recipe_lines:
                 if (exists(target)
                     and (os.stat(target)[ST_INO] in element_inodes)):
                     # (Strip the REPO_ROOT prefix.)
-                    got.append(link[len(REPO_ROOT)+1:])
+                    got[link[len(REPO_ROOT)+1:]] = 1
 
-        return got
+        return got.keys()
 
 def path_element_inodes(path, split=os.path.split,
                         stat=os.stat, ST_INO=stat.ST_INO):
     """Return inodes of directory elements leading to path's physical location.
     We return the empty list if path doesn't actually exist."""
     got = []
-    if os.path.exists(path):
+    if (os.path.exists(path) or os.path.exists(split(path)[0])):
         origdir = os.getcwd()
         try:
             if os.path.isdir(path):