Clean up the git module.

This commit is contained in:
Chris Johns 2013-04-16 17:41:31 +10:00
parent 200f0a33b6
commit b0c2756190

View File

@ -66,26 +66,18 @@ class repo:
return (int(vs[0]), int(vs[1]), int(vs[2]), int(vs[3])) return (int(vs[0]), int(vs[1]), int(vs[2]), int(vs[3]))
def clone(self, url, path): def clone(self, url, path):
ec, output = self._run(['clone', url, path]) ec, output = self._run(['clone', url, path], check = True)
if ec != 0:
raise error.general('clone of %s failed: %s' % (url, output))
def fetch(self, url, path): def fetch(self):
ec, output = self._run(['fetch', url]) ec, output = self._run(['fetch'], check = True)
if ec != 0:
raise error.general('fetch of %s failed: %s' % (url, output))
def pull(self): def pull(self):
ec, output = self._run(['pull']) ec, output = self._run(['pull'], check = True)
if ec != 0:
raise error.general('pull of %s failed: %s' % (url, output))
def reset(self, args): def reset(self, args):
if type(args) == str: if type(args) == str:
args = [args] args = [args]
ec, output = self._run(['reset'] + args) ec, output = self._run(['reset'] + args, check = True)
if ec != 0:
raise error.general('pull of %s failed: %s' % (url, output))
def branch(self): def branch(self):
ec, output = self._run(['branch']) ec, output = self._run(['branch'])
@ -96,8 +88,7 @@ class repo:
return None return None
def checkout(self, branch = 'master'): def checkout(self, branch = 'master'):
ec, output = self._run(['checkout', branch]) ec, output = self._run(['checkout', branch], check = True)
return ec == 0
def status(self): def status(self):
_status = {} _status = {}