Skip to content

Commit

Permalink
Fix file limits for change reporting.
Browse files Browse the repository at this point in the history
JENKINS-47602
  • Loading branch information
p4paul committed Feb 9, 2018
1 parent a7449fd commit b5da0e2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/jenkinsci/plugins/p4/PerforceScm.java
Expand Up @@ -708,8 +708,8 @@ public static class DescriptorImpl extends SCMDescriptor<PerforceScm> {

private boolean hideTicket;

private int maxFiles;
private int maxChanges;
private int maxFiles = DEFAULT_FILE_LIMIT;
private int maxChanges = DEFAULT_CHANGE_LIMIT;

public boolean isAutoSave() {
return autoSave;
Expand Down
24 changes: 14 additions & 10 deletions src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeEntry.java
Expand Up @@ -50,19 +50,11 @@ public P4ChangeEntry(P4ChangeSet parent) {

jobs = new ArrayList<IFix>();
affectedFiles = new ArrayList<P4AffectedFile>();

Jenkins j = Jenkins.getInstance();
if (j != null) {
Descriptor dsc = j.getDescriptor(PerforceScm.class);
if (dsc instanceof PerforceScm.DescriptorImpl) {
PerforceScm.DescriptorImpl p4scm = (PerforceScm.DescriptorImpl) dsc;
fileCountLimit = p4scm.getMaxFiles();
}
}
getFileCountLimit();
}

public P4ChangeEntry() {

getFileCountLimit();
}

public void setChange(ConnectionHelper p4, IChangelistSummary changelist) throws Exception {
Expand Down Expand Up @@ -352,4 +344,16 @@ public long getTimestamp() {
public String getCommitId() {
return getChangeNumber();
}

private int getFileCountLimit() {
Jenkins j = Jenkins.getInstance();
if (j != null) {
Descriptor dsc = j.getDescriptor(PerforceScm.class);
if (dsc instanceof PerforceScm.DescriptorImpl) {
PerforceScm.DescriptorImpl p4scm = (PerforceScm.DescriptorImpl) dsc;
fileCountLimit = p4scm.getMaxFiles();
}
}
return fileCountLimit;
}
}

0 comments on commit b5da0e2

Please sign in to comment.