git-editlog 1.0.1__tar.gz

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.
@@ -0,0 +1,20 @@
1
+ Copyright (C) 2026 Katie Rust (katie@ktpanda.org)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ global-include *.typed
2
+ prune venv
3
+ prune dist
@@ -0,0 +1,22 @@
1
+ Metadata-Version: 2.4
2
+ Name: git-editlog
3
+ Version: 1.0.1
4
+ Summary: Auto commit edit log for Git
5
+ Home-page: https://ktpanda.org/software/git-editlog
6
+ Author: Katie Rust
7
+ Author-email: katie@ktpanda.org
8
+ License: MIT License
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.8
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: ktpanda-modules>=1.0.47
16
+ Requires-Dist: watchdog>=4.0.0; sys_platform != "linux"
17
+ Dynamic: license-file
18
+
19
+ git_editlog
20
+ ===========
21
+
22
+ Watches a repository for changes, and auto-commits to a branch called 'editlog'.
@@ -0,0 +1,4 @@
1
+ git_editlog
2
+ ===========
3
+
4
+ Watches a repository for changes, and auto-commits to a branch called 'editlog'.
@@ -0,0 +1,8 @@
1
+ VERSION = "1.0.1"
2
+
3
+ import sys
4
+
5
+ if sys.platform == 'linux':
6
+ from .pyinotify_watcher import RepoWatcher
7
+ else:
8
+ from .watchdog_watcher import RepoWatcher
@@ -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()