Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2013-01-05 12:36:32 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2013-01-05 12:36:32 (GMT)
commit8d761e4130891324d6e522354e8e477acd998b0a (patch)
tree1fc892bfea9d0c35d21dddcfd5e39dec64378a29
parent3e36ee3ae1d63b0f8079349e6a13eb6b37f3e6d5 (diff)
Allow to specify revisions when pullin
-rwxr-xr-xcommands/pull7
-rw-r--r--devbot/build.py9
-rw-r--r--devbot/git.py6
3 files changed, 15 insertions, 7 deletions
diff --git a/commands/pull b/commands/pull
index 4e3ca8f..34f757c 100755
--- a/commands/pull
+++ b/commands/pull
@@ -9,6 +9,7 @@ from devbot import build
parser = argparse.ArgumentParser()
parser.add_argument("module", nargs="?", help="name of the module to pull")
+parser.add_argument("--revisions", help="json dict with the revisions to pull")
args = parser.parse_args()
common.setup(log_name="pull")
@@ -17,5 +18,9 @@ if args.module:
if not build.pull_one(args.module):
sys.exit(1)
else:
- if not build.pull():
+ revisions = {}
+ if args.revisions:
+ revisions = json.loads(args.revisions)
+
+ if not build.pull(revisions):
sys.exit(1)
diff --git a/devbot/build.py b/devbot/build.py
index ba9adc8..1f486ca 100644
--- a/devbot/build.py
+++ b/devbot/build.py
@@ -33,7 +33,7 @@ def pull_one(module_name):
return False
-def pull(lazy=False):
+def pull(revisions={}, lazy=False):
to_pull = []
for module in config.load_modules():
git_module = git.get_module(module)
@@ -44,7 +44,8 @@ def pull(lazy=False):
print "\n= Pulling =\n"
for module in to_pull:
- if not _pull_module(module):
+ revision = revisions.get(module.name, None)
+ if not _pull_module(module, revision):
return False
return True
@@ -111,13 +112,13 @@ def _unlink_libtool_files():
os.path.walk(config.lib_dir, func, None)
-def _pull_module(module):
+def _pull_module(module, revision=None):
print "* Pulling %s" % module.name
git_module = git.get_module(module)
try:
- git_module.update()
+ git_module.update(revision)
except subprocess.CalledProcessError:
return False
diff --git a/devbot/git.py b/devbot/git.py
index cb361ef..960fd7c 100644
--- a/devbot/git.py
+++ b/devbot/git.py
@@ -46,7 +46,7 @@ class Module:
else:
command.run(["git", "checkout", self._branch])
- def update(self):
+ def update(self, revision=None):
if not os.path.exists(os.path.join(self.local, ".git")):
self._clone()
return
@@ -55,7 +55,9 @@ class Module:
command.run(["git", "fetch"], retry=self._retry)
- if self.tag:
+ if revision:
+ command.run(["git", "checkout", revision])
+ elif self.tag:
command.run(["git", "checkout", self.tag])
else:
command.run(["git", "merge", "--ff-only",