Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
39136804
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
39136804
编写于
5月 02, 2017
作者:
A
Andrew Bayer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rework to solo RunWithSCM interface
上级
e6f60646
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
77 deletion
+28
-77
core/src/main/java/hudson/model/AbstractBuild.java
core/src/main/java/hudson/model/AbstractBuild.java
+10
-46
core/src/main/java/hudson/model/Job.java
core/src/main/java/hudson/model/Job.java
+3
-3
core/src/main/java/hudson/model/View.java
core/src/main/java/hudson/model/View.java
+2
-1
core/src/main/java/jenkins/scm/RunWithSCM.java
core/src/main/java/jenkins/scm/RunWithSCM.java
+13
-27
未找到文件。
core/src/main/java/hudson/model/AbstractBuild.java
浏览文件 @
39136804
...
...
@@ -30,7 +30,7 @@ import hudson.EnvVars;
import
hudson.FilePath
;
import
hudson.Functions
;
import
hudson.Launcher
;
import
jenkins.scm.RunWithSCM
MixIn
;
import
jenkins.scm.RunWithSCM
;
import
jenkins.util.SystemProperties
;
import
hudson.console.ModelHyperlinkNote
;
import
hudson.model.Fingerprint.BuildPtr
;
...
...
@@ -100,7 +100,7 @@ import jenkins.model.lazy.LazyBuildMixIn;
* @author Kohsuke Kawaguchi
* @see AbstractProject
*/
public
abstract
class
AbstractBuild
<
P
extends
AbstractProject
<
P
,
R
>,
R
extends
AbstractBuild
<
P
,
R
>>
extends
Run
<
P
,
R
>
implements
Queue
.
Executable
,
LazyBuildMixIn
.
LazyLoadingRun
<
P
,
R
>,
RunWithSCM
MixIn
.
RunWithSCM
<
P
,
R
>
{
public
abstract
class
AbstractBuild
<
P
extends
AbstractProject
<
P
,
R
>,
R
extends
AbstractBuild
<
P
,
R
>>
extends
Run
<
P
,
R
>
implements
Queue
.
Executable
,
LazyBuildMixIn
.
LazyLoadingRun
<
P
,
R
>,
RunWithSCM
<
P
,
R
>
{
/**
* Set if we want the blame information to flow from upstream to downstream build.
...
...
@@ -181,21 +181,16 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
return
runMixIn
;
}
@SuppressWarnings
(
"unchecked"
)
// untypable
@Override
public
RunWithSCMMixIn
<
P
,
R
>
getRunWithSCMMixIn
()
{
return
new
RunWithSCMMixIn
<
P
,
R
>()
{
@SuppressWarnings
(
"unchecked"
)
// untypable
@Override
protected
R
asRun
()
{
return
(
R
)
AbstractBuild
.
this
;
}
@Override
@Nonnull
public
List
<
ChangeLogSet
<?
extends
ChangeLogSet
.
Entry
>>
getChangeSets
()
{
ChangeLogSet
<?
extends
Entry
>
cs
=
getChangeSet
();
return
cs
.
isEmptySet
()
?
Collections
.<
ChangeLogSet
<?
extends
ChangeLogSet
.
Entry
>>
emptyList
()
:
Collections
.<
ChangeLogSet
<?
extends
ChangeLogSet
.
Entry
>>
singletonList
(
cs
);
}
public
R
asRun
()
{
return
(
R
)
AbstractBuild
.
this
;
}
};
@Override
@Nonnull
public
List
<
ChangeLogSet
<?
extends
ChangeLogSet
.
Entry
>>
getChangeSets
()
{
ChangeLogSet
<?
extends
Entry
>
cs
=
getChangeSet
();
return
cs
.
isEmptySet
()
?
Collections
.
emptyList
()
:
Collections
.
singletonList
(
cs
);
}
@Override
protected
final
BuildReference
<
R
>
createReference
()
{
...
...
@@ -336,37 +331,11 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
return
getParent
().
getScm
().
getModuleRoots
(
ws
,
this
);
}
/**
* List of users who committed a change since the last non-broken build till now.
*
* <p>
* This list at least always include people who made changes in this build, but
* if the previous build was a failure it also includes the culprit list from there.
*
* @return
* can be empty but never null.
*/
@Override
@Exported
@Nonnull
public
Set
<
User
>
getCulprits
()
{
return
getRunWithSCMMixIn
().
getCulprits
();
}
@Override
@CheckForNull
public
Set
<
String
>
getCulpritIds
()
{
return
culprits
;
}
/**
* Returns true if this user has made a commit to this build.
*
* @since 1.191
*/
@Override
public
boolean
hasParticipant
(
User
user
)
{
return
getRunWithSCMMixIn
().
hasParticipant
(
user
);
}
/**
* Gets the version of Hudson that was used to build this job.
*
...
...
@@ -857,11 +826,6 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
return
cs
;
}
@Override
@Nonnull
public
List
<
ChangeLogSet
<?
extends
ChangeLogSet
.
Entry
>>
getChangeSets
()
{
return
getRunWithSCMMixIn
().
getChangeSets
();
}
/**
* Returns true if the changelog is already computed.
*/
...
...
core/src/main/java/hudson/model/Job.java
浏览文件 @
39136804
...
...
@@ -91,7 +91,7 @@ import jenkins.model.ModelObjectWithChildren;
import
jenkins.model.ProjectNamingStrategy
;
import
jenkins.model.RunIdMigrator
;
import
jenkins.model.lazy.LazyBuildMixIn
;
import
jenkins.scm.RunWithSCM
MixIn
;
import
jenkins.scm.RunWithSCM
;
import
jenkins.security.HexStringConfidentialKey
;
import
jenkins.triggers.SCMTriggerItem
;
import
net.sf.json.JSONException
;
...
...
@@ -1079,8 +1079,8 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
for
(
RunT
r
=
getLastBuild
();
r
!=
null
;
r
=
r
.
getPreviousBuild
())
{
int
idx
=
0
;
if
(
r
instanceof
RunWithSCM
MixIn
.
RunWithSCM
)
{
for
(
ChangeLogSet
<?
extends
ChangeLogSet
.
Entry
>
c
:
((
RunWithSCM
MixIn
.
RunWithSCM
<?,?>)
r
).
getChangeSets
())
{
if
(
r
instanceof
RunWithSCM
)
{
for
(
ChangeLogSet
<?
extends
ChangeLogSet
.
Entry
>
c
:
((
RunWithSCM
<?,?>)
r
).
getChangeSets
())
{
for
(
ChangeLogSet
.
Entry
e
:
c
)
{
entries
.
add
(
new
FeedItem
(
e
,
idx
++));
}
...
...
core/src/main/java/hudson/model/View.java
浏览文件 @
39136804
...
...
@@ -63,6 +63,7 @@ import jenkins.model.ModelObjectWithContextMenu;
import
jenkins.model.item_category.Categories
;
import
jenkins.model.item_category.Category
;
import
jenkins.model.item_category.ItemCategory
;
import
jenkins.scm.RunWithSCM
;
import
jenkins.triggers.SCMTriggerItem
;
import
jenkins.util.ProgressiveRendering
;
import
jenkins.util.xml.XMLUtils
;
...
...
@@ -116,7 +117,7 @@ import java.util.logging.Level;
import
java.util.logging.Logger
;
import
static
javax
.
servlet
.
http
.
HttpServletResponse
.
SC_BAD_REQUEST
;
import
static
jenkins
.
scm
.
RunWithSCM
MixIn
.*;
import
static
jenkins
.
scm
.
RunWithSCM
.*;
import
org.kohsuke.accmod.Restricted
;
import
org.kohsuke.accmod.restrictions.NoExternalUse
;
...
...
core/src/main/java/jenkins/scm/RunWithSCM
MixIn
.java
→
core/src/main/java/jenkins/scm/RunWithSCM.java
浏览文件 @
39136804
...
...
@@ -33,7 +33,6 @@ import hudson.model.Run;
import
hudson.model.User
;
import
hudson.scm.ChangeLogSet
;
import
hudson.util.AdaptedIterator
;
import
jenkins.triggers.SCMTriggerItem
;
import
jenkins.util.SystemProperties
;
import
org.kohsuke.stapler.export.Exported
;
...
...
@@ -51,16 +50,16 @@ import java.util.logging.Logger;
/**
* @since FIXME
*/
public
abstract
class
RunWithSCMMixIn
<
JobT
extends
Job
<
JobT
,
RunT
>
&
Queue
.
Task
,
RunT
extends
Run
<
JobT
,
RunT
>
&
RunWithSCM
MixIn
.
RunWithSCM
<
JobT
,
RunT
>
&
Queue
.
Executable
>
{
public
interface
RunWithSCM
<
JobT
extends
Job
<
JobT
,
RunT
>
&
Queue
.
Task
,
RunT
extends
Run
<
JobT
,
RunT
>
&
RunWithSCM
<
JobT
,
RunT
>
&
Queue
.
Executable
>
{
/**
* Set if we want the blame information to flow from upstream to downstream build.
*/
private
static
final
boolean
upstreamCulprits
=
SystemProperties
.
getBoolean
(
"hudson.upstreamCulprits"
);
boolean
upstreamCulprits
=
SystemProperties
.
getBoolean
(
"hudson.upstreamCulprits"
);
protected
abstract
RunT
asRun
();
RunT
asRun
();
public
abstract
List
<
ChangeLogSet
<?
extends
ChangeLogSet
.
Entry
>>
getChangeSets
();
List
<
ChangeLogSet
<?
extends
ChangeLogSet
.
Entry
>>
getChangeSets
();
/**
* List of users who committed a change since the last non-broken build till now.
...
...
@@ -73,8 +72,8 @@ public abstract class RunWithSCMMixIn<JobT extends Job<JobT, RunT> & Queue.Task,
* can be empty but never null.
*/
@Exported
@Nonnull
public
Set
<
User
>
getCulprits
()
{
if
(
asRun
().
getCulpritIds
()
==
null
)
{
@Nonnull
default
Set
<
User
>
getCulprits
()
{
if
(
getCulpritIds
()
==
null
)
{
Set
<
User
>
r
=
new
HashSet
<
User
>();
RunT
p
=
asRun
().
getPreviousCompletedBuild
();
if
(
p
!=
null
&&
asRun
().
isBuilding
())
{
...
...
@@ -112,7 +111,7 @@ public abstract class RunWithSCMMixIn<JobT extends Job<JobT, RunT> & Queue.Task,
return
new
AbstractSet
<
User
>()
{
public
Iterator
<
User
>
iterator
()
{
return
new
AdaptedIterator
<
String
,
User
>(
asRun
().
getCulpritIds
().
iterator
())
{
return
new
AdaptedIterator
<
String
,
User
>(
getCulpritIds
().
iterator
())
{
protected
User
adapt
(
String
id
)
{
return
User
.
get
(
id
);
}
...
...
@@ -120,7 +119,7 @@ public abstract class RunWithSCMMixIn<JobT extends Job<JobT, RunT> & Queue.Task,
}
public
int
size
()
{
return
asRun
().
getCulpritIds
().
size
();
return
getCulpritIds
().
size
();
}
};
}
...
...
@@ -128,7 +127,7 @@ public abstract class RunWithSCMMixIn<JobT extends Job<JobT, RunT> & Queue.Task,
/**
* Returns true if this user has made a commit to this build.
*/
public
boolean
hasParticipant
(
User
user
)
{
default
boolean
hasParticipant
(
User
user
)
{
for
(
ChangeLogSet
<?
extends
ChangeLogSet
.
Entry
>
c
:
getChangeSets
())
{
for
(
ChangeLogSet
.
Entry
e
:
c
)
try
{
...
...
@@ -141,21 +140,8 @@ public abstract class RunWithSCMMixIn<JobT extends Job<JobT, RunT> & Queue.Task,
return
false
;
}
public
interface
RunWithSCM
<
JobT
extends
Job
<
JobT
,
RunT
>
&
Queue
.
Task
,
RunT
extends
Run
<
JobT
,
RunT
>
&
RunWithSCM
<
JobT
,
RunT
>
&
Queue
.
Executable
>
{
@Nonnull
List
<
ChangeLogSet
<?
extends
ChangeLogSet
.
Entry
>>
getChangeSets
();
@CheckForNull
Set
<
String
>
getCulpritIds
();
@Nonnull
Set
<
User
>
getCulprits
();
@CheckForNull
Set
<
String
>
getCulpritIds
();
RunWithSCMMixIn
<
JobT
,
RunT
>
getRunWithSCMMixIn
();
boolean
hasParticipant
(
User
user
);
}
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
RunWithSCMMixIn
.
class
.
getName
());
Logger
LOGGER
=
Logger
.
getLogger
(
RunWithSCM
.
class
.
getName
());
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录