buildman: Allow selection of the number of commits to build
authorSimon Glass <sjg@chromium.org>
Sat, 9 Aug 2014 21:33:09 +0000 (15:33 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 13 Aug 2014 14:34:16 +0000 (08:34 -0600)
It is useful to be able to build only some of the commits in a branch. Add
support for the -c option to allow this. It was previously parsed by
buildman but not implemented.

Suggested-by: York Sun <yorksun@freescale.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: York Sun <yorksun@freescale.com>
tools/buildman/control.py

index 0c9e2cbfee5771487468527a1a7a0ae7ec03c560..98a07a29e7e218365e1314801e4fecc91838ee3a 100644 (file)
@@ -144,18 +144,25 @@ def DoBuildman(options, args):
     # a merge commit (it will list all the commits that form part of the
     # merge)
     if options.branch:
-        range_expr = gitutil.GetRangeInBranch(options.git_dir, options.branch)
-        upstream_commit = gitutil.GetUpstream(options.git_dir, options.branch)
-        series = patchstream.GetMetaDataForList(upstream_commit,
-            options.git_dir, 1)
-
-        # Conflicting tags are not a problem for buildman, since it does not
-        # use them. For example, Series-version is not useful for buildman. On
-        # the other hand conflicting tags will cause an error. So allow later
-        # tags to overwrite earlier ones.
-        series.allow_overwrite = True
-        series = patchstream.GetMetaDataForList(range_expr, options.git_dir, None,
-                series)
+        if count == -1:
+            range_expr = gitutil.GetRangeInBranch(options.git_dir,
+                                                  options.branch)
+            upstream_commit = gitutil.GetUpstream(options.git_dir,
+                                                  options.branch)
+            series = patchstream.GetMetaDataForList(upstream_commit,
+                options.git_dir, 1)
+
+            # Conflicting tags are not a problem for buildman, since it does
+            # not use them. For example, Series-version is not useful for
+            # buildman. On the other hand conflicting tags will cause an
+            # error. So allow later tags to overwrite earlier ones.
+            series.allow_overwrite = True
+            series = patchstream.GetMetaDataForList(range_expr,
+                                              options.git_dir, None, series)
+        else:
+            # Honour the count
+            series = patchstream.GetMetaDataForList(options.branch,
+                                                    options.git_dir, count)
     else:
         series = None
         options.verbose = True