/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 option for enabling experimental stuff

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
    
91
91
    * inv-cache - number of inventories to cache.
92
92
      If not set, the default is 10.
 
93
 
 
94
    * experimental - enable experimental mode, i.e. use features
 
95
      not yet fully tested.
93
96
    """
94
97
 
95
 
    known_params = ['info', 'trees', 'checkpoint', 'count', 'inv-cache']
 
98
    known_params = [
 
99
        'info',
 
100
        'trees',
 
101
        'checkpoint',
 
102
        'count',
 
103
        'inv-cache',
 
104
        'experimental',
 
105
        ]
96
106
 
97
107
    def note(self, msg, *args):
98
108
        """Output a note but timestamp it."""
128
138
        inv_vf.enable_cache()
129
139
 
130
140
    def _load_info_and_params(self):
 
141
        self._experimental = self.params.get('experimental', False)
 
142
 
131
143
        # Load the info file, if any
132
144
        info_path = self.params.get('info')
133
145
        if info_path is not None:
273
285
        """Process a CommitCommand."""
274
286
        # 'Commit' the revision
275
287
        handler = GenericCommitHandler(cmd, self.repo, self.cache_mgr,
276
 
            self.verbose)
 
288
            self.verbose, self._experimental)
277
289
        handler.process()
278
290
 
279
291
        # Update caches
373
385
        self.inv_parent_texts = lru_cache.LRUCache(inventory_cache_size)
374
386
 
375
387
        # Work out the blobs to make sticky - None means all
376
 
        #print "%r" % (info,)
377
388
        self._blobs_to_keep = None
378
389
        if info is not None:
379
390
            try:
413
424
 
414
425
class GenericCommitHandler(processor.CommitHandler):
415
426
 
416
 
    def __init__(self, command, repo, cache_mgr, verbose=False):
 
427
    def __init__(self, command, repo, cache_mgr, verbose=False,
 
428
        _experimental=False):
417
429
        processor.CommitHandler.__init__(self, command)
418
430
        self.repo = repo
419
431
        self.cache_mgr = cache_mgr
420
432
        self.verbose = verbose
 
433
        self._experimental = _experimental
421
434
        # smart loader that uses these caches
422
435
        self.loader = revisionloader.ImportRevisionLoader(repo,
423
436
            lambda revision_ids: self._get_inventories(revision_ids),
475
488
            self.inventory = self.gen_initial_inventory()
476
489
        else:
477
490
            # use the bzr_revision_id to lookup the inv cache
478
 
            self.inventory = self.get_inventory_copy(self.parents[0])
 
491
            inv = self.get_inventory(self.parents[0])
 
492
            # TODO: Shallow copy - deep inventory copying is expensive
 
493
            self.inventory = inv.copy()
479
494
        if not self.repo.supports_rich_root():
480
495
            # In this repository, root entries have no knit or weave. When
481
496
            # serializing out to disk and back in, root.revision is always
485
500
        # directory-path -> inventory-entry for current inventory
486
501
        self.directory_entries = dict(self.inventory.directories())
487
502
 
488
 
    def get_inventory_copy(self, rev_id):
489
 
        inv = self.get_inventory(rev_id)
490
 
        return inv.copy()
491
 
 
492
503
    def post_process_files(self):
493
504
        """Save the revision."""
494
505
        self.inventory.apply_delta(self.inv_delta)
541
552
        path = filecmd.path
542
553
        try:
543
554
            del self.inventory[self.bzr_file_id(path)]
 
555
        except KeyError:
 
556
            self.warning("ignoring delete of %s as not in inventory", path)
544
557
        except errors.NoSuchId:
545
558
            self.warning("ignoring delete of %s as not in inventory", path)
546
559
        try:
691
704
        # There are no lines stored for a directory so
692
705
        # make sure the cache used by get_lines knows that
693
706
        self.lines_for_commit[dir_file_id] = []
694
 
        #print "adding dir %s" % path
 
707
        #print "adding dir for %s" % path
695
708
        self.inventory.add(ie)
696
709
        return basename, ie
697
710