-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsvnci.py
More file actions
executable file
·40 lines (34 loc) · 1014 Bytes
/
Copy pathsvnci.py
File metadata and controls
executable file
·40 lines (34 loc) · 1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
"""
File: svnci.py
Author: Leon McClatchey
Date: 2025-11-24
"""
# --- System Library Imports ---
import subprocess
import sys
def run(cmd):
"""Run a shell command and return (exit_code, output)."""
try:
result = subprocess.run(cmd, check=False, capture_output=True, text=True)
return result.returncode, result.stdout + result.stderr
except Exception as e:
return 1, str(e)
def main():
if len(sys.argv) < 2:
print("Usage: svnci.py -m \"commit message\" [other svn commit args]")
sys.exit(1)
# Step 1: Update before commit
print("Running svn update...")
code, output = run(["svn", "update"])
print(output)
if code != 0:
print("svn update failed. Aborting commit.")
sys.exit(code)
# Step 2: Commit with provided arguments
print("Running svn commit...")
code, output = run(["svn", "commit"] + sys.argv[1:])
print(output)
sys.exit(code)
if __name__ == "__main__":
main()