129
126
def get_branches(self, repository, revnum, project="", pb=None):
130
127
"""Retrieve a list of paths that refer to branches in a specific revision.
132
:result: Iterator over tuples with (project, branch path)
129
:return: Iterator over tuples with (project, branch path)
134
131
raise NotImplementedError(self.get_branches)
136
133
def get_tags(self, repository, revnum, project="", pb=None):
137
134
"""Retrieve a list of paths that refer to tags in a specific revision.
139
:result: Iterator over tuples with (project, branch path)
136
:return: Iterator over tuples with (project, branch path)
141
138
raise NotImplementedError(self.get_tags)
195
class RootPathFinder(object):
197
def __init__(self, repository, revnum):
198
self.repository = repository
201
def check_path(self, path):
202
return self.repository.transport.check_path(path, self.revnum) == subvertpy.NODE_DIR
204
def find_children(self, path):
206
assert not path.startswith("/")
207
dirents = self.repository.transport.get_dir(path, self.revnum, DIRENT_KIND|DIRENT_HAS_PROPS)[0]
208
except subvertpy.SubversionException, (msg, num):
209
if num in (subvertpy.ERR_FS_NOT_DIRECTORY,
210
subvertpy.ERR_FS_NOT_FOUND,
211
subvertpy.ERR_RA_DAV_PATH_NOT_FOUND,
212
ERR_RA_DAV_FORBIDDEN):
215
return [(d, dirents[d]['has_props']) for d in dirents if dirents[d]['kind'] == subvertpy.NODE_DIR]
198
219
def get_root_paths(repository, itemlist, revnum, verify_fn, project=None, pb=None):
199
220
"""Find all the paths in the repository matching a list of items.
206
227
:param pb: Optional progress bar.
207
228
:return: Iterator over project, branch path, nick, has_props
209
def check_path(path):
210
return repository.transport.check_path(path, revnum) == subvertpy.NODE_DIR
211
def find_children(path):
213
assert not path.startswith("/")
214
dirents = repository.transport.get_dir(path, revnum, DIRENT_KIND|DIRENT_HAS_PROPS)[0]
215
except subvertpy.SubversionException, (msg, num):
216
if num in (subvertpy.ERR_FS_NOT_DIRECTORY,
217
subvertpy.ERR_FS_NOT_FOUND,
218
subvertpy.ERR_RA_DAV_PATH_NOT_FOUND,
219
ERR_RA_DAV_FORBIDDEN):
222
return [(d, dirents[d]['has_props']) for d in dirents if dirents[d]['kind'] == subvertpy.NODE_DIR]
230
rpf = RootPathFinder(repository, revnum)
224
232
for idx, pattern in enumerate(itemlist):
225
233
assert isinstance(pattern, str)
226
234
if pb is not None:
227
235
pb.update("finding branches", idx, len(itemlist))
228
for bp, has_props in expand_branch_pattern([], pattern.strip("/").split("/"), check_path,
229
find_children, project):
236
for bp, has_props in expand_branch_pattern([],
237
pattern.strip("/").split("/"), rpf.check_path,
238
rpf.find_children, project):
230
239
if verify_fn(bp, project):
231
240
yield project, bp, bp.split("/")[-1], has_props
263
272
This would consider paths path/to/foo/bla, path/to/blie/bla and path/to/trunk
264
273
branches, if they existed. The key used (203a...) is the UUID of the Subversion
265
274
repository. The UUID for a repository can be found by running "svn info <url>"
275
or "bzr info -v <url>".
272
281
layout_registry.register_lazy("root", "bzrlib.plugins.svn.layout.standard", "RootLayout")
273
282
layout_registry.register_lazy("none", "bzrlib.plugins.svn.layout.standard", "RootLayout")
274
283
layout_registry.register_lazy("trunk", "bzrlib.plugins.svn.layout.standard", "TrunkLayout0")
275
layout_registry.register_lazy("trunk0", "bzrlib.plugins.svn.layout.standard", "TrunkLayout0")
276
layout_registry.register_lazy("trunk1", "bzrlib.plugins.svn.layout.standard", "TrunkLayout1")
277
layout_registry.register_lazy("trunk2", "bzrlib.plugins.svn.layout.standard", "TrunkLayout2")
278
layout_registry.register_lazy("trunk3", "bzrlib.plugins.svn.layout.standard", "TrunkLayout3")
285
layout_registry.register_lazy("trunk%d" % i, "bzrlib.plugins.svn.layout.standard", "TrunkLayout%d" % i)
279
286
layout_registry.register_lazy("trunk-variable", "bzrlib.plugins.svn.layout.standard", "TrunkLayoutVariable")
281
288
layout_registry.register_lazy("itrunk1", "bzrlib.plugins.svn.layout.standard",
296
303
repository_registry = RepositoryRegistry()
297
304
repository_registry.register_lazy("283d02a7-25f6-0310-bc7c-ecb5cbfe19da",
298
305
"bzrlib.plugins.svn.layout.custom", "KDELayout")
306
layout_registry.register_lazy("kde", "bzrlib.plugins.svn.layout.custom",
299
308
repository_registry.register_lazy("13f79535-47bb-0310-9956-ffa450edef68",
300
309
"bzrlib.plugins.svn.layout.custom", "ApacheLayout")