Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-12298

MultiSCMRevisionState.revisionStates cannot differentiate multiple instances of a single SCM type

      public void add(String scmClass, SCMRevisionState scmState) {
        revisionStates.put(scmClass, scmState);
      }
      ...
      revisionStates.add(scm.getClass().getName(), scmState);
      

      cannot work when you want to use more than one copy of a given SCM plugin in a single job. First of all you should use scm.getType() rather than hardcoding the class name. Second you should include the result of getModuleRoots in the hash key.

          [JENKINS-12298] MultiSCMRevisionState.revisionStates cannot differentiate multiple instances of a single SCM type

          Jesse Glick added a comment - - edited

          Serialized build.xml files always seem to have an empty state:

          <org.jenkinsci.plugins.multiplescms.MultiSCMRevisionState>
            <revisionStates/>
          </org.jenkinsci.plugins.multiplescms.MultiSCMRevisionState>
          

          Not sure what that means. XStream problem, or does it just happen to be empty when the build is persisted?

          Jesse Glick added a comment - - edited Serialized build.xml files always seem to have an empty state: <org.jenkinsci.plugins.multiplescms.MultiSCMRevisionState> <revisionStates/> </org.jenkinsci.plugins.multiplescms.MultiSCMRevisionState> Not sure what that means. XStream problem, or does it just happen to be empty when the build is persisted?

          Andrew Bayer added a comment -

          fwiw, the git plugin works around this by having an optional unique field to identify each instance. The MultipleSCMs plugin is able to use that somehow to distinguish between multiple repos.

          Andrew Bayer added a comment - fwiw, the git plugin works around this by having an optional unique field to identify each instance. The MultipleSCMs plugin is able to use that somehow to distinguish between multiple repos.

          Jesse Glick added a comment -

          I do not see anything in multiplescms that would do anything special with the Git plugin...?

          Fix available in pull request #1.

          Jesse Glick added a comment - I do not see anything in multiplescms that would do anything special with the Git plugin...? Fix available in pull request #1.

          Kevin Bell added a comment -

          Pull request #1 has been merged (at least the part relevant to this issue)

          Kevin Bell added a comment - Pull request #1 has been merged (at least the part relevant to this issue)

            kbell Kevin Bell
            jglick Jesse Glick
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: