-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd0d46f
commit 662a6c8
Showing
12 changed files
with
82 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from valhalla.main import start | ||
|
||
if __name__ == '__main__': | ||
start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
PyYAML~=6.0.1 | ||
PyYAML~=6.0.1 | ||
GitPython~=3.1.40 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from valhalla.main import start | ||
|
||
if __name__ == '__main__': | ||
start() |
Empty file.
Empty file.
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from git import Repo | ||
|
||
from valhalla.common.logger import info | ||
|
||
|
||
class GitRepository: | ||
def __init__(self): | ||
self.repository = Repo.init(".") | ||
|
||
def status(self): | ||
info("----------------------") | ||
info("Git status") | ||
|
||
untracked = self.repository.untracked_files | ||
for f in untracked: | ||
info(f"{f} is untracked") | ||
|
||
diffs = self.repository.index.diff(None) | ||
for d in diffs: | ||
info(f"{d.a_path} is modified") | ||
|
||
info("----------------------") | ||
|
||
def commit(self, msg: str, add=True): | ||
self.status() | ||
|
||
if add: | ||
if self.repository.is_dirty(): | ||
untracked = self.repository.untracked_files | ||
for f in untracked: | ||
self.repository.index.add(f) | ||
info(f"{f} added to stage") | ||
else: | ||
info(f"add={add}, skipping adding untracked files") | ||
|
||
self.repository.index.commit(msg) | ||
self.status() | ||
|
||
def push(self): | ||
origin = self.repository.remote('origin') | ||
origin.push() | ||
|
||
|
||
# if __name__ == '__main__': | ||
# git_repo = GitRepository() | ||
# git_repo.commit("testing commiting") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.