Show More
@@ -134,6 +134,38 b' class logstream:' | |||||
134 | self._stdout.close() |
|
134 | self._stdout.close() | |
135 | self._stdout = None |
|
135 | self._stdout = None | |
136 |
|
136 | |||
|
137 | ||||
|
138 | # Check to see if the given path is a local Subversion repo. Verify this by | |||
|
139 | # looking for several svn-specific files and directories in the given | |||
|
140 | # directory. | |||
|
141 | def filecheck(path, proto): | |||
|
142 | for x in ('locks', 'hooks', 'format', 'db', ): | |||
|
143 | if not os.path.exists(os.path.join(path, x)): | |||
|
144 | return False | |||
|
145 | return True | |||
|
146 | ||||
|
147 | # Check to see if a given path is the root of an svn repo over http. We verify | |||
|
148 | # this by requesting a version-controlled URL we know can't exist and looking | |||
|
149 | # for the svn-specific "not found" XML. | |||
|
150 | def httpcheck(path, proto): | |||
|
151 | return ('<m:human-readable errcode="160013">' in | |||
|
152 | urllib.urlopen('%s://%s/!svn/ver/0/.svn' % (proto, path)).read()) | |||
|
153 | ||||
|
154 | protomap = {'http': httpcheck, | |||
|
155 | 'https': httpcheck, | |||
|
156 | 'file': filecheck, | |||
|
157 | } | |||
|
158 | def issvnurl(url): | |||
|
159 | if not '://' in url: | |||
|
160 | return False | |||
|
161 | proto, path = url.split('://', 1) | |||
|
162 | check = protomap.get(proto, lambda p, p2: False) | |||
|
163 | while '/' in path: | |||
|
164 | if check(path, proto): | |||
|
165 | return True | |||
|
166 | path = path.rsplit('/', 1)[0] | |||
|
167 | return False | |||
|
168 | ||||
137 | # SVN conversion code stolen from bzr-svn and tailor |
|
169 | # SVN conversion code stolen from bzr-svn and tailor | |
138 | # |
|
170 | # | |
139 | # Subversion looks like a versioned filesystem, branches structures |
|
171 | # Subversion looks like a versioned filesystem, branches structures | |
@@ -155,7 +187,7 b' class svn_source(converter_source):' | |||||
155 | if not (url.startswith('svn://') or url.startswith('svn+ssh://') or |
|
187 | if not (url.startswith('svn://') or url.startswith('svn+ssh://') or | |
156 | (os.path.exists(url) and |
|
188 | (os.path.exists(url) and | |
157 | os.path.exists(os.path.join(url, '.svn'))) or |
|
189 | os.path.exists(os.path.join(url, '.svn'))) or | |
158 | (url.startswith('file://'))): |
|
190 | issvnurl(url)): | |
159 | raise NoRepo("%s does not look like a Subversion repo" % url) |
|
191 | raise NoRepo("%s does not look like a Subversion repo" % url) | |
160 |
|
192 | |||
161 | try: |
|
193 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now