aboutsummaryrefslogtreecommitdiff
path: root/reposync.py
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-05-20 11:02:33 +0300
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-05-20 11:02:33 +0300
commitd0cf3b7f427f36e2e2915ce626b2d8783b9eb5a0 (patch)
treed0b2e52faf4e62c5a6de74d4a86df409dbe704eb /reposync.py
parente5d4df8a2855441363dbb9da66a759dba42fb3db (diff)
downloadRepoSync-d0cf3b7f427f36e2e2915ce626b2d8783b9eb5a0.tar
RepoSync-d0cf3b7f427f36e2e2915ce626b2d8783b9eb5a0.tar.gz
RepoSync-d0cf3b7f427f36e2e2915ce626b2d8783b9eb5a0.zip
Added initial logic
Diffstat (limited to 'reposync.py')
-rw-r--r--reposync.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/reposync.py b/reposync.py
new file mode 100644
index 0000000..c78e8ea
--- /dev/null
+++ b/reposync.py
@@ -0,0 +1,17 @@
+from git import Repo
+from datetime import datetime
+
+repo = Repo("./")
+if not repo.bare:
+ now = datetime.now().strftime("[%H:%M:%S] ")
+ branch = repo.active_branch
+
+ # Thanks to https://stackoverflow.com/a/65535263/12036073
+ if list(repo.iter_commits(f'{branch}..{branch}@{{u}}')):
+ print(now + "Remote changes detected, pulling...")
+ # logic
+ else:
+ print(now + "Up to date")
+
+else:
+ print("Error")