Patchwork [oebakery] clone: add argument to fetch specific branch in given repository

login
register
mail settings
Submitter Jacob Kjaergaard
Date Jan. 23, 2014, 1:02 p.m.
Message ID <1390482159-30942-1-git-send-email-jabk@prevas.dk>
Download mbox | patch
Permalink /patch/313606/
State New
Delegated to: Esben Haabendal
Headers show

Comments

Jacob Kjaergaard - Jan. 23, 2014, 1:02 p.m.
From: Jacob Kjaergaard <jacob.kjaergaard@prevas.dk>

---
 oebakery/cmd/clone.py |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch

diff --git a/oebakery/cmd/clone.py b/oebakery/cmd/clone.py
index 1cbaf24..5a09e81 100644
--- a/oebakery/cmd/clone.py
+++ b/oebakery/cmd/clone.py
@@ -21,6 +21,10 @@  def add_parser_options(parser):
     parser.add_option("--mirror",
                       action="store_true", default=False,
                       help="Create a mirror OE-lite repository")
+    parser.add_option("-b", "--branch", action='store', type=str,
+                      default='master',
+                      help="repository branch to checkout initially"
+                      " [default: %(default)s]")
     return
 
 
@@ -54,8 +58,8 @@  def run(options, args, config):
 
 
 def clone_checkout(options):
-    if not oebakery.call('git clone --recursive %s %s'%(
-            options.repository, options.directory)):
+    if not oebakery.call('git clone --recursive %s --branch %s %s'%(
+            options.repository, options.branch ,options.directory)):
         return "git clone failed"
 
     topdir = oebakery.set_topdir(options.directory)