Mercurial > hg
comparison hgext/git/dirstate.py @ 45422:601e3658216d
git: make dirstate actually support listclean parameter
As far as I can tell listignored and listunknown should already
work. I'm vexed that there doesn't seem to be a way to get clean files
out of the pygit2 status method, but this at least makes things work
better.
Differential Revision: https://phab.mercurial-scm.org/D8998
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Mon, 07 Sep 2020 17:14:59 -0400 |
parents | 0c6b2cc9a7bb |
children | d4cf80341589 |
comparison
equal
deleted
inserted
replaced
45421:0c6b2cc9a7bb | 45422:601e3658216d |
---|---|
127 return _STATUS_MAP[gs] != b'?' | 127 return _STATUS_MAP[gs] != b'?' |
128 except KeyError: | 128 except KeyError: |
129 return False | 129 return False |
130 | 130 |
131 def status(self, match, subrepos, ignored, clean, unknown): | 131 def status(self, match, subrepos, ignored, clean, unknown): |
132 listignored, listclean, listunknown = ignored, clean, unknown | |
132 # TODO handling of clean files - can we get that from git.status()? | 133 # TODO handling of clean files - can we get that from git.status()? |
133 modified, added, removed, deleted, unknown, ignored, clean = ( | 134 modified, added, removed, deleted, unknown, ignored, clean = ( |
134 [], | 135 [], |
135 [], | 136 [], |
136 [], | 137 [], |
166 else: | 167 else: |
167 raise error.Abort( | 168 raise error.Abort( |
168 b'unhandled case: status for %r is %r' % (path, status) | 169 b'unhandled case: status for %r is %r' % (path, status) |
169 ) | 170 ) |
170 | 171 |
172 if listclean: | |
173 observed = set( | |
174 modified + added + removed + deleted + unknown + ignored | |
175 ) | |
176 index = self.git.index | |
177 index.read() | |
178 for entry in index: | |
179 path = pycompat.fsencode(entry.path) | |
180 if not match(path): | |
181 continue | |
182 if path in observed: | |
183 continue # already in some other set | |
184 if path[-1] == b'/': | |
185 continue # directory | |
186 clean.append(path) | |
187 | |
171 # TODO are we really always sure of status here? | 188 # TODO are we really always sure of status here? |
172 return ( | 189 return ( |
173 False, | 190 False, |
174 scmutil.status( | 191 scmutil.status( |
175 modified, added, removed, deleted, unknown, ignored, clean | 192 modified, added, removed, deleted, unknown, ignored, clean |