From 96d6dd10a3bf3de5b7af908c9d5bd222389d646b Mon Sep 17 00:00:00 2001 From: jollychang Date: Tue, 18 Sep 2012 15:38:02 +0800 Subject: [PATCH] get_vsc_url --- jenkinsapi/job.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/jenkinsapi/job.py b/jenkinsapi/job.py index 2dfe279..e84ed11 100644 --- a/jenkinsapi/job.py +++ b/jenkinsapi/job.py @@ -228,6 +228,19 @@ class Job(JenkinsBase): } return vcsmap.get(bs.project.scm.attrs['class']) + def get_vcs_url(self): + if self._config is None: + self.load_config() + + bs = BeautifulSoup(self._config, 'xml') + vcsurlmap = { + 'svn' : lambda : bs.project.scm.find("hudson.scm.SubversionSCM_-ModuleLocation").remote.text, + 'git' : lambda : bs.project.scm.userRemoteConfigs.find('hudson.plugins.git.UserRemoteConfig').url.text, + 'hg' : lambda : bs.project.scm.source.text, + } + vcs = self.get_vcs() + return vcsurlmap[vcs]() + def update_config(self, config): '''Update the config.xml to the job''' return self.post_data("%(baseurl)s/config.xml" % self.__dict__, config) -- 2.7.4