forked from jenkinsci/git-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuild.java
More file actions
80 lines (63 loc) · 1.91 KB
/
Copy pathBuild.java
File metadata and controls
80 lines (63 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package hudson.plugins.git.util;
import hudson.model.Result;
import hudson.plugins.git.Revision;
import java.io.Serializable;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;
import org.eclipse.jgit.lib.ObjectId;
@ExportedBean(defaultVisibility = 999)
public class Build implements Serializable, Cloneable {
private static final long serialVersionUID = 1L;
/**
* Revision marked as being built.
*/
public Revision revision;
/**
* Revision that was subject to a merge.
*/
public Revision mergeRevision;
public int hudsonBuildNumber;
public Result hudsonBuildResult;
// TODO: We don't currently store the result correctly.
public Build(Revision revision, int buildNumber, Result result) {
this.revision = revision;
this.hudsonBuildNumber = buildNumber;
this.hudsonBuildResult = result;
}
public ObjectId getSHA1() {
return revision.getSha1();
}
@Exported
public Revision getRevision() {
return revision;
}
@Exported
public int getBuildNumber() {
return hudsonBuildNumber;
}
@Exported
public Result getBuildResult() {
return hudsonBuildResult;
}
public @Override String toString() {
String str = "Build #" + hudsonBuildNumber + " of " + revision.toString();
if(mergeRevision != null)
str += " merged with " + mergeRevision;
return str;
}
@Override
public Build clone() {
Build clone;
try {
clone = (Build) super.clone();
}
catch (CloneNotSupportedException e) {
throw new RuntimeException("Error cloning Build", e);
}
if (revision != null)
clone.revision = revision.clone();
if (mergeRevision != null)
clone.mergeRevision = mergeRevision.clone();
return clone;
}
}