add support to git for changelog against branch

added support for another extension type, and fix how extensions are populated to xml

Change-Id: Ic9cf21a268d4ee3fb9b9efdee65c3d49e0cdb31e
Signed-off-by: Kyle Rockman <kyle.rockman@mac.com>
This commit is contained in:
Kyle Rockman 2014-11-12 11:26:53 -06:00
parent 445c73a298
commit 009b362968
24 changed files with 112 additions and 3 deletions

View File

@ -96,7 +96,17 @@ remoteName/\*')
(default 'default')
:arg str git-config-name: Configure name for Git clone (optional)
:arg str git-config-email: Configure email for Git clone (optional)
:arg str timeout: Timeout for git commands in minutes (optional)
:extensions:
:arg dict changelog-against:
:changelog-against:
* **remote** (`string`) - name of repo that contains branch to
create changelog against (default 'origin')
* **branch** (`string`) - name of the branch to create
create changelog against (default 'master')
:arg str timeout: Timeout for git commands in minutes (optional)
:browser values:
:auto:
@ -223,9 +233,17 @@ remoteName/\*')
if 'local-branch' in data:
XML.SubElement(scm, 'localBranch').text = data['local-branch']
exts_node = XML.SubElement(scm, 'extensions')
if 'changelog-against' in data:
ext_name = 'hudson.plugins.git.extensions.impl.ChangelogToBranch'
ext = XML.SubElement(exts_node, ext_name)
opts = XML.SubElement(ext, 'options')
change_remote = data['changelog-against'].get('remote', 'origin')
change_branch = data['changelog-against'].get('branch', 'master')
XML.SubElement(opts, 'compareRemote').text = change_remote
XML.SubElement(opts, 'compareTarget').text = change_branch
if 'timeout' in data:
ext = XML.SubElement(scm, 'extensions')
co = XML.SubElement(ext,
co = XML.SubElement(exts_node,
'hudson.plugins.git.extensions.impl.'
'CheckoutOption')
XML.SubElement(co, 'timeout').text = str(data['timeout'])

View File

@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
<builders/>
<publishers/>

View File

@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
<builders/>
<publishers/>

View File

@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
<builders/>
<publishers/>

View File

@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
<builders/>
<publishers/>

View File

@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
<builders/>
<publishers/>
@ -91,6 +92,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
<builders/>
<publishers/>

View File

@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
<builders/>
<publishers/>
@ -91,6 +92,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
<builders/>
<publishers/>

View File

@ -44,6 +44,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
<scm class="hudson.plugins.git.GitSCM">
<configVersion>2</configVersion>
@ -79,6 +80,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
</scms>
</scm>

View File

@ -56,6 +56,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
</scms>
</scm>

View File

@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
<builders/>
<publishers/>

View File

@ -34,5 +34,6 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>true</ignoreNotifyCommit>
<extensions/>
</scm>
</project>

View File

@ -34,5 +34,6 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
</project>

View File

@ -34,5 +34,6 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
</project>

View File

@ -40,5 +40,6 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
</project>

View File

@ -35,5 +35,6 @@
<scmName/>
<useShallowClone>true</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
</project>

View File

@ -34,5 +34,6 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
</project>

View File

@ -34,5 +34,6 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
</project>

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<scm class="hudson.plugins.git.GitSCM">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<name>origin</name>
<refspec>+refs/heads/*:refs/remotes/origin/*</refspec>
<url>https://example.com/project.git</url>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>master</name>
</hudson.plugins.git.BranchSpec>
<hudson.plugins.git.BranchSpec>
<name>stable</name>
</hudson.plugins.git.BranchSpec>
</branches>
<excludedUsers/>
<buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
<disableSubmodules>false</disableSubmodules>
<recursiveSubmodules>false</recursiveSubmodules>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<authorOrCommitter>false</authorOrCommitter>
<clean>false</clean>
<wipeOutWorkspace>true</wipeOutWorkspace>
<pruneBranches>false</pruneBranches>
<remotePoll>false</remotePoll>
<gitTool>Default</gitTool>
<submoduleCfg class="list"/>
<relativeTargetDir/>
<reference/>
<gitConfigName/>
<gitConfigEmail/>
<skipTag>false</skipTag>
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions>
<hudson.plugins.git.extensions.impl.ChangelogToBranch>
<options>
<compareRemote>origin</compareRemote>
<compareTarget>master</compareTarget>
</options>
</hudson.plugins.git.extensions.impl.ChangelogToBranch>
<hudson.plugins.git.extensions.impl.CheckoutOption>
<timeout>20</timeout>
</hudson.plugins.git.extensions.impl.CheckoutOption>
</extensions>
<browser class="hudson.plugins.git.browser.GithubWeb">
<url>http://github.com/foo/example.git</url>
</browser>
</scm>
</project>

View File

@ -0,0 +1,12 @@
scm:
- git:
url: https://example.com/project.git
branches:
- master
- stable
browser: githubweb
browser-url: http://github.com/foo/example.git
timeout: 20
changelog-against:
remote: origin
branch: master

View File

@ -34,6 +34,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
<browser class="hudson.plugins.git.browser.GitLab">
<url>https://gitlab.example.com/foo/bar/</url>
<version>5.2</version>

View File

@ -35,5 +35,6 @@
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<localBranch>master</localBranch>
<extensions/>
</scm>
</project>

View File

@ -34,6 +34,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
<browser class="hudson.plugins.git.browser.Stash">
<url>https://stash.example.com/projects/foo/repos/bar/</url>
</browser>

View File

@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
<browser class="hudson.plugins.git.browser.GitWeb">
<url>http://review.openstack.org/gitweb?p=openstack-infra/jenkins-job-builder.git</url>
</browser>

View File

@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions/>
</scm>
<builders/>
<publishers/>