/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to processors/generic_processor.py

add inv-fulltext option and improve speed

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
# How many commits before automatically checkpointing
58
58
_DEFAULT_AUTO_CHECKPOINT = 10000
59
59
 
 
60
# How many commits before each inventory fulltext
 
61
_DEFAULT_INV_FULLTEXT = 200
 
62
 
60
63
# How many inventories to cache
61
64
_DEFAULT_INV_CACHE_SIZE = 10
62
65
 
99
102
    * count - only import this many commits then exit. If not set
100
103
      or negative, all commits are imported.
101
104
    
 
105
    * inv-fulltext - create an inventory fulltext every n commits.
 
106
      The default is 200.
 
107
 
102
108
    * inv-cache - number of inventories to cache.
103
109
      If not set, the default is 10.
104
110
 
112
118
        'checkpoint',
113
119
        'count',
114
120
        'inv-cache',
 
121
        'inv-fulltext',
115
122
        'experimental',
116
123
        ]
117
124
 
152
159
 
153
160
        # Create the revision loader needed for committing
154
161
        if self._experimental:
155
 
            loader_factory = revisionloader.ExperimentalRevisionLoader
 
162
            def fulltext_when(count):
 
163
                total = self.total_commits
 
164
                if total is not None and count == total:
 
165
                    fulltext = True
 
166
                else:
 
167
                    fulltext = count % self.inv_fulltext_every == 0
 
168
                if fulltext:
 
169
                    self.note("%d commits - storing inventory as full-text",
 
170
                        count)
 
171
                return fulltext
 
172
 
 
173
            self.loader = revisionloader.ExperimentalRevisionLoader(
 
174
                self.repo, self.inventory_cache_size,
 
175
                fulltext_when=fulltext_when)
156
176
        else:
157
 
            loader_factory = revisionloader.ImportRevisionLoader
158
 
        self.loader = loader_factory(self.repo, self.inventory_cache_size)
 
177
            self.loader = revisionloader.ImportRevisionLoader(
 
178
                self.repo, self.inventory_cache_size)
159
179
 
160
180
        # Disable autopacking if the repo format supports it.
161
181
        # THIS IS A HACK - there is no sanctioned way of doing this yet.
198
218
        self.checkpoint_every = int(self.params.get('checkpoint',
199
219
            _DEFAULT_AUTO_CHECKPOINT))
200
220
 
 
221
        # Decide how often to fulltext the inventory
 
222
        self.inv_fulltext_every = int(self.params.get('inv-fulltext',
 
223
            _DEFAULT_INV_FULLTEXT))
 
224
 
201
225
        # Decide how big to make the inventory cache
202
226
        self.inventory_cache_size = int(self.params.get('inv-cache',
203
227
            _DEFAULT_INV_CACHE_SIZE))