Changeset 1323
- Timestamp:
- 09/30/06 04:04:35 (2 years ago)
- Files:
-
- perforceplugin/trunk/p4trac/api.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
perforceplugin/trunk/p4trac/api.py
r1215 r1323 57 57 yield ('perforce', 4) 58 58 59 def _update_option(self, options, key, value): 60 """Update options dictionary with (key, value)""" 61 62 if value == None: 63 if key in options: del options[key] 64 else: 65 options[key] = value 66 59 67 def get_repository(self, repos_type, repos_dir, authname): 60 68 61 69 assert repos_type == 'perforce' 62 70 71 import urllib 72 urltype, url = urllib.splittype(repos_dir) 73 assert urltype == 'p4' or url == 'p4' 74 63 75 options = dict(self.config.options('perforce')) 64 76 if urltype != None: 77 machine, path = urllib.splithost(url) 78 user_passwd, host_port = urllib.splituser(machine) 79 user, password = urllib.splitpasswd(user_passwd) 80 host, port = urllib.splitport(host_port) 81 self._update_option(options, 'port', port) 82 self._update_option(options, 'password', password) 83 self._update_option(options, 'user', user) 84 self._update_option(options, 'host', host) 85 65 86 if 'port' not in options: 66 87 raise TracError( … … 275 296 276 297 def get_name(self): 277 return 'p4://%s ' % self._connection.port298 return 'p4://%s:%s@%s:%s' % (self._connection.user, self._connection.password, self._connection.host, self._connection.port) 278 299 name = property(get_name) 279 300
