Merge "add include/exclude regions/users in svn scm (doc and tests)"
This commit is contained in:
commit
e7f5b92ea0
@ -391,6 +391,19 @@ def svn(self, xml_parent, data):
|
|||||||
(default '.')
|
(default '.')
|
||||||
:arg str workspaceupdater: optional argument to specify
|
:arg str workspaceupdater: optional argument to specify
|
||||||
how to update the workspace (default wipeworkspace)
|
how to update the workspace (default wipeworkspace)
|
||||||
|
:arg list(str) excluded-users: list of users to ignore revisions from
|
||||||
|
when polling for changes (if polling is enabled; parameter is optional)
|
||||||
|
:arg list(str) included-regions: list of file/folders to include
|
||||||
|
(optional)
|
||||||
|
:arg list(str) excluded-regions: list of file/folders to exclude (optional)
|
||||||
|
:arg list(str) excluded-commit-messages: list of commit messages to exclude
|
||||||
|
(optional)
|
||||||
|
:arg str exclusion-revprop-name: revision svn-property to ignore (optional)
|
||||||
|
:arg bool ignore-property-changes-on-directories: ignore svn-property only
|
||||||
|
changes of directories (default false)
|
||||||
|
:arg bool filter-changelog: If set Jenkins will apply the same inclusion
|
||||||
|
and exclusion patterns for displaying changelog entries as it does for
|
||||||
|
polling for changes (default false)
|
||||||
:arg list repos: list of repositories to checkout (optional)
|
:arg list repos: list of repositories to checkout (optional)
|
||||||
|
|
||||||
:Repo: * **url** (`str`) -- URL for the repository
|
:Repo: * **url** (`str`) -- URL for the repository
|
||||||
@ -403,16 +416,13 @@ def svn(self, xml_parent, data):
|
|||||||
:emulateclean: - delete unversioned/ignored files then update
|
:emulateclean: - delete unversioned/ignored files then update
|
||||||
:update: - do an svn update as much as possible
|
:update: - do an svn update as much as possible
|
||||||
|
|
||||||
Example::
|
Multiple repos example:
|
||||||
|
|
||||||
scm:
|
.. literalinclude:: /../../tests/scm/fixtures/svn-multiple-repos-001.yaml
|
||||||
- svn:
|
|
||||||
workspaceupdater: update
|
Advanced commit filtering example:
|
||||||
repos:
|
|
||||||
- url: http://svn.example.com/repo
|
.. literalinclude:: /../../tests/scm/fixtures/svn-regions-001.yaml
|
||||||
basedir: .
|
|
||||||
- url: http://svn.example.com/repo2
|
|
||||||
basedir: repo2
|
|
||||||
"""
|
"""
|
||||||
scm = XML.SubElement(xml_parent, 'scm', {'class':
|
scm = XML.SubElement(xml_parent, 'scm', {'class':
|
||||||
'hudson.scm.SubversionSCM'})
|
'hudson.scm.SubversionSCM'})
|
||||||
@ -443,6 +453,33 @@ def svn(self, xml_parent, data):
|
|||||||
XML.SubElement(scm, 'workspaceUpdater', {'class':
|
XML.SubElement(scm, 'workspaceUpdater', {'class':
|
||||||
'hudson.scm.subversion.' + updaterclass})
|
'hudson.scm.subversion.' + updaterclass})
|
||||||
|
|
||||||
|
mapping = [
|
||||||
|
# option, xml name, default value
|
||||||
|
("excluded-regions", 'excludedRegions', []),
|
||||||
|
("included-regions", 'includedRegions', []),
|
||||||
|
("excluded-users", 'excludedUsers', []),
|
||||||
|
("exclusion-revprop-name", 'excludedRevprop', ''),
|
||||||
|
("excluded-commit-messages", 'excludedCommitMessages', []),
|
||||||
|
("ignore-property-changes-on-directories", 'ignoreDirPropChanges',
|
||||||
|
False),
|
||||||
|
("filter-changelog", 'filterChangelog', False),
|
||||||
|
]
|
||||||
|
|
||||||
|
for optname, xmlname, defvalue in mapping:
|
||||||
|
if isinstance(defvalue, list):
|
||||||
|
val = '\n'.join(data.get(optname, defvalue))
|
||||||
|
else:
|
||||||
|
val = data.get(optname, defvalue)
|
||||||
|
# Skip adding xml entry if default is empty and no value given
|
||||||
|
if not val and (defvalue in ['', []]):
|
||||||
|
continue
|
||||||
|
|
||||||
|
xe = XML.SubElement(scm, xmlname)
|
||||||
|
if isinstance(defvalue, bool):
|
||||||
|
xe.text = str(val).lower()
|
||||||
|
else:
|
||||||
|
xe.text = str(val)
|
||||||
|
|
||||||
|
|
||||||
def tfs(self, xml_parent, data):
|
def tfs(self, xml_parent, data):
|
||||||
"""yaml: tfs
|
"""yaml: tfs
|
||||||
|
18
tests/scm/fixtures/svn-multiple-repos-001.xml
Normal file
18
tests/scm/fixtures/svn-multiple-repos-001.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<scm class="hudson.scm.SubversionSCM">
|
||||||
|
<locations>
|
||||||
|
<hudson.scm.SubversionSCM_-ModuleLocation>
|
||||||
|
<remote>http://svn.example.com/repo</remote>
|
||||||
|
<local>.</local>
|
||||||
|
</hudson.scm.SubversionSCM_-ModuleLocation>
|
||||||
|
<hudson.scm.SubversionSCM_-ModuleLocation>
|
||||||
|
<remote>http://svn.example.com/repo2</remote>
|
||||||
|
<local>repo2</local>
|
||||||
|
</hudson.scm.SubversionSCM_-ModuleLocation>
|
||||||
|
</locations>
|
||||||
|
<workspaceUpdater class="hudson.scm.subversion.UpdateUpdater"/>
|
||||||
|
<ignoreDirPropChanges>false</ignoreDirPropChanges>
|
||||||
|
<filterChangelog>false</filterChangelog>
|
||||||
|
</scm>
|
||||||
|
</project>
|
8
tests/scm/fixtures/svn-multiple-repos-001.yaml
Normal file
8
tests/scm/fixtures/svn-multiple-repos-001.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
scm:
|
||||||
|
- svn:
|
||||||
|
workspaceupdater: update
|
||||||
|
repos:
|
||||||
|
- url: http://svn.example.com/repo
|
||||||
|
basedir: .
|
||||||
|
- url: http://svn.example.com/repo2
|
||||||
|
basedir: repo2
|
23
tests/scm/fixtures/svn-regions-001.xml
Normal file
23
tests/scm/fixtures/svn-regions-001.xml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<scm class="hudson.scm.SubversionSCM">
|
||||||
|
<locations>
|
||||||
|
<hudson.scm.SubversionSCM_-ModuleLocation>
|
||||||
|
<remote>http://svn.apache.org/repos/asf/spamassassin/trunk</remote>
|
||||||
|
<local>.</local>
|
||||||
|
</hudson.scm.SubversionSCM_-ModuleLocation>
|
||||||
|
</locations>
|
||||||
|
<workspaceUpdater class="hudson.scm.subversion.CheckoutUpdater"/>
|
||||||
|
<excludedRegions>/region3/.*\.jpg
|
||||||
|
/region4</excludedRegions>
|
||||||
|
<includedRegions>/region1/.*\.cpp
|
||||||
|
/region2</includedRegions>
|
||||||
|
<excludedUsers>user1
|
||||||
|
user2</excludedUsers>
|
||||||
|
<excludedRevprop>propname</excludedRevprop>
|
||||||
|
<excludedCommitMessages>test-msg
|
||||||
|
test-msg2</excludedCommitMessages>
|
||||||
|
<ignoreDirPropChanges>true</ignoreDirPropChanges>
|
||||||
|
<filterChangelog>true</filterChangelog>
|
||||||
|
</scm>
|
||||||
|
</project>
|
19
tests/scm/fixtures/svn-regions-001.yaml
Normal file
19
tests/scm/fixtures/svn-regions-001.yaml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
scm:
|
||||||
|
- svn:
|
||||||
|
url: http://svn.apache.org/repos/asf/spamassassin/trunk
|
||||||
|
workspaceupdater: wipeworkspace
|
||||||
|
included-regions:
|
||||||
|
- /region1/.*\.cpp
|
||||||
|
- /region2
|
||||||
|
excluded-regions:
|
||||||
|
- /region3/.*\.jpg
|
||||||
|
- /region4
|
||||||
|
excluded-users:
|
||||||
|
- user1
|
||||||
|
- user2
|
||||||
|
excluded-commit-messages:
|
||||||
|
- test-msg
|
||||||
|
- test-msg2
|
||||||
|
exclusion-revprop-name: propname
|
||||||
|
filter-changelog: true
|
||||||
|
ignore-property-changes-on-directories: true
|
Loading…
x
Reference in New Issue
Block a user