changeset 7913:1b1b3dd630a5

windows: hoist expand_glob() back into util.py The windows version of expand_glob() requires patkind(). To avoid a circular dependency, move function back into util.py.
author Steve Borho <steve@borho.org>
date Thu, 26 Mar 2009 22:07:01 -0500
parents 0b2561b53069
children 48661519913f
files mercurial/util.py mercurial/windows.py
diffstat 2 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Sun Mar 29 00:08:33 2009 +0100
+++ b/mercurial/util.py	Thu Mar 26 22:07:01 2009 -0500
@@ -844,6 +844,19 @@
 
 if os.name == 'nt':
     from windows import *
+    def expand_glob(pats):
+        '''On Windows, expand the implicit globs in a list of patterns'''
+        ret = []
+        for p in pats:
+            kind, name = patkind(p, None)
+            if kind is None:
+                globbed = glob.glob(name)
+                if globbed:
+                    ret.extend(globbed)
+                    continue
+                # if we couldn't expand the glob, just keep it around
+            ret.append(p)
+        return ret
 else:
     from posix import *
 
--- a/mercurial/windows.py	Sun Mar 29 00:08:33 2009 +0100
+++ b/mercurial/windows.py	Thu Mar 26 22:07:01 2009 -0500
@@ -229,20 +229,6 @@
     raise Abort(_('user name not available - set USERNAME '
                   'environment variable'))
 
-def expand_glob(pats):
-    '''On Windows, expand the implicit globs in a list of patterns'''
-    ret = []
-    for p in pats:
-        kind, name = patkind(p, None)
-        if kind is None:
-            globbed = glob.glob(name)
-            if globbed:
-                ret.extend(globbed)
-                continue
-            # if we couldn't expand the glob, just keep it around
-        ret.append(p)
-    return ret
-
 def username(uid=None):
     """Return the name of the user with the given uid.