Skip to content
Snippets Groups Projects
Commit a5102f3a authored by Simon Sebastian Humpohl's avatar Simon Sebastian Humpohl
Browse files

Some good changes

parent 2ce50009
No related branches found
No related tags found
1 merge request!113First draft for auto commit helper
......@@ -4,10 +4,11 @@ Created on Mon Aug 14 18:36:43 2023
@author: Simon Humpohl
"""
from typing import Set, Dict
from dataclasses import dataclass
from pathlib import Path
import logging
import tkinter
import tkinter.messagebox
from subprocess import check_output, check_call
try:
......@@ -27,7 +28,7 @@ class SimpleRepo:
def get_status(self) -> str:
"""Returns modified/untracked files and submodules"""
check_output(['git', 'status', '--short'], cwd=self.repo_path)
return check_output(['git', 'status', '--short'], cwd=self.repo_path).decode("utf8")
def add_all(self):
check_call(['git', 'add', '--all'], cwd=self.repo_path)
......@@ -43,8 +44,9 @@ class SimpleRepo:
folders.append(SimpleRepo(Path(folder).absolute()))
return folders
def current_hash(self):
raise NotImplementedError('todo')
def get_current_hash(self) -> bytes:
hash_base64, = check_output(['git', 'rev-parse', 'HEAD'], cwd=self.repo_path).splitlines()
return hash_base64
def auto_commit(repo: SimpleRepo):
......@@ -66,9 +68,11 @@ def manual_commit(repo: SimpleRepo, name: str):
raise KeyboardInterrupt(name)
@dataclass
class GitRules:
auto_commit: set
auto_push: dict
ignore: Set[Path]
auto_commit: Set[Path]
auto_push: Mapping[Path, str]
def process(self, repo: SimpleRepo):
if not repo.get_status():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment