##// END OF EJS Templates
repo.status: eliminate list_
Matt Mackall -
r6753:ed5ffb2c default
parent child Browse files
Show More
@@ -47,13 +47,12 b' def reposetup(ui, repo):'
47 # to recurse.
47 # to recurse.
48 inotifyserver = False
48 inotifyserver = False
49
49
50 def status(self, match, list_ignored, list_clean,
50 def status(self, match, ignored, clean, unknown=True):
51 list_unknown=True):
52 files = match.files()
51 files = match.files()
53 try:
52 try:
54 if not list_ignored and not self.inotifyserver:
53 if not ignored and not self.inotifyserver:
55 result = client.query(ui, repo, files, match, False,
54 result = client.query(ui, repo, files, match, False,
56 list_clean, list_unknown)
55 clean, unknown)
57 if result is not None:
56 if result is not None:
58 return result
57 return result
59 except socket.error, err:
58 except socket.error, err:
@@ -82,15 +81,14 b' def reposetup(ui, repo):'
82 if query:
81 if query:
83 try:
82 try:
84 return query(ui, repo, files or [], match,
83 return query(ui, repo, files or [], match,
85 list_ignored, list_clean, list_unknown)
84 ignored, clean, unknown)
86 except socket.error, err:
85 except socket.error, err:
87 ui.warn(_('could not talk to new inotify '
86 ui.warn(_('could not talk to new inotify '
88 'server: %s\n') % err[1])
87 'server: %s\n') % err[1])
89 ui.print_exc()
88 ui.print_exc()
90
89
91 return super(inotifydirstate, self).status(
90 return super(inotifydirstate, self).status(
92 match, list_ignored, list_clean,
91 match, ignored, clean, unknown)
93 list_unknown)
94
92
95 repo.dirstate.__class__ = inotifydirstate
93 repo.dirstate.__class__ = inotifydirstate
96
94
@@ -11,7 +11,7 b' from mercurial import ui'
11 import common
11 import common
12 import os, select, socket, stat, struct, sys
12 import os, select, socket, stat, struct, sys
13
13
14 def query(ui, repo, names, match, list_ignored, list_clean, list_unknown=True):
14 def query(ui, repo, names, match, ignored, clean, unknown=True):
15 sock = socket.socket(socket.AF_UNIX)
15 sock = socket.socket(socket.AF_UNIX)
16 sockpath = repo.join('inotify.sock')
16 sockpath = repo.join('inotify.sock')
17 sock.connect(sockpath)
17 sock.connect(sockpath)
@@ -20,10 +20,10 b' def query(ui, repo, names, match, list_i'
20 for n in names or []:
20 for n in names or []:
21 yield n
21 yield n
22 states = 'almrx!'
22 states = 'almrx!'
23 if list_ignored:
23 if ignored:
24 raise ValueError('this is insanity')
24 raise ValueError('this is insanity')
25 if list_clean: states += 'n'
25 if clean: states += 'n'
26 if list_unknown: states += '?'
26 if unknown: states += '?'
27 yield states
27 yield states
28
28
29 req = '\0'.join(genquery())
29 req = '\0'.join(genquery())
@@ -258,7 +258,7 b' def _status(ui, repo, kwt, *pats, **opts'
258 Returns status of working directory.'''
258 Returns status of working directory.'''
259 if kwt:
259 if kwt:
260 matcher = cmdutil.match(repo, pats, opts)
260 matcher = cmdutil.match(repo, pats, opts)
261 return repo.status(match=matcher, list_clean=True)
261 return repo.status(match=matcher, clean=True)
262 if ui.configitems('keyword'):
262 if ui.configitems('keyword'):
263 raise util.Abort(_('[keyword] patterns cannot match'))
263 raise util.Abort(_('[keyword] patterns cannot match'))
264 raise util.Abort(_('no [keyword] patterns configured'))
264 raise util.Abort(_('no [keyword] patterns configured'))
@@ -629,7 +629,9 b' class dirstate(object):'
629 if imatch(k):
629 if imatch(k):
630 yield 'm', k, None
630 yield 'm', k, None
631
631
632 def status(self, match, list_ignored, list_clean, list_unknown):
632 def status(self, match, ignored, clean, unknown):
633 listignored, listclean, listunknown = ignored, clean, unknown
634
633 lookup, modified, added, unknown, ignored = [], [], [], [], []
635 lookup, modified, added, unknown, ignored = [], [], [], [], []
634 removed, deleted, clean = [], [], []
636 removed, deleted, clean = [], [], []
635
637
@@ -646,13 +648,12 b' class dirstate(object):'
646 dadd = deleted.append
648 dadd = deleted.append
647 cadd = clean.append
649 cadd = clean.append
648
650
649 for src, fn, st in self.statwalk(match, unknown=list_unknown,
651 for src, fn, st in self.statwalk(match, listunknown, listignored):
650 ignored=list_ignored):
651 if fn not in dmap:
652 if fn not in dmap:
652 if (list_ignored or match.exact(fn)) and self._dirignore(fn):
653 if (listignored or match.exact(fn)) and self._dirignore(fn):
653 if list_ignored:
654 if listignored:
654 iadd(fn)
655 iadd(fn)
655 elif list_unknown:
656 elif listunknown:
656 uadd(fn)
657 uadd(fn)
657 continue
658 continue
658
659
@@ -685,7 +686,7 b' class dirstate(object):'
685 madd(fn)
686 madd(fn)
686 elif time != int(st.st_mtime):
687 elif time != int(st.st_mtime):
687 ladd(fn)
688 ladd(fn)
688 elif list_clean:
689 elif listclean:
689 cadd(fn)
690 cadd(fn)
690 elif state == 'm':
691 elif state == 'm':
691 madd(fn)
692 madd(fn)
@@ -972,7 +972,7 b' class localrepository(repo.repository):'
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.
@@ -994,6 +994,7 b' class localrepository(repo.repository):'
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
@@ -1010,8 +1011,8 b' class localrepository(repo.repository):'
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:
@@ -1025,7 +1026,7 b' class localrepository(repo.repository):'
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
@@ -1073,7 +1074,7 b' class localrepository(repo.repository):'
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:
General Comments 0
You need to be logged in to leave comments. Login now