83
90
return (type, proj, bp, rp)
85
def _get_root_paths(self, revnum, verify_fn, project="", pb=None):
92
def _get_root_paths(self, itemlist, revnum, verify_fn, project=None, pb=None):
86
93
def check_path(path):
87
94
return self.repository.transport.check_path(path, revnum) == NODE_DIR
88
95
def find_children(path):
90
97
assert not path.startswith("/")
91
dirents = self.repository.transport.get_dir(path, revnum)[0]
98
dirents = self.repository.transport.get_dir(path, revnum, DIRENT_KIND)[0]
92
99
except SubversionException, (msg, num):
93
100
if num in (ERR_FS_NOT_DIRECTORY, ERR_FS_NOT_FOUND, ERR_RA_DAV_PATH_NOT_FOUND):
103
return [d for d in dirents if dirents[d]['kind'] == NODE_DIR]
98
for idx, pattern in enumerate(self.scheme.branch_list):
105
for idx, pattern in enumerate(itemlist):
99
106
if pb is not None:
100
pb.update("finding branches", idx, len(self.scheme.branch_list))
107
pb.update("finding branches", idx, len(itemlist))
101
108
for bp in expand_branch_pattern([], pattern.split("/"), check_path,
109
find_children, project):
110
if verify_fn(bp, project):
104
111
yield "", bp, bp.split("/")[-1]
106
def get_branches(self, revnum, project="", pb=None):
107
return self._get_root_paths(revnum, self.scheme.is_branch, project, pb)
113
def get_branches(self, revnum, project=None, pb=None):
114
return self._get_root_paths(self.scheme.branch_list, revnum, self.scheme.is_branch, project, pb)
109
def get_tags(self, revnum, project="", pb=None):
110
return self._get_root_paths(revnum, self.scheme.is_tag, project, pb)
116
def get_tags(self, revnum, project=None, pb=None):
117
return self._get_root_paths(self.scheme.tag_list, revnum, self.scheme.is_tag, project, pb)
112
119
def get_tag_path(self, name, project=""):
113
120
return self.scheme.get_tag_path(name, project)
118
125
def get_branch_path(self, name, project=""):
119
126
return self.scheme.get_branch_path(name, project)
121
def is_branch_parent(self, path):
128
def is_branch_parent(self, path, project=None):
123
return self.scheme.is_branch_parent(path)
130
return self.scheme.is_branch_parent(path, project)
125
def is_tag_parent(self, path):
132
def is_tag_parent(self, path, project=None):
127
return self.scheme.is_tag_parent(path)
134
return self.scheme.is_tag_parent(path, project)
129
136
def push_merged_revisions(self, project=""):
326
332
class BzrSvnMappingv3FileProps(mapping.BzrSvnMappingFileProps, BzrSvnMappingv3):
334
def __init__(self, scheme, guessed_scheme=None):
335
mapping.BzrSvnMappingFileProps.__init__(self, scheme, guessed_scheme)
336
BzrSvnMappingv3.__init__(self, scheme, guessed_scheme)
337
self.revprop_map = mapping.BzrSvnMappingRevProps()
339
def export_text_parents(self, can_use_custom_revprops, text_parents, svn_revprops, fileprops):
340
mapping.BzrSvnMappingFileProps.export_text_parents(self, can_use_custom_revprops, text_parents, svn_revprops, fileprops)
341
if can_use_custom_revprops:
342
self.revprop_map.export_text_parents(can_use_custom_revprops, text_parents, svn_revprops, fileprops)
344
def export_revision(self, can_use_custom_revprops, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, merges, old_fileprops):
345
(_, fileprops) = mapping.BzrSvnMappingFileProps.export_revision(self, can_use_custom_revprops, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, merges, old_fileprops)
346
if can_use_custom_revprops:
347
(revprops, _) = self.revprop_map.export_revision(can_use_custom_revprops, branch_root, timestamp, timezone, committer, revprops, None, revno, merges, old_fileprops)
348
return (revprops, fileprops)
350
def export_fileid_map(self, can_use_custom_revprops, fileids, revprops, fileprops):
351
mapping.BzrSvnMappingFileProps.export_fileid_map(self, can_use_custom_revprops, fileids, revprops, fileprops)
352
if can_use_custom_revprops:
353
self.revprop_map.export_fileid_map(can_use_custom_revprops, fileids, revprops, fileprops)
355
def export_message(self, can_use_custom_revprops, log, revprops, fileprops):
356
mapping.BzrSvnMappingFileProps.export_message(self, can_use_custom_revprops, log, revprops, fileprops)
357
if can_use_custom_revprops:
358
self.revprop_map.export_message(can_use_custom_revprops, log, revprops, fileprops)
330
361
class BzrSvnMappingv3RevProps(mapping.BzrSvnMappingRevProps, BzrSvnMappingv3):
362
def export_revision(self, can_use_custom_revprops, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, merges, fileprops):
363
(revprops, fileprops) = mapping.BzrSvnMappingRevProps.export_revision(self, can_use_custom_revprops, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, merges, fileprops)
364
revprops[mapping.SVN_REVPROP_BZR_MAPPING_VERSION] = "3"
365
return (revprops, fileprops)
334
368
class BzrSvnMappingv3Hybrid(BzrSvnMappingv3):
362
396
return self.fileprops.import_fileid_map(svn_revprops, fileprops)
364
def export_revision(self, branch_root, timestamp, timezone, committer, revprops, revision_id,
398
def export_revision(self, can_use_custom_revprops, branch_root, timestamp, timezone, committer, revprops, revision_id,
365
399
revno, merges, fileprops):
366
(_, fileprops) = self.fileprops.export_revision(branch_root, timestamp, timezone, committer,
400
(_, fileprops) = self.fileprops.export_revision(can_use_custom_revprops, branch_root, timestamp, timezone, committer,
367
401
revprops, revision_id, revno, merges, fileprops)
368
(revprops, _) = self.revprops.export_revision(branch_root, timestamp, timezone, committer,
402
(revprops, _) = self.revprops.export_revision(can_use_custom_revprops, branch_root, timestamp, timezone, committer,
369
403
revprops, revision_id, revno, merges, fileprops)
370
404
return (revprops, fileprops)
372
def export_fileid_map(self, fileids, revprops, fileprops):
373
self.fileprops.export_fileid_map(fileids, revprops, fileprops)
374
self.revprops.export_fileid_map(fileids, revprops, fileprops)
406
def export_fileid_map(self, can_use_custom_revprops, fileids, revprops, fileprops):
407
self.fileprops.export_fileid_map(can_use_custom_revprops, fileids, revprops, fileprops)
408
self.revprops.export_fileid_map(can_use_custom_revprops, fileids, revprops, fileprops)
376
def export_text_parents(self, text_parents, revprops, fileprops):
377
self.fileprops.export_text_parents(text_parents, revprops, fileprops)
378
self.revprops.export_text_parents(text_parents, revprops, fileprops)
410
def export_text_parents(self, can_use_custom_revprops, text_parents, revprops, fileprops):
411
self.fileprops.export_text_parents(can_use_custom_revprops, text_parents, revprops, fileprops)
412
self.revprops.export_text_parents(can_use_custom_revprops, text_parents, revprops, fileprops)
380
414
def import_revision(self, svn_revprops, fileprops, uuid, branch, revnum, rev):
381
415
self.fileprops.import_revision(svn_revprops, fileprops, uuid, branch, revnum, rev)