comparison hgext/inotify/server.py @ 8323:589a82fb02a2

inotify: inotify.server.walk*() cleanup When not in root repo, if we meet a .hg, bail out. break was used, but return can be safely used instead: if we go through break then (top or not hginside) == False -> nothing is done after the for loop
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Mon, 04 May 2009 17:17:03 +0900
parents 3c6c21eb3416
children b923d599c309
comparison
equal deleted inserted replaced
8322:3c6c21eb3416 8323:589a82fb02a2
39 try: 39 try:
40 for name, kind in osutil.listdir(fullpath): 40 for name, kind in osutil.listdir(fullpath):
41 if kind == stat.S_IFDIR: 41 if kind == stat.S_IFDIR:
42 if name == '.hg': 42 if name == '.hg':
43 hginside = True 43 hginside = True
44 if not top: break 44 if not top:
45 return
45 else: 46 else:
46 d = join(dirname, name) 47 d = join(dirname, name)
47 if repo.dirstate._ignore(d): 48 if repo.dirstate._ignore(d):
48 continue 49 continue
49 for subdir in walkit(d, False): 50 for subdir in walkit(d, False):
74 if name == '.hg': 75 if name == '.hg':
75 hginside = True 76 hginside = True
76 if reporoot: 77 if reporoot:
77 continue 78 continue
78 else: 79 else:
79 break 80 return
80 dirs.append(name) 81 dirs.append(name)
81 elif kind in (stat.S_IFREG, stat.S_IFLNK): 82 elif kind in (stat.S_IFREG, stat.S_IFLNK):
82 files.append((name, kind)) 83 files.append((name, kind))
83 if reporoot or not hginside: 84 if reporoot or not hginside:
84 yield fullpath, dirs, files 85 yield fullpath, dirs, files