From f9d8be4cf02188ea37a365ff321c6df502dc2f33 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Mon, 3 Sep 2012 16:25:56 +0800 Subject: [PATCH] Get correct information when creating instance --- lib/moodle.py | 2 ++ lib/workplace.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/moodle.py b/lib/moodle.py index 9886e39..1b038bc 100644 --- a/lib/moodle.py +++ b/lib/moodle.py @@ -265,6 +265,7 @@ class Moodle(object): return True # Extracts information from version.php + self.version = {} version = os.path.join(self.path, 'version.php') if os.path.isfile(version): @@ -309,6 +310,7 @@ class Moodle(object): raise Exception('This does not appear to be a Moodle instance') # Extracts parameters from config.php, does not handle params over multiple lines + self.config = {} config = os.path.join(self.path, 'config.php') if os.path.isfile(config): self.installed = True diff --git a/lib/workplace.py b/lib/workplace.py index 7531cfd..ebf3c56 100644 --- a/lib/workplace.py +++ b/lib/workplace.py @@ -121,21 +121,21 @@ class Workplace(object): # Creating, fetch, pulling branches debug('Checking out branch...') - M = self.get(name) - git = M.git() - result = git.fetch('origin') + repo = git.Git(wwwDir, C('git')) + result = repo.fetch('origin') if version == 'master': - git.checkout('master') + repo.checkout('master') else: track = 'origin/MOODLE_%s_STABLE' % version branch = 'MOODLE_%s_STABLE' % version - if not git.createBranch(branch, track): + if not repo.createBranch(branch, track): debug('Could not create branch %s tracking %s' % (branch, track)) else: - git.checkout(branch) - git.pull() - git.addRemote(C('myRemote'), C('remotes.mine')) + repo.checkout(branch) + repo.pull() + repo.addRemote(C('myRemote'), C('remotes.mine')) + M = self.get(name) return M def delete(self, name): -- 2.11.0