comparison mercurial/localrepo.py @ 6753:ed5ffb2c12f3

repo.status: eliminate list_
author Matt Mackall <mpm@selenic.com>
date Thu, 26 Jun 2008 14:35:50 -0500
parents fb42030d79d6
children f8299c84b5b6
comparison
equal deleted inserted replaced
6752:e79a8f36c2a5 6753:ed5ffb2c12f3
970 else: 970 else:
971 for fn in self.dirstate.walk(match): 971 for fn in self.dirstate.walk(match):
972 yield fn 972 yield fn
973 973
974 def status(self, node1=None, node2=None, match=None, 974 def status(self, node1=None, node2=None, match=None,
975 list_ignored=False, list_clean=False, list_unknown=True): 975 ignored=False, clean=False, unknown=True):
976 """return status of files between two nodes or node and working directory 976 """return status of files between two nodes or node and working directory
977 977
978 If node1 is None, use the first dirstate parent instead. 978 If node1 is None, use the first dirstate parent instead.
979 If node2 is None, compare node1 with working directory. 979 If node2 is None, compare node1 with working directory.
980 """ 980 """
992 return mf 992 return mf
993 993
994 if not match: 994 if not match:
995 match = match_.always(self.root, self.getcwd()) 995 match = match_.always(self.root, self.getcwd())
996 996
997 listignored, listclean, listunknown = ignored, clean, unknown
997 modified, added, removed, deleted, unknown = [], [], [], [], [] 998 modified, added, removed, deleted, unknown = [], [], [], [], []
998 ignored, clean = [], [] 999 ignored, clean = [], []
999 1000
1000 compareworking = False 1001 compareworking = False
1001 if not node1 or (not node2 and node1 == self.dirstate.parents()[0]): 1002 if not node1 or (not node2 and node1 == self.dirstate.parents()[0]):
1008 mf1 = mfmatches(node1) 1009 mf1 = mfmatches(node1)
1009 1010
1010 # are we comparing the working directory? 1011 # are we comparing the working directory?
1011 if not node2: 1012 if not node2:
1012 (lookup, modified, added, removed, deleted, unknown, 1013 (lookup, modified, added, removed, deleted, unknown,
1013 ignored, clean) = self.dirstate.status(match, list_ignored, 1014 ignored, clean) = self.dirstate.status(match, listignored,
1014 list_clean, list_unknown) 1015 listclean, listunknown)
1015 # are we comparing working dir against its parent? 1016 # are we comparing working dir against its parent?
1016 if compareworking: 1017 if compareworking:
1017 if lookup: 1018 if lookup:
1018 fixup = [] 1019 fixup = []
1019 # do a full compare of any files that might have changed 1020 # do a full compare of any files that might have changed
1023 if (f not in ctx or ff(f) != ctx.flags(f) 1024 if (f not in ctx or ff(f) != ctx.flags(f)
1024 or ctx[f].cmp(self.wread(f))): 1025 or ctx[f].cmp(self.wread(f))):
1025 modified.append(f) 1026 modified.append(f)
1026 else: 1027 else:
1027 fixup.append(f) 1028 fixup.append(f)
1028 if list_clean: 1029 if listclean:
1029 clean.append(f) 1030 clean.append(f)
1030 1031
1031 # update dirstate for files that are actually clean 1032 # update dirstate for files that are actually clean
1032 if fixup: 1033 if fixup:
1033 wlock = None 1034 wlock = None
1071 if fn in mf1: 1072 if fn in mf1:
1072 if (mf1.flags(fn) != mf2.flags(fn) or 1073 if (mf1.flags(fn) != mf2.flags(fn) or
1073 (mf1[fn] != mf2[fn] and 1074 (mf1[fn] != mf2[fn] and
1074 (mf2[fn] != "" or fcmp(fn, getnode)))): 1075 (mf2[fn] != "" or fcmp(fn, getnode)))):
1075 modified.append(fn) 1076 modified.append(fn)
1076 elif list_clean: 1077 elif listclean:
1077 clean.append(fn) 1078 clean.append(fn)
1078 del mf1[fn] 1079 del mf1[fn]
1079 else: 1080 else:
1080 added.append(fn) 1081 added.append(fn)
1081 1082