aboutsummaryrefslogtreecommitdiff
path: root/grs
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2015-07-14 19:32:05 -0400
committerAnthony G. Basile <blueness@gentoo.org>2015-07-14 19:32:05 -0400
commita2f107d19503a8ffca9de85c9e74ff59d21cadf6 (patch)
treea86d9f4882546ed19c9b13bce63c86da6c98d84e /grs
parentgrs/Seed.py: add documentation. (diff)
downloadgrss-a2f107d19503a8ffca9de85c9e74ff59d21cadf6.tar.gz
grss-a2f107d19503a8ffca9de85c9e74ff59d21cadf6.tar.bz2
grss-a2f107d19503a8ffca9de85c9e74ff59d21cadf6.zip
grs/Synchronize.py: add documentation.
Diffstat (limited to 'grs')
-rw-r--r--grs/Synchronize.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/grs/Synchronize.py b/grs/Synchronize.py
index 1df8ce2..ed8209c 100644
--- a/grs/Synchronize.py
+++ b/grs/Synchronize.py
@@ -5,9 +5,7 @@ from grs.Constants import CONST
from grs.Execute import Execute
class Synchronize():
- """ doc here
- more doc
- """
+ """ Either clone or pull a remote git repository for a GRS system. """
def __init__(self, remote_repo, branch, libdir = CONST.LIBDIR, logfile = CONST.LOGFILE):
self.remote_repo = remote_repo
@@ -17,21 +15,23 @@ class Synchronize():
def sync(self):
if self.isgitdir():
+ # If the local repo exists, then make it pristine an pull
cmd = 'git -C %s reset HEAD --hard' % self.local_repo
Execute(cmd, timeout=60, logfile=self.logfile)
cmd = 'git -C %s clean -f -x -d' % self.local_repo
Execute(cmd, timeout=60, logfile=self.logfile)
cmd = 'git -C %s pull' % self.local_repo
Execute(cmd, timeout=60, logfile=self.logfile)
- cmd = 'git -C %s checkout %s' % (self.local_repo, self.branch)
- Execute(cmd, timeout=60, logfile=self.logfile)
else:
+ # else clone afresh.
cmd = 'git clone %s %s' % (self.remote_repo, self.local_repo)
Execute(cmd, timeout=60, logfile=self.logfile)
- cmd = 'git -C %s checkout %s' % (self.local_repo, self.branch)
- Execute(cmd, timeout=60, logfile=self.logfile)
+ # Make sure we're on the correct branch for the desired GRS system.
+ cmd = 'git -C %s checkout %s' % (self.local_repo, self.branch)
+ Execute(cmd, timeout=60, logfile=self.logfile)
def isgitdir(self):
+ """ If there is a .git/config file, assume its a local git repository. """
git_configdir = os.path.join(self.local_repo, '.git')
git_configfile = os.path.join(git_configdir, 'config')
return os.path.isdir(git_configdir) and os.path.isfile(git_configfile)