~maxb/bzr-svn/fetch-svn-rev-info-progress-bar

« back to all changes in this revision

Viewing changes to revmeta.py

  • Committer: Max Bowsher
  • Date: 2010-07-30 22:50:54 UTC
  • mfrom: (3324.1.37 trunk)
  • Revision ID: maxb@f2s.com-20100730225054-un1llcngdofg585w
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    imap,
31
31
    )
32
32
from subvertpy import (
 
33
    NODE_DIR,
33
34
    properties,
34
35
    )
35
36
 
109
110
    from other known data before contacting the Subversions server.
110
111
    """
111
112
 
 
113
    __slots__ = ('repository', 'check_revprops', '_get_fileprops_fn',
 
114
                 '_log', 'branch_path', '_paths', 'revnum', '_revprops',
 
115
                 '_changed_fileprops', '_fileprops',
 
116
                 '_direct_lhs_parent_known', '_consider_bzr_fileprops',
 
117
                 '_consider_bzr_revprops', '_estimated_fileprop_ancestors',
 
118
                 'metaiterators', 'uuid', 'children',
 
119
                 '_direct_lhs_parent_revmeta', '_revprop_redirect_revnum')
 
120
 
112
121
    def __init__(self, repository, check_revprops, get_fileprops_fn, logwalker,
113
122
                 uuid, branch_path, revnum, paths, revprops,
114
123
                 changed_fileprops=None, fileprops=None,
311
320
                return self._direct_lhs_parent_revmeta
312
321
            except MetaHistoryIncomplete:
313
322
                pass
314
 
        iterator = self.repository._revmeta_provider.iter_reverse_branch_changes(self.branch_path,
315
 
            self.revnum, to_revnum=0, limit=0)
 
323
        iterator = self.repository._revmeta_provider.iter_reverse_branch_changes(
 
324
                self.branch_path, self.revnum, to_revnum=0, limit=0)
316
325
        firstrevmeta = iterator.next()
317
326
        assert self == firstrevmeta, "Expected %r got %r" % (self, firstrevmeta)
318
327
        try:
550
559
    def get_rhs_parents(self, mapping):
551
560
        """Determine the right hand side parent ids for this revision.
552
561
 
553
 
        :param mapping: 
 
562
        :param mapping:
554
563
        """
555
564
        return self._get_rhs_parents(mapping)
556
565
 
797
806
class CachingRevisionMetadata(RevisionMetadata):
798
807
    """Wrapper around RevisionMetadata that stores some results in a cache."""
799
808
 
 
809
    __slots__ = ('base', '_revid_cache', '_revinfo_cache', '_revision_info',
 
810
                 '_original_mapping', '_original_mapping_set',
 
811
                 '_stored_lhs_parent_revid', '_parents_cache', 'paths')
 
812
 
800
813
    def __init__(self, repository, *args, **kwargs):
801
814
        self.base = super(CachingRevisionMetadata, self)
802
815
        self.base.__init__(repository, *args,
915
928
class RevisionMetadataBranch(object):
916
929
    """Describes a Bazaar-like branch in a Subversion repository."""
917
930
 
 
931
    __slots__ = ('_revs', '_revnums', '_history_limit', '_revmeta_provider',
 
932
                 '_get_next')
 
933
 
918
934
    def __init__(self, revmeta_provider=None, history_limit=None):
919
935
        self._revs = []
920
936
        self._revnums = []
1138
1154
            deletes = []
1139
1155
 
1140
1156
            if paths == {}:
1141
 
                paths = {"": ("M", None, -1)}
 
1157
                paths = {"": ("M", None, -1, NODE_DIR)}
1142
1158
 
1143
1159
            # Find out what branches have changed
1144
1160
            for p in sorted(paths):
1183
1199
                yield "revision", revmeta
1184
1200
 
1185
1201
            # Apply reverse renames and the like for the next round
1186
 
            for new_name, old_name, old_rev in changes.apply_reverse_changes(
 
1202
            for new_name, old_name, old_rev, kind in changes.apply_reverse_changes(
1187
1203
                self._ancestors.keys(), paths):
1188
1204
                self._unusual.discard(new_name)
1189
1205
                if old_name is None:
1203
1219
 
1204
1220
            # Update the prefixes, if necessary
1205
1221
            if self._prefixes:
1206
 
                for new_name, old_name, old_rev in changes.apply_reverse_changes(
 
1222
                for new_name, old_name, old_rev, kind in changes.apply_reverse_changes(
1207
1223
                    self._prefixes, paths):
1208
1224
                    if old_name is None:
1209
1225
                        # Didn't exist previously, terminate prefix
1298
1314
        if self.in_cache(path, revnum):
1299
1315
            cached = self._revmeta_cache[path,revnum]
1300
1316
            if changes is not None:
1301
 
                cached.paths = changes
 
1317
                cached._paths = changes
1302
1318
            if cached._changed_fileprops is None:
1303
1319
                cached._changed_fileprops = changed_fileprops
1304
1320
            if cached._fileprops is None: