git scm learned 'refspec' parameter

The Zuul configuration advise user to set the Git plugin ref specifier
to $ZUUL_REF which was not supported. This patch let you specify it
using:

 scm:
  - git:
    refspec: '$ZUUL_REF'

Will fallback, as before, to '+refs/heads/*:refs/remotes/origin/*'

Change-Id: I1db7e86f8be5f6b167ba99f8fec266b4e8ff95a8
Reviewed-on: https://review.openstack.org/16011
Reviewed-by: James E. Blair <corvus@inaugust.com>
Reviewed-by: Paul Belanger <paul.belanger@polybeacon.com>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: Jeremy Stanley <fungi@yuggoth.org>
Tested-by: Jenkins
This commit is contained in:
Antoine Musso 2012-11-13 21:16:23 +01:00 committed by Jenkins
parent 8dd11dc1de
commit bb507da792
1 changed files with 6 additions and 2 deletions

View File

@ -44,6 +44,7 @@ def git(self, xml_parent, data):
<https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin>`_
:arg str url: URL of the git repository
:arg str refspec: refspec to fetch
:arg list(str) branches: list of branch specifiers to build
:arg bool skip-tag: Skip tagging
:arg bool prune: Prune remote branches
@ -97,8 +98,11 @@ def git(self, xml_parent, data):
user = XML.SubElement(scm, 'userRemoteConfigs')
huser = XML.SubElement(user, 'hudson.plugins.git.UserRemoteConfig')
XML.SubElement(huser, 'name').text = 'origin'
XML.SubElement(huser, 'refspec').text = \
'+refs/heads/*:refs/remotes/origin/*'
if 'refspec' in data:
refspec = data['refspec']
else:
refspec = '+refs/heads/*:refs/remotes/origin/*'
XML.SubElement(huser, 'refspec').text = refspec
XML.SubElement(huser, 'url').text = data['url']
xml_branches = XML.SubElement(scm, 'branches')
branches = data.get('branches', ['**'])