-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdo_commit.py
More file actions
73 lines (60 loc) · 2.43 KB
/
do_commit.py
File metadata and controls
73 lines (60 loc) · 2.43 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import subprocess
import sys
import os
os.chdir(r'E:\DL FInal')
print("=" * 80)
print("COMMITTING AND PUSHING: Image Captioning with Deep Learning")
print("=" * 80)
# Add all files
print("\n[1/3] Adding all files to git...")
result = subprocess.run(["git", "add", "."], capture_output=True, text=True)
if result.returncode == 0:
print("✓ Files added successfully")
else:
print("Error:", result.stderr)
sys.exit(1)
# Commit with the specified message
print("\n[2/3] Committing changes...")
commit_message = """Image Captioning with Deep Learning
- Complete implementation of image captioning using VGG16 and LSTM
- Added comprehensive README with problem statement and model explanation
- Included Flickr8k dataset link: https://www.kaggle.com/datasets/adityajn105/flickr8k/data
- Full documentation of architecture, workflow, and setup instructions
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>"""
result = subprocess.run(["git", "commit", "-m", commit_message], capture_output=True, text=True)
print(result.stdout)
if result.stderr:
print(result.stderr)
if "nothing to commit" in result.stdout or "nothing to commit" in result.stderr:
print("\n✓ No new changes to commit (everything already committed)")
elif result.returncode != 0:
print("Note: Commit may have already been made")
# Push to GitHub
print("\n[3/3] Pushing to GitHub...")
result = subprocess.run(["git", "push"], capture_output=True, text=True)
if result.returncode == 0:
print("✓ Successfully pushed to GitHub!")
print(result.stdout)
if result.stderr:
print(result.stderr)
else:
# Try to set upstream if needed
print("Attempting to set upstream branch...")
result = subprocess.run(["git", "branch", "--show-current"], capture_output=True, text=True)
branch = result.stdout.strip()
print(f"Current branch: {branch}")
result = subprocess.run(["git", "push", "-u", "origin", branch], capture_output=True, text=True)
if result.returncode == 0:
print(f"✓ Successfully pushed to origin/{branch}!")
print(result.stdout)
if result.stderr:
print(result.stderr)
else:
print("❌ Error pushing:")
print(result.stderr)
sys.exit(1)
print("\n" + "=" * 80)
print("✓ SUCCESS! All changes committed and pushed to GitHub")
print("=" * 80)
print("\nRepository: Image Captioning with Deep Learning")
print("Dataset: Flickr8k (link included in README.md)")