diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2020-07-19 22:06:00 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2020-07-19 22:06:00 -0300 |
commit | 6e3ac343e67adea503afef98651ea134526e0453 (patch) | |
tree | 9fd18256eb2cfbd00e5657a8296077236f3821b7 /ganarchy/git.py | |
parent | af3fb6c6eb233af00229a908bab92afbf38bad0b (diff) |
Partially restore cron-target functionality
Restored functionality: - Can use `config`, `project-list` and `index` targets Still broken: - `cron-target` with a project doesn't work yet
Diffstat (limited to 'ganarchy/git.py')
-rw-r--r-- | ganarchy/git.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ganarchy/git.py b/ganarchy/git.py index 25be04a..a658022 100644 --- a/ganarchy/git.py +++ b/ganarchy/git.py @@ -34,6 +34,14 @@ class Git: self.path = path self.base = ("git", "-C", path) + def create(self): + """Creates the local repo. + + Can safely be called on an existing repo. + """ + subprocess.call(self.base + ("init", "-q")) + + def check_history(self, local_head, commit): """Checks if the local head contains commit in its history. Raises if it doesn't. @@ -69,7 +77,7 @@ class Git: """ try: subprocess.check_output( - base + ("fetch", "-q", url, "+" + remote_head + ":" + local_head), + self.base + ("fetch", "-q", url, "+" + remote_head + ":" + local_head), stderr=subprocess.STDOUT ) except subprocess.CalledProcessError as e: @@ -89,7 +97,7 @@ class Git: """ try: res = subprocess.check_output( - base + ("rev-list", "--count", first_hash + ".." + last_hash, "--"), + self.base + ("rev-list", "--count", first_hash + ".." + last_hash, "--"), stderr=subprocess.DEVNULL ).decode("utf-8").strip() return int(res) |