Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/devbot/git.py
diff options
context:
space:
mode:
Diffstat (limited to 'devbot/git.py')
-rw-r--r--devbot/git.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/devbot/git.py b/devbot/git.py
index e39993a..f1a7acc 100644
--- a/devbot/git.py
+++ b/devbot/git.py
@@ -3,7 +3,11 @@ import os
from devbot import command
class Module:
- def __init__(self, path, name, remote, branch="master", tag=None):
+ def __init__(self, path=None, name=None, remote=None,
+ branch="master", tag=None, retry=10):
+ if path is None or name is None or remote is None:
+ raise RuntimeError("path, name and remote are required")
+
self.remote = remote
self.local = os.path.join(path, name)
self.tag = tag
@@ -11,13 +15,13 @@ class Module:
self._path = path
self._name = name
self._branch = branch
+ self._retry = 10
def _clone(self):
os.chdir(self._path)
- command.run(["git", "clone", "--progress",
- self.remote, self._name],
- retry=10)
+ command.run(["git", "clone", "--progress", self.remote, self._name],
+ retry=self._retry)
os.chdir(self.local)
@@ -30,12 +34,13 @@ class Module:
os.chdir(self.local)
- command.run(["git", "fetch"])
+ command.run(["git", "fetch"], retry=self._retry)
if self.tag:
command.run(["git", "checkout", self.tag])
else:
- command.run(["git", "merge", "--ff-only", "origin", self._branch])
+ command.run(["git", "merge", "--ff-only", "origin", self._branch],
+ retry=self._retry)
def clean(self):
try: