Skip to end of metadata
Go to start of metadata

Use the following to setup a Sventon scm browser on all jobs.

import hudson.model.*
import hudson.maven.*
import hudson.tasks.*
import hudson.scm.*
import hudson.scm.browsers.*

for(item in Hudson.instance.items) {
  hasClaim = false;
  if (item.scm instanceof SubversionSCM)
  {
      println("\njob $item.name")
      println(item.scm.browser);
      if (item.scm.browser instanceof Sventon2)
      {
        println(item.scm.browser.url);
        println(item.scm.browser.repositoryInstance);
      }
      else
      {
        // add the repo browser details.
        browser = new hudson.scm.browsers.Sventon2(new URL("http://...../"), ".....")

        // unfortunately can't just add a browser - need to create a new scm entry, which is complex...
        scm = new  SubversionSCM(Arrays.asList(item.scm.locations), item.scm.workspaceUpdater, browser, item.scm.excludedRegions, item.scm.excludedUsers, item.scm.excludedRevprop, item.scm.excludedCommitMessages, item.scm.includedRegions, item.scm.ignoreDirPropChanges)

        item.scm = scm
        item.save()
        println("Updated repo browser");
      }
  }
}
  • No labels