org.eclipse.hudson.plugins.git.util.Build Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of git Show documentation
Show all versions of git Show documentation
Integrates Hudson with GIT SCM
/*******************************************************************************
*
* Copyright (c) 2011 Oracle Corporation.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*
* Andrew Bayer, Anton Kozak, Nikita Levyankov
*
*******************************************************************************/
package org.eclipse.hudson.plugins.git.util;
import hudson.model.Result;
import java.io.Serializable;
import org.eclipse.hudson.plugins.git.Revision;
import org.eclipse.jgit.lib.ObjectId;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;
@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;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy