From 841db8edf6b92bdf302b744fbcc62fa9ec5f3701 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Fri, 27 Sep 2013 11:53:52 +0300 Subject: [PATCH] bootstrap: return to current branch Signed-off-by: Markus Lehtonen --- bootstrap.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bootstrap.py b/bootstrap.py index 5e42d7d..1a2a324 100755 --- a/bootstrap.py +++ b/bootstrap.py @@ -185,6 +185,14 @@ def main(argv=None): LOG.setLevel(logging.DEBUG) outdatadir = tempfile.mkdtemp(prefix='gbp_unittest_outdata_') + + # Get current branch / revision + try: + _cur_ref = git_cmd('symbolic-ref', ['HEAD'], True)[0].strip() + orig_rev = _cur_ref.replace('refs/heads/', '') + except GitError: + orig_rev = git_cmd('rev-parse', ['HEAD'], True)[0].strip() + try: if args.update_branches != 'no': force = True if args.update_branches == 'force' else False @@ -197,7 +205,7 @@ def main(argv=None): if not args.no_build: for branch in pkgconf['build_branches']: build_test_pkg(pkg, branch, outdatadir, args.silent_build) - git_cmd('checkout', ['master']) + git_cmd('checkout', [orig_rev]) # Copy all data test_manifest.write('test-repo-manifest.xml') @@ -218,7 +226,7 @@ def main(argv=None): LOG.info('Sparing temporary directory: %s' % outdatadir) else: shutil.rmtree(outdatadir) - git_cmd('checkout', ['master']) + git_cmd('checkout', [orig_rev]) if __name__ == '__main__': -- 2.34.1