diff options
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/project-ctags | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/project-ctags b/bin/project-ctags index 47b1fe5..373a712 100755 --- a/bin/project-ctags +++ b/bin/project-ctags @@ -180,9 +180,36 @@ def git_project_files(root): return files +def fossil_project_files(root): + """List managed and unignored files of a Fossil checkout.""" + fossil = shutil.which("fossil") + if fossil is None: + return None + files = [] + for command in (["ls"], ["extras"]): + result = subprocess.run( + [fossil, *command], + cwd=root, + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL, + check=False, + ) + if result.returncode != 0: + return None + for name in result.stdout.splitlines(): + if not name: + continue + path = root / os.fsdecode(name) + if path.is_file(): + files.append(path.resolve()) + return files + + def project_files(root, output): files = git_project_files(root) if files is None: + files = fossil_project_files(root) + if files is None: files = walk_files(root) return sorted(path for path in files if path != output) |
