acturtle / cashflower

An open-source Python framework for actuarial cash flow models
https://cashflower.acturtle.com
MIT License
38 stars 9 forks source link

Git commit in case of local changes #318

Closed zchmielewska closed 11 months ago

zchmielewska commented 11 months ago

Currently, there is a git commit in the log. But what should be the approach if the user does local changes? Should the git commit stay the same or should there be additional information about the local changes?

zchmielewska commented 11 months ago
import subprocess

# Define the Git command to check for local changes
git_status_command = "git status --porcelain"

# Run the Git command
result = subprocess.run(git_status_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)

if result.returncode == 0:
    if result.stdout:
        print("There are local changes.")
    else:
        print("No local changes.")
else:
    print("Error running Git command.")
zchmielewska commented 11 months ago

Now it will be like this in the log in case of local changes:

Git commit: 9e1fbc7bdc00e9dce724406d987947fec0cb127d (with local changes)

Implemented in: 76061ec23309c46aa30b3e0a413e39562693c453