From: jollychang Date: Tue, 18 Sep 2012 07:38:02 +0000 (+0800) Subject: get_vsc_url X-Git-Tag: v0.2.23~274^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=96d6dd10a3bf3de5b7af908c9d5bd222389d646b;p=tools%2Fpython-jenkinsapi.git get_vsc_url --- 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)