Compute the final fileset per oei flags.
(args, repo)
| 166 | |
| 167 | |
| 168 | def 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 | |
| 197 | def _oei_validate(only, exclude, include, curr_b): |
nothing calls this directly
no test coverage detected