git-editlog 1.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- git_editlog/__init__.py +8 -0
- git_editlog/__main__.py +66 -0
- git_editlog/pyinotify.py +2336 -0
- git_editlog/pyinotify_watcher.py +127 -0
- git_editlog/repo_watcher.py +247 -0
- git_editlog/watchdog_watcher.py +61 -0
- git_editlog-1.0.1.dist-info/METADATA +22 -0
- git_editlog-1.0.1.dist-info/RECORD +12 -0
- git_editlog-1.0.1.dist-info/WHEEL +5 -0
- git_editlog-1.0.1.dist-info/entry_points.txt +2 -0
- git_editlog-1.0.1.dist-info/licenses/LICENSE +20 -0
- git_editlog-1.0.1.dist-info/top_level.txt +1 -0
git_editlog/__init__.py
ADDED
git_editlog/__main__.py
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import re
|
|
3
|
+
import time
|
|
4
|
+
import os
|
|
5
|
+
import argparse
|
|
6
|
+
import subprocess
|
|
7
|
+
import traceback
|
|
8
|
+
import copy
|
|
9
|
+
import logging
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
from ktpanda import git_helper
|
|
13
|
+
|
|
14
|
+
from . import RepoWatcher
|
|
15
|
+
|
|
16
|
+
def setup_python_logging(verbose=False):
|
|
17
|
+
root = logging.getLogger()
|
|
18
|
+
root.setLevel(logging.DEBUG if verbose else logging.INFO)
|
|
19
|
+
|
|
20
|
+
log_formatter = logging.Formatter('%(asctime)s %(levelname)s: [%(name)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
|
|
21
|
+
console_handler = logging.StreamHandler(sys.stdout)
|
|
22
|
+
console_handler.setFormatter(log_formatter)
|
|
23
|
+
root.addHandler(console_handler)
|
|
24
|
+
|
|
25
|
+
def main():
|
|
26
|
+
p = argparse.ArgumentParser(description='')
|
|
27
|
+
p.add_argument('repos', type=Path, nargs='*')
|
|
28
|
+
p.add_argument('-l', '--repo-list', type=Path)
|
|
29
|
+
p.add_argument('-v', '--verbose', action='store_true', help='')
|
|
30
|
+
#p.add_argument(help='')
|
|
31
|
+
args = p.parse_args()
|
|
32
|
+
|
|
33
|
+
setup_python_logging(args.verbose)
|
|
34
|
+
|
|
35
|
+
repo_paths = []
|
|
36
|
+
repo_watchers = []
|
|
37
|
+
for path in args.repos:
|
|
38
|
+
repo_paths.append(path)
|
|
39
|
+
|
|
40
|
+
if args.repo_list:
|
|
41
|
+
base = args.repo_list.parent
|
|
42
|
+
with args.repo_list.open() as fp:
|
|
43
|
+
for line in fp:
|
|
44
|
+
line = line.strip()
|
|
45
|
+
if not line or line.startswith('#'):
|
|
46
|
+
continue
|
|
47
|
+
|
|
48
|
+
path = (base / line).absolute()
|
|
49
|
+
repo_paths.append(path)
|
|
50
|
+
|
|
51
|
+
for path in repo_paths:
|
|
52
|
+
try:
|
|
53
|
+
print(f'Initialzing watcher for {path} ...')
|
|
54
|
+
repo_watchers.append(RepoWatcher(path))
|
|
55
|
+
except Exception:
|
|
56
|
+
print(f'Error initializing watcher for {path}', file=sys.stderr)
|
|
57
|
+
traceback.print_exc()
|
|
58
|
+
|
|
59
|
+
if not repo_watchers:
|
|
60
|
+
print('No repositories defined', file=sys.stderr)
|
|
61
|
+
return
|
|
62
|
+
|
|
63
|
+
RepoWatcher.run(repo_watchers)
|
|
64
|
+
|
|
65
|
+
if __name__ == '__main__':
|
|
66
|
+
main()
|