def get_rev_options(vcs, url, rev): """ Return a RevOptions object. """ r = urllib_parse.urlsplit(url) if hasattr(r, 'username'): # >= Python-2.5 username, password = r.username, r.password else: netloc = r[1] if '@' in netloc: auth = netloc.split('@')[0] if ':' in auth: username, password = auth.split(':', 1) else: username, password = auth, None else: username, password = None, None extra_args = [] if username: extra_args += ['--username', username] if password: extra_args += ['--password', password] return vcs.make_rev_options(rev, extra_args=extra_args)
def get_rev_options(vcs, url, rev): """ Return a RevOptions object. """ r = urllib_parse.urlsplit(url) extra_args = [] # Do not get auth for svn+ssh # (svn --username is not recognized for that scheme) if r[0] != 'svn+ssh': if hasattr(r, 'username'): # >= Python-2.5 username, password = r.username, r.password else: netloc = r[1] if '@' in netloc: auth = netloc.split('@')[0] if ':' in auth: username, password = auth.split(':', 1) else: username, password = auth, None else: username, password = None, None if username: extra_args += ['--username', username] if password: extra_args += ['--password', password] return vcs.make_rev_options(rev, extra_args=extra_args)