comparison mercurial/localrepo.py @ 6603:41eb20cc1c02

match: remove files arg from repo.status and friends
author Matt Mackall <mpm@selenic.com>
date Mon, 12 May 2008 11:37:08 -0500
parents a259e217bc0c
children 6334569c8caa
comparison
equal deleted inserted replaced
6602:a57a27b12965 6603:41eb20cc1c02
9 from i18n import _ 9 from i18n import _
10 import repo, changegroup 10 import repo, changegroup
11 import changelog, dirstate, filelog, manifest, context, weakref 11 import changelog, dirstate, filelog, manifest, context, weakref
12 import lock, transaction, stat, errno, ui 12 import lock, transaction, stat, errno, ui
13 import os, revlog, time, util, extensions, hook, inspect 13 import os, revlog, time, util, extensions, hook, inspect
14 import match as match_
14 15
15 class localrepository(repo.repository): 16 class localrepository(repo.repository):
16 capabilities = util.set(('lookup', 'changegroupsubset')) 17 capabilities = util.set(('lookup', 'changegroupsubset'))
17 supported = ('revlogv1', 'store') 18 supported = ('revlogv1', 'store')
18 19
746 p1, p2 = self.dirstate.parents() 747 p1, p2 = self.dirstate.parents()
747 return self.commit(files=files, text=text, user=user, date=date, 748 return self.commit(files=files, text=text, user=user, date=date,
748 p1=p1, p2=p2, extra=extra, empty_ok=True) 749 p1=p1, p2=p2, extra=extra, empty_ok=True)
749 750
750 def commit(self, files=None, text="", user=None, date=None, 751 def commit(self, files=None, text="", user=None, date=None,
751 match=util.always, force=False, force_editor=False, 752 match=None, force=False, force_editor=False,
752 p1=None, p2=None, extra={}, empty_ok=False): 753 p1=None, p2=None, extra={}, empty_ok=False):
753 wlock = lock = tr = None 754 wlock = lock = tr = None
754 valid = 0 # don't save the dirstate if this isn't set 755 valid = 0 # don't save the dirstate if this isn't set
755 if files: 756 if files:
756 files = util.unique(files) 757 files = util.unique(files)
962 yield fn 963 yield fn
963 else: 964 else:
964 for fn in self.dirstate.walk(match): 965 for fn in self.dirstate.walk(match):
965 yield fn 966 yield fn
966 967
967 def status(self, node1=None, node2=None, files=[], match=util.always, 968 def status(self, node1=None, node2=None, match=None,
968 list_ignored=False, list_clean=False, list_unknown=True): 969 list_ignored=False, list_clean=False, list_unknown=True):
969 """return status of files between two nodes or node and working directory 970 """return status of files between two nodes or node and working directory
970 971
971 If node1 is None, use the first dirstate parent instead. 972 If node1 is None, use the first dirstate parent instead.
972 If node2 is None, compare node1 with working directory. 973 If node2 is None, compare node1 with working directory.
982 for fn in mf.keys(): 983 for fn in mf.keys():
983 if not match(fn): 984 if not match(fn):
984 del mf[fn] 985 del mf[fn]
985 return mf 986 return mf
986 987
988 if not match:
989 match = match_.always(self.root, self.getcwd())
990
987 modified, added, removed, deleted, unknown = [], [], [], [], [] 991 modified, added, removed, deleted, unknown = [], [], [], [], []
988 ignored, clean = [], [] 992 ignored, clean = [], []
989 993
990 compareworking = False 994 compareworking = False
991 if not node1 or (not node2 and node1 == self.dirstate.parents()[0]): 995 if not node1 or (not node2 and node1 == self.dirstate.parents()[0]):
998 mf1 = mfmatches(node1) 1002 mf1 = mfmatches(node1)
999 1003
1000 # are we comparing the working directory? 1004 # are we comparing the working directory?
1001 if not node2: 1005 if not node2:
1002 (lookup, modified, added, removed, deleted, unknown, 1006 (lookup, modified, added, removed, deleted, unknown,
1003 ignored, clean) = self.dirstate.status(files, match, 1007 ignored, clean) = self.dirstate.status(match, list_ignored,
1004 list_ignored, list_clean, 1008 list_clean, list_unknown)
1005 list_unknown)
1006
1007 # are we comparing working dir against its parent? 1009 # are we comparing working dir against its parent?
1008 if compareworking: 1010 if compareworking:
1009 if lookup: 1011 if lookup:
1010 fixup = [] 1012 fixup = []
1011 # do a full compare of any files that might have changed 1013 # do a full compare of any files that might have changed