Skip to content
Permalink
Browse files

[FIXED JENKINS-8354]

-setting default owner of labels to the perforce user configured
-adding option to set user when manually creating a label through the ui
  • Loading branch information...
Rob Petti
Rob Petti committed Jun 14, 2011
1 parent acbfdde commit 5d2ef5097cffba617958830de0bd233a0353ce0f
@@ -709,13 +709,13 @@ public boolean checkout(AbstractBuild build, Launcher launcher,
// Add tagging action that indicates that the build is already
// tagged (you can't label a label).
build.addAction(new PerforceTagAction(
build, depot, p4Label, projectPath));
build, depot, p4Label, projectPath, p4User));
}
else {
// Add tagging action that enables the user to create a label
// for this build.
build.addAction(new PerforceTagAction(
build, depot, newestChange, projectPath));
build, depot, newestChange, projectPath, p4User));
}

if (p4Counter != null && updateCounterValue) {
@@ -30,20 +30,23 @@
private String tag;
private String desc;
private String view;
private String owner;

public PerforceTagAction(AbstractBuild build, Depot depot, int changeNumber, String views) {
public PerforceTagAction(AbstractBuild build, Depot depot, int changeNumber, String views, String owner) {
super(build);
this.depot = depot;
this.changeNumber = changeNumber;
this.view = views;
this.owner = owner;
}

public PerforceTagAction(AbstractBuild build, Depot depot, String label, String views) {
public PerforceTagAction(AbstractBuild build, Depot depot, String label, String views, String owner) {
super(build);
this.depot = depot;
this.changeNumber = -1;
this.tag = label;
this.view = views;
this.owner = owner;
}

public PerforceTagAction(PerforceTagAction tga) {
@@ -52,6 +55,7 @@ public PerforceTagAction(PerforceTagAction tga) {
this.changeNumber = tga.changeNumber;
this.tag = tga.tag;
this.view = tga.view;
this.owner = tga.owner;
}

public int getChangeNumber() {
@@ -91,6 +95,14 @@ public void setDescription(String desc) {
this.desc = desc;
}

public String getOwner() {
return owner;
}

public void setOwner(String owner) {
this.owner = owner;
}

/**
* Returns true if this build has already been tagged at least once.
*/
@@ -128,6 +140,7 @@ public synchronized void doSubmit(StaplerRequest req, StaplerResponse rsp) throw

String tag = req.getParameter("name");
String desc = req.getParameter("desc");
owner = req.getParameter("owner");

tagBuild(tag, desc);

@@ -141,6 +154,7 @@ public void tagBuild(String tagname, String description) throws IOException {
label.setName(tag);
label.setDescription(desc);
label.setRevision(new Integer(changeNumber).toString());
if(owner!=null && !owner.equals("")) label.setOwner(owner);

//Only take the depot paths and add them to the view.
List<String> viewPairs = PerforceSCM.parseProjectPath(view, "workspace");
@@ -50,6 +50,11 @@
<td><b>Description:</b> </td>
<td><textarea name="desc" rows="5" cols="50">Changelist: ${it.changeNumber}</textarea></td>
</tr>
<tr>
<td><b>Owner:</b> </td>
<td><input type="text" name="owner"
value="${it.owner}" style="width:300px" id="owner" /></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>

0 comments on commit 5d2ef50

Please sign in to comment.
You can’t perform that action at this time.