Skip to content

Commit

Permalink
i thought im in an another branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mostypc123 authored Dec 16, 2024
1 parent 642329a commit 83aa474
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/git_integration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import wx
import subprocess
import main

def commit():
try:
# Create text entry dialog to get commit message
with wx.TextEntryDialog(None, "Enter Commit Message", "Git Commit") as msg_dialog:
if msg_dialog.ShowModal() == wx.ID_OK:
msg = msg_dialog.GetValue().strip()

# Validate commit message
if not msg:
wx.MessageBox("Commit message cannot be empty", "Error", wx.OK | wx.ICON_ERROR)
return

try:
# Use subprocess for safer command execution
subprocess.run(['git', 'add', '.'], check=True)
subprocess.run(['git', 'commit', '-m', msg], check=True)
wx.MessageBox("Commit successful!", "Success", wx.OK | wx.ICON_INFORMATION)

except subprocess.CalledProcessError as e:
wx.MessageBox(f"Git commit failed: {e}", "Error", wx.OK | wx.ICON_ERROR)

except Exception as e:
wx.MessageBox(f"An error occurred: {e}", "Error", wx.OK | wx.ICON_ERROR)

0 comments on commit 83aa474

Please sign in to comment.