Add support for Stash as a repository viewer
Make it possible to use Atlassian Stash as a repository viewer of Git SCM changes. Also sort the viewers alphabetically. Change-Id: I6725570a0aa6770b2d0eee2cd0ae5ff0e5c5e07c
This commit is contained in:
parent
3ddbf020e0
commit
00a1c332e5
@ -79,14 +79,17 @@ def git(self, xml_parent, data):
|
||||
:arg str git-config-email: Configure email for Git clone
|
||||
|
||||
:browser values:
|
||||
:githubweb:
|
||||
:fisheye:
|
||||
:auto:
|
||||
:bitbucketweb:
|
||||
:cgit:
|
||||
:fisheye:
|
||||
:gitblit:
|
||||
:githubweb:
|
||||
:gitlab:
|
||||
:gitoriousweb:
|
||||
:gitweb:
|
||||
:redmineweb:
|
||||
:stash:
|
||||
:viewgit:
|
||||
|
||||
:choosing-strategy values:
|
||||
@ -189,22 +192,23 @@ def git(self, xml_parent, data):
|
||||
XML.SubElement(scm, 'localBranch').text = data['local-branch']
|
||||
|
||||
browser = data.get('browser', 'auto')
|
||||
browserdict = {'githubweb': 'GithubWeb',
|
||||
'fisheye': 'FisheyeGitRepositoryBrowser',
|
||||
browserdict = {'auto': 'auto',
|
||||
'bitbucketweb': 'BitbucketWeb',
|
||||
'cgit': 'CGit',
|
||||
'fisheye': 'FisheyeGitRepositoryBrowser',
|
||||
'gitblit': 'GitBlitRepositoryBrowser',
|
||||
'githubweb': 'GithubWeb',
|
||||
'gitlab': 'GitLab',
|
||||
'gitoriousweb': 'GitoriousWeb',
|
||||
'gitweb': 'GitWeb',
|
||||
'redmineweb': 'RedmineWeb',
|
||||
'viewgit': 'ViewGitWeb',
|
||||
'auto': 'auto'}
|
||||
'stash': 'Stash',
|
||||
'viewgit': 'ViewGitWeb'}
|
||||
if browser not in browserdict:
|
||||
valid = sorted(browserdict.keys())
|
||||
raise JenkinsJobsException("Browser entered is not valid must be one "
|
||||
"of: githubweb, fisheye, bitbucketweb, "
|
||||
"cgit, gitblit, gitlab, gitoriousweb, "
|
||||
"gitweb, redmineweb, viewgit, or auto")
|
||||
"of: %s or %s." % (", ".join(valid[:-1]),
|
||||
valid[-1]))
|
||||
if browser != 'auto':
|
||||
bc = XML.SubElement(scm, 'browser', {'class':
|
||||
'hudson.plugins.git.browser.' +
|
||||
|
40
tests/scm/fixtures/stash.xml
Normal file
40
tests/scm/fixtures/stash.xml
Normal file
@ -0,0 +1,40 @@
|
||||
<?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>ssh://git@stash.example.com:/foo/bar.git</url>
|
||||
</hudson.plugins.git.UserRemoteConfig>
|
||||
</userRemoteConfigs>
|
||||
<branches>
|
||||
<hudson.plugins.git.BranchSpec>
|
||||
<name>origin/master</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>
|
||||
<browser class="hudson.plugins.git.browser.Stash">
|
||||
<url>https://stash.example.com/projects/foo/repos/bar/</url>
|
||||
</browser>
|
||||
</scm>
|
||||
</project>
|
7
tests/scm/fixtures/stash.yaml
Normal file
7
tests/scm/fixtures/stash.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
scm:
|
||||
- git:
|
||||
url: "ssh://git@stash.example.com:/foo/bar.git"
|
||||
branches:
|
||||
- origin/master
|
||||
browser: stash
|
||||
browser-url: "https://stash.example.com/projects/foo/repos/bar/"
|
Loading…
Reference in New Issue
Block a user