MCPcopy
hub / github.com/gitless-vcs/gitless / oei_fs

Function oei_fs

gitless/cli/helpers.py:168–194  ·  view source on GitHub ↗

Compute the final fileset per oei flags.

(args, repo)

Source from the content-addressed store, hash-verified

166
167
168def oei_fs(args, repo):
169 """Compute the final fileset per oei flags."""
170 only = frozenset(args.only if args.only else [])
171 exclude = frozenset(args.exclude if args.exclude else [])
172 include = frozenset(args.include if args.include else [])
173
174 curr_b = repo.current_branch
175 if not _oei_validate(only, exclude, include, curr_b):
176 raise ValueError('Invalid input')
177
178 if only:
179 ret = only
180 else:
181 # Tracked modified files
182 ret = frozenset(
183 f.fp for f in curr_b.status()
184 if f.type == core.GL_STATUS_TRACKED and f.modified) # using generator expression
185 # We get the files from status with forward slashes. On Windows, these
186 # won't match the paths provided by the user, which are normalized by
187 # PathProcessor
188 if sys.platform == 'win32':
189 ret = frozenset(p.replace('/', '\\') for p in ret)
190 ret -= exclude
191 ret |= include
192
193 ret = sorted(list(ret))
194 return ret
195
196
197def _oei_validate(only, exclude, include, curr_b):

Callers

nothing calls this directly

Calls 2

_oei_validateFunction · 0.85
statusMethod · 0.80

Tested by

no test coverage detected