Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
7741f96b
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,发现更多精彩内容 >>
提交
7741f96b
编写于
9月 17, 2012
作者:
K
Kohsuke Kawaguchi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix up next/previous build links
上级
eec63feb
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
50 addition
and
17 deletion
+50
-17
core/src/main/java/hudson/model/AbstractBuild.java
core/src/main/java/hudson/model/AbstractBuild.java
+21
-0
core/src/main/java/hudson/model/AbstractProject.java
core/src/main/java/hudson/model/AbstractProject.java
+2
-4
core/src/main/java/hudson/model/Run.java
core/src/main/java/hudson/model/Run.java
+11
-11
core/src/main/java/hudson/model/RunMap.java
core/src/main/java/hudson/model/RunMap.java
+16
-1
core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java
.../main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java
+0
-1
未找到文件。
core/src/main/java/hudson/model/AbstractBuild.java
浏览文件 @
7741f96b
...
...
@@ -62,6 +62,7 @@ import hudson.util.Iterators;
import
hudson.util.LogTaskListener
;
import
hudson.util.VariableResolver
;
import
jenkins.model.Jenkins
;
import
jenkins.model.lazy.AbstractLazyLoadRunMap.Direction
;
import
org.kohsuke.stapler.Stapler
;
import
org.kohsuke.stapler.StaplerRequest
;
import
org.kohsuke.stapler.StaplerResponse
;
...
...
@@ -170,6 +171,26 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
return
getParent
();
}
private
boolean
previousBuildComputed
,
nextBuildComputed
;
@Override
public
R
getPreviousBuild
()
{
if
(
previousBuild
==
null
&&
!
previousBuildComputed
)
{
previousBuild
=
getParent
().
builds
.
search
(
number
-
1
,
Direction
.
DESC
);
previousBuildComputed
=
true
;
}
return
previousBuild
;
}
@Override
public
R
getNextBuild
()
{
if
(
nextBuild
==
null
&&
!
nextBuildComputed
)
{
nextBuild
=
getParent
().
builds
.
search
(
number
+
1
,
Direction
.
ASC
);
nextBuildComputed
=
true
;
}
return
nextBuild
;
}
/**
* Returns a {@link Slave} on which this build was done.
*
...
...
core/src/main/java/hudson/model/AbstractProject.java
浏览文件 @
7741f96b
...
...
@@ -160,7 +160,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
* {@link Run#getPreviousBuild()}
*/
@Restricted
(
NoExternalUse
.
class
)
protected
transient
/*almost final*/
RunMap
<
R
>
builds
=
new
RunMap
<
R
>();
protected
transient
RunMap
<
R
>
builds
=
new
RunMap
<
R
>();
/**
* The quiet period. Null to delegate to the system default.
...
...
@@ -269,9 +269,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
public
void
onLoad
(
ItemGroup
<?
extends
Item
>
parent
,
String
name
)
throws
IOException
{
super
.
onLoad
(
parent
,
name
);
if
(
this
.
builds
==
null
)
this
.
builds
=
new
RunMap
<
R
>();
this
.
builds
.
load
(
this
,
new
Constructor
<
R
>()
{
this
.
builds
=
new
RunMap
<
R
>(
getBuildDir
(),
new
Constructor
<
R
>()
{
public
R
create
(
File
dir
)
throws
IOException
{
return
loadBuild
(
dir
);
}
...
...
core/src/main/java/hudson/model/Run.java
浏览文件 @
7741f96b
...
...
@@ -44,7 +44,6 @@ import hudson.model.Descriptor.FormException;
import
hudson.model.listeners.RunListener
;
import
hudson.model.listeners.SaveableListener
;
import
hudson.security.PermissionScope
;
import
jenkins.model.Jenkins.MasterComputer
;
import
hudson.search.SearchIndexBuilder
;
import
hudson.security.ACL
;
import
hudson.security.AccessControlled
;
...
...
@@ -640,10 +639,11 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
// a new build is in progress
BallColor
baseColor
;
if
(
previousBuild
==
null
)
RunT
pb
=
getPreviousBuild
();
if
(
pb
==
null
)
baseColor
=
BallColor
.
GREY
;
else
baseColor
=
p
reviousBuild
.
getIconColor
();
baseColor
=
p
b
.
getIconColor
();
return
baseColor
.
anime
();
}
...
...
@@ -747,10 +747,10 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
* Returns the last build that was actually built - i.e., skipping any with Result.NOT_BUILT
*/
public
RunT
getPreviousBuiltBuild
()
{
RunT
r
=
previousBuild
;
RunT
r
=
getPreviousBuild
()
;
// in certain situations (aborted m2 builds) r.getResult() can still be null, although it should theoretically never happen
while
(
r
!=
null
&&
(
r
.
getResult
()
==
null
||
r
.
getResult
()==
Result
.
NOT_BUILT
)
)
r
=
r
.
previousBuild
;
r
=
r
.
getPreviousBuild
()
;
return
r
;
}
...
...
@@ -758,9 +758,9 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
* Returns the last build that didn't fail before this build.
*/
public
RunT
getPreviousNotFailedBuild
()
{
RunT
r
=
previousBuild
;
RunT
r
=
getPreviousBuild
()
;
while
(
r
!=
null
&&
r
.
getResult
()==
Result
.
FAILURE
)
r
=
r
.
previousBuild
;
r
=
r
.
getPreviousBuild
()
;
return
r
;
}
...
...
@@ -768,9 +768,9 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
* Returns the last failed build before this build.
*/
public
RunT
getPreviousFailedBuild
()
{
RunT
r
=
previousBuild
;
RunT
r
=
getPreviousBuild
()
;
while
(
r
!=
null
&&
r
.
getResult
()!=
Result
.
FAILURE
)
r
=
r
.
previousBuild
;
r
=
r
.
getPreviousBuild
()
;
return
r
;
}
...
...
@@ -779,9 +779,9 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
* @since 1.383
*/
public
RunT
getPreviousSuccessfulBuild
()
{
RunT
r
=
previousBuild
;
RunT
r
=
getPreviousBuild
()
;
while
(
r
!=
null
&&
r
.
getResult
()!=
Result
.
SUCCESS
)
r
=
r
.
previousBuild
;
r
=
r
.
getPreviousBuild
()
;
return
r
;
}
...
...
core/src/main/java/hudson/model/RunMap.java
浏览文件 @
7741f96b
...
...
@@ -62,10 +62,23 @@ public final class RunMap<R extends Run<?,R>> extends AbstractLazyLoadRunMap<R>
// patch up next/previous build link
/**
* @deprecated
* Use {@link #RunMap(File, Constructor)}.
*/
public
RunMap
()
{
super
(
null
);
// will be set later
}
/**
* @param cons
* Used to create new instance of {@link Run}.
*/
public
RunMap
(
File
baseDir
,
Constructor
cons
)
{
super
(
baseDir
);
this
.
cons
=
cons
;
}
@Override
public
boolean
remove
(
R
run
)
{
if
(
run
.
nextBuild
!=
null
)
...
...
@@ -179,8 +192,10 @@ public final class RunMap<R extends Run<?,R>> extends AbstractLazyLoadRunMap<R>
* Job that owns this map.
* @param cons
* Used to create new instance of {@link Run}.
* @deprecated
* Use {@link #RunMap(File, Constructor)}
*/
public
synchronized
void
load
(
Job
job
,
Constructor
<
R
>
cons
)
{
public
void
load
(
Job
job
,
Constructor
<
R
>
cons
)
{
this
.
cons
=
cons
;
initBaseDir
(
job
.
getBuildDir
());
}
...
...
core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java
浏览文件 @
7741f96b
...
...
@@ -94,7 +94,6 @@ public abstract class AbstractLazyLoadRunMap<R> extends AbstractMap<Integer,R> i
*/
private
File
dir
;
@Restricted
(
NoExternalUse
.
class
)
// for now
protected
AbstractLazyLoadRunMap
(
File
dir
)
{
this
.
dir
=
dir
;
initBaseDir
(
dir
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录