Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Backward compatibility fix: try old key if new key doesn't work

Fixes the case where new plugin is installed and compareRemoteRevisionWith
is called on a build produced with the old version. The new plugin fails
to retrieve the SCMRevisionState objects in this case.
  • Loading branch information...
commit 7a9e2b2bf7d9a195ddb67019c37979ca9fe384cb 1 parent 915646e
@kmbell kmbell authored
View
6 src/main/java/org/jenkinsci/plugins/multiplescms/MultiSCMRevisionState.java
@@ -22,7 +22,11 @@ public void add(@NonNull SCM scm, @NonNull FilePath ws, @Nullable AbstractBuild<
}
public SCMRevisionState get(@NonNull SCM scm, @NonNull FilePath ws, @Nullable AbstractBuild<?,?> build) {
- return revisionStates.get(keyFor(scm, ws, build));
+ SCMRevisionState state = revisionStates.get(keyFor(scm, ws, build));
+ // for backward compatibility with version 0.1, try to get the state using the class name as well
+ if (state == null)
+ state = revisionStates.get(scm.getClass().getName());
+ return state;
}
private static String keyFor(@NonNull SCM scm, @NonNull FilePath ws, @Nullable AbstractBuild<?,?> build) { // JENKINS-12298
Please sign in to comment.
Something went wrong with that request. Please try again.