# .. repository related
gitrepo = git.Repo('.')
- # this should be part of 'git' lib, but it isn't right now
- gitrepo.remotes = {}
- for remote in gitrepo.git.remote('-v').split('\n'):
- name, url, type = remote.split()
- type = type.strip('()')
- if not gitrepo.remotes.has_key(name):
- gitrepo.remotes.update({name: {type: url}})
- else:
- gitrepo.remotes[name].update({type: url})
- # this would also be helpful, but is not yet included in git lib
- gitrepo.name = gitrepo.remotes['origin']['fetch'].split('/')[-1]
+ if not has_attr(gitrepo,'remotes'):
+ # this should be part of 'git' lib, but it isn't right now
+ gitrepo.remotes = {}
+ for remote in gitrepo.git.remote('-v').split('\n'):
+ name, url, type = remote.split()
+ type = type.strip('()')
+ if not gitrepo.remotes.has_key(name):
+ gitrepo.remotes.update({name: {type: url}})
+ else:
+ gitrepo.remotes[name].update({type: url})
+ # this would also be helpful, but is not yet included in git lib
+ gitrepo.name = gitrepo.remotes['origin']['fetch'].split('/')[-1].strip('.git')
+ else:
+ gitrepo.name = gitrepo.remotes.origin.url.split('/')[-1].strip('.git')
# .. some local variables
daily_date = BUILD_START.strftime('%Y%m%d%H%M%S')