Skip to content

Commit

Permalink
[FIXED JENKINS-8354]
Browse files Browse the repository at this point in the history
-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 committed Jun 14, 2011
1 parent acbfdde commit 5d2ef50
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/hudson/plugins/perforce/PerforceSCM.java
Expand Up @@ -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) {
Expand Down
18 changes: 16 additions & 2 deletions src/main/java/hudson/plugins/perforce/PerforceTagAction.java
Expand Up @@ -30,20 +30,23 @@ public class PerforceTagAction extends AbstractScmTagAction {
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) {
Expand All @@ -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() {
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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);

Expand All @@ -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");
Expand Down
Expand Up @@ -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>
Expand Down

0 comments on commit 5d2ef50

Please sign in to comment.