summaryrefslogtreecommitdiff
path: root/prune_aliases.py
blob: 24c539211691dab7917399eb42abc273d8010612 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import patchstate as ps
import io, os, sys

def main(args):
    args = iter(args)
    arg0 = next(args)

    @ps.argparse_all(args)
    def path(arg):
        raise RuntimeError(f'Invalid argument: {arg!r}')

    [repo_path] = path

    repo = ps.Repository(repo_path)
    for h in repo.aliases:
        os.unlink(os.path.join(repo.path, f'{h}.patch'))

    return 0

if __name__ == '__main__':
    sys.exit(main(sys.argv))