Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.py @ 8614:573734e7e6d0
cmdutils: Take over glob expansion duties from util
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 24 May 2009 16:38:29 -0500 |
parents | 7fe2012b3bd0 |
children | a87c41f65aff |
comparison
equal
deleted
inserted
replaced
8613:4dea46d4e3f8 | 8614:573734e7e6d0 |
---|---|
14 """ | 14 """ |
15 | 15 |
16 from i18n import _ | 16 from i18n import _ |
17 import error, osutil | 17 import error, osutil |
18 import cStringIO, errno, re, shutil, sys, tempfile, traceback | 18 import cStringIO, errno, re, shutil, sys, tempfile, traceback |
19 import os, stat, time, calendar, glob, random | 19 import os, stat, time, calendar, random |
20 import imp | 20 import imp |
21 | 21 |
22 # Python compatibility | 22 # Python compatibility |
23 | 23 |
24 def sha1(s): | 24 def sha1(s): |
538 def lookup_reg(key, name=None, scope=None): | 538 def lookup_reg(key, name=None, scope=None): |
539 return None | 539 return None |
540 | 540 |
541 if os.name == 'nt': | 541 if os.name == 'nt': |
542 from windows import * | 542 from windows import * |
543 def expand_glob(pats): | |
544 '''On Windows, expand the implicit globs in a list of patterns''' | |
545 ret = [] | |
546 for p in pats: | |
547 kind, name = _patsplit(p, None) | |
548 if kind is None: | |
549 globbed = glob.glob(name) | |
550 if globbed: | |
551 ret.extend(globbed) | |
552 continue | |
553 # if we couldn't expand the glob, just keep it around | |
554 ret.append(p) | |
555 return ret | |
556 else: | 543 else: |
557 from posix import * | 544 from posix import * |
558 | 545 |
559 def makelock(info, pathname): | 546 def makelock(info, pathname): |
560 try: | 547 try: |