Skip to content
Permalink
Browse files

[JENKINS-7747] encode the changelist number directly in the changelog…

….xml for every file so the SCM browsers can retreive it
  • Loading branch information...
rpetti committed Jun 29, 2011
1 parent 3bfb2e2 commit a8d7a02b2f99f7ab68e9eef87560baf4d0cc49da
@@ -104,6 +104,7 @@ public String toString() {
Action action;
String filename;
String revision;
String changenumber;
String workspacePath;
Changelist changelist;

@@ -180,12 +181,12 @@ public void setWorkspacePath(String workspacePath) {
this.workspacePath = workspacePath;
}

public void setChangelist(Changelist changelist) {
this.changelist = changelist;
public void setChangenumber(String changenumber) {
this.changenumber = changenumber;
}

public Changelist getChangelist() {
return this.changelist;
public String getChangenumber() {
return this.changenumber;
}

public String getPath() {
@@ -171,7 +171,7 @@ public Changelist build(StringBuilder sb) throws PerforceException {
Changelist.FileEntry file = new Changelist.FileEntry();
file.setFilename(filename);
file.setRevision(rev);
file.setChangelist(change);
file.setChangenumber(Integer.valueOf(change.getChangeNumber()).toString());
file.setAction(Changelist.FileEntry.Action.valueOf(action.toUpperCase(Locale.US)));
files.add(file);
}
@@ -115,6 +115,11 @@ public static PerforceChangeLogSet parse(AbstractBuild build, InputStream change
//This field might not exist yet, so ignore it.
}
file.setRevision(fnode.selectSingleNode("rev").getStringValue());
try{
file.setChangenumber(fnode.selectSingleNode("changenumber").getStringValue());
}catch(Exception e){
//This field might not exist yet, so ignore it.
}
file.setAction(Changelist.FileEntry.Action.valueOf(fnode.selectSingleNode("action")
.getStringValue()));
files.add(file);
@@ -172,6 +177,7 @@ public static void saveToChangeLog(OutputStream outputStream, List<Changelist> c
stream.println("\t\t\t\t<name>" + Util.xmlEscape(entry.getFilename()) + "</name>");
stream.println("\t\t\t\t<workspacePath>" + Util.xmlEscape(entry.getWorkspacePath()) + "</workspacePath>");
stream.println("\t\t\t\t<rev>" + Util.xmlEscape(entry.getRevision()) + "</rev>");
stream.println("\t\t\t\t<changenumber>" + Util.xmlEscape(entry.getChangenumber()) + "</changenumber>");
stream.println("\t\t\t\t<action>" + entry.getAction() + "</action>");
stream.println("\t\t\t</file>");
}
@@ -44,10 +44,10 @@ public FishEyePerforce(URL url, String rootModule) {
public URL getDiffLink(Changelist.FileEntry file) throws IOException {
if(file.getAction() != Changelist.FileEntry.Action.EDIT && file.getAction() != Changelist.FileEntry.Action.INTEGRATE)
return null;
Changelist change = file.getChangelist();
String change = file.getChangenumber();
int r=0;
if(change != null){
r = new Integer(change.getChangeNumber());
r = new Integer(change);
} else {
//this is the old, incorrect behavior. New changes won't use this.
r = new Integer(file.getRevision());

0 comments on commit a8d7a02

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