112 lines
3.7 KiB
Python
112 lines
3.7 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Simple auto-commit script for railseek6 repository.
|
|
This script provides instructions for manual git operations.
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
from datetime import datetime
|
|
|
|
def print_instructions(description):
|
|
"""Print git commands for manual execution"""
|
|
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
|
|
print("=" * 60)
|
|
print("AUTO-COMMIT INSTRUCTIONS")
|
|
print("=" * 60)
|
|
print(f"Description: {description}")
|
|
print(f"Timestamp: {timestamp}")
|
|
print(f"Repository: https://git.mtrcompute.com/jleu3482/railseek6")
|
|
print()
|
|
|
|
# Git commands to run manually
|
|
commands = [
|
|
"# Navigate to project directory",
|
|
"cd C:\\aaWORK\\railseek6",
|
|
"",
|
|
"# Stage all changes",
|
|
"git add .",
|
|
"",
|
|
"# Commit with message",
|
|
f'git commit -m "{description}\\n\\nAuto-commit at: {timestamp}"',
|
|
"",
|
|
"# Push to remote",
|
|
"git push origin main",
|
|
"",
|
|
"# If main branch doesn't exist, try:",
|
|
"git push origin master",
|
|
]
|
|
|
|
print("Run these commands manually in PowerShell or Command Prompt:")
|
|
print()
|
|
for cmd in commands:
|
|
if cmd.startswith("#"):
|
|
print(f"\033[90m{cmd}\033[0m") # Gray color for comments
|
|
else:
|
|
print(f"\033[92m{cmd}\033[0m") # Green color for commands
|
|
|
|
print()
|
|
print("=" * 60)
|
|
print("ALTERNATIVE: Use VS Code Git Integration")
|
|
print("=" * 60)
|
|
print("1. Open VS Code with C:\\aaWORK\\railseek6 folder")
|
|
print("2. Go to Source Control panel (Ctrl+Shift+G)")
|
|
print("3. Stage changes by clicking '+'")
|
|
print(f"4. Commit with message: \"{description}\"")
|
|
print("5. Click 'Sync Changes' or 'Push' button")
|
|
|
|
# Save commands to file for easy copy-paste
|
|
commands_file = "git_commands.bat"
|
|
with open(commands_file, "w", encoding='utf-8') as f:
|
|
f.write("@echo off\n")
|
|
f.write("cd /d C:\\aaWORK\\railseek6\n")
|
|
f.write("git add .\n")
|
|
f.write(f'git commit -m "{description} - Auto-commit at: {timestamp}"\n')
|
|
f.write("git push origin main\n")
|
|
f.write("if errorlevel 1 git push origin master\n")
|
|
f.write("pause\n")
|
|
|
|
print()
|
|
print(f"✓ Commands saved to: {commands_file}")
|
|
print(f" Double-click {commands_file} to run (requires Git in PATH)")
|
|
|
|
return True
|
|
|
|
def check_git_available():
|
|
"""Check if git is available in PATH"""
|
|
import subprocess
|
|
try:
|
|
result = subprocess.run(["git", "--version"], capture_output=True, text=True)
|
|
return result.returncode == 0
|
|
except:
|
|
return False
|
|
|
|
if __name__ == "__main__":
|
|
if len(sys.argv) < 2:
|
|
print("Usage: python simple_auto_commit.py \"Description of changes\"")
|
|
print("Example: python simple_auto_commit.py \"Added document download endpoint\"")
|
|
sys.exit(1)
|
|
|
|
description = sys.argv[1]
|
|
|
|
# Check if git is available
|
|
if check_git_available():
|
|
print("✓ Git is available in PATH")
|
|
print("You can run the commands manually or use the generated batch file.")
|
|
else:
|
|
print("⚠ Git is not available in PATH")
|
|
print("You need to:")
|
|
print("1. Install Git for Windows: https://git-scm.com/download/win")
|
|
print("2. Or use VS Code Git integration")
|
|
print("3. Or run commands manually using the Gitea git.exe (may have issues)")
|
|
|
|
print_instructions(description)
|
|
|
|
print()
|
|
print("=" * 60)
|
|
print("NEXT STEPS:")
|
|
print("1. Run the git commands above (or use the batch file)")
|
|
print("2. Verify at: https://git.mtrcompute.com/jleu3482/railseek6")
|
|
print("3. Restart LightRAG server to test download endpoint")
|
|
print("=" * 60) |