comparison mercurial/localrepo.py @ 6764:8db64464d136

context: add walk method
author Matt Mackall <mpm@selenic.com>
date Fri, 27 Jun 2008 19:25:48 -0500
parents f67d1468ac50
children 97c12b1ed1e0
comparison
equal deleted inserted replaced
6763:403682f1c678 6764:8db64464d136
939 ''' 939 '''
940 walk recursively through the directory tree or a given 940 walk recursively through the directory tree or a given
941 changeset, finding all files matched by the match 941 changeset, finding all files matched by the match
942 function 942 function
943 ''' 943 '''
944 944 return self[node].walk(match)
945 if node:
946 fdict = dict.fromkeys(match.files())
947 # for dirstate.walk, files=['.'] means "walk the whole tree".
948 # follow that here, too
949 fdict.pop('.', None)
950 for fn in self[node]:
951 for ffn in fdict:
952 # match if the file is the exact name or a directory
953 if ffn == fn or fn.startswith("%s/" % ffn):
954 del fdict[ffn]
955 break
956 if match(fn):
957 yield fn
958 for fn in util.sort(fdict):
959 if match.bad(fn, 'No such file in rev ' + short(node)) \
960 and match(fn):
961 yield fn
962 else:
963 for src, fn, st in self.dirstate.walk(match, True, False):
964 yield fn
965 945
966 def status(self, node1=None, node2=None, match=None, 946 def status(self, node1=None, node2=None, match=None,
967 ignored=False, clean=False, unknown=False): 947 ignored=False, clean=False, unknown=False):
968 """return status of files between two nodes or node and working directory 948 """return status of files between two nodes or node and working directory
969 949