def __new__(cls, path, rev=None): self = object.__new__(cls) if isinstance(path, cls): rev = path.rev path = path.strpath proto, uri = path.split("://", 1) host, uripath = uri.split('/', 1) # only check for bad chars in the non-protocol parts if (svncommon._check_for_bad_chars(host, svncommon.ALLOWED_CHARS_HOST) or svncommon._check_for_bad_chars(uripath, svncommon.ALLOWED_CHARS)): raise ValueError("bad char in path %s" % (path, )) path = path.rstrip('/') self.strpath = path self.rev = rev return self
def __new__(cls, wcpath=None, auth=None): self = object.__new__(cls) if isinstance(wcpath, cls): if wcpath.__class__ == cls: return wcpath wcpath = wcpath.localpath if svncommon._check_for_bad_chars(str(wcpath), svncommon.ALLOWED_CHARS): raise ValueError("bad char in wcpath %s" % (wcpath, )) self.localpath = py.path.local(wcpath) self.auth = auth return self