/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 bzrlib/commit.py

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
60
60
    debug,
61
61
    errors,
62
62
    revision,
 
63
    trace,
63
64
    tree,
64
65
    )
65
66
from bzrlib.branch import Branch
77
78
                            )
78
79
from bzrlib.testament import Testament
79
80
from bzrlib.trace import mutter, note, warning, is_quiet
80
 
from bzrlib.inventory import InventoryEntry, make_entry
 
81
from bzrlib.inventory import Inventory, InventoryEntry, make_entry
81
82
from bzrlib import symbol_versioning
82
83
from bzrlib.symbol_versioning import (deprecated_passed,
83
84
        deprecated_function,
205
206
               config=None,
206
207
               message_callback=None,
207
208
               recursive='down',
208
 
               exclude=None):
 
209
               exclude=None,
 
210
               possible_master_transports=None):
209
211
        """Commit working copy as a new revision.
210
212
 
211
213
        :param message: the commit message (it or message_callback is required)
298
300
                raise ConflictsInTree
299
301
 
300
302
            # Setup the bound branch variables as needed.
301
 
            self._check_bound_branch()
 
303
            self._check_bound_branch(possible_master_transports)
302
304
 
303
305
            # Check that the working tree is up to date
304
306
            old_revno, new_revno = self._check_out_of_date_tree()
383
385
                # Add revision data to the local branch
384
386
                self.rev_id = self.builder.commit(self.message)
385
387
 
386
 
            except:
 
388
            except Exception, e:
 
389
                mutter("aborting commit write group because of exception:")
 
390
                trace.log_exception_quietly()
 
391
                note("aborting commit write group: %r" % (e,))
387
392
                self.builder.abort()
388
393
                raise
389
394
 
444
449
            return
445
450
        raise PointlessCommit()
446
451
 
447
 
    def _check_bound_branch(self):
 
452
    def _check_bound_branch(self, possible_master_transports=None):
448
453
        """Check to see if the local branch is bound.
449
454
 
450
455
        If it is bound, then most of the commit will actually be
455
460
            raise errors.LocalRequiresBoundBranch()
456
461
 
457
462
        if not self.local:
458
 
            self.master_branch = self.branch.get_master_branch()
 
463
            self.master_branch = self.branch.get_master_branch(
 
464
                possible_master_transports)
459
465
 
460
466
        if not self.master_branch:
461
467
            # make this branch the reference branch for out of date checks.
700
706
    def _report_and_accumulate_deletes(self):
701
707
        # XXX: Could the list of deleted paths and ids be instead taken from
702
708
        # _populate_from_inventory?
703
 
        deleted_ids = set(self.basis_inv._byid.keys()) - \
704
 
            set(self.builder.new_inventory._byid.keys())
 
709
        if (isinstance(self.basis_inv, Inventory)
 
710
            and isinstance(self.builder.new_inventory, Inventory)):
 
711
            # the older Inventory classes provide a _byid dict, and building a
 
712
            # set from the keys of this dict is substantially faster than even
 
713
            # getting a set of ids from the inventory
 
714
            #
 
715
            # <lifeless> set(dict) is roughly the same speed as
 
716
            # set(iter(dict)) and both are significantly slower than
 
717
            # set(dict.keys())
 
718
            deleted_ids = set(self.basis_inv._byid.keys()) - \
 
719
               set(self.builder.new_inventory._byid.keys())
 
720
        else:
 
721
            deleted_ids = set(self.basis_inv) - set(self.builder.new_inventory)
705
722
        if deleted_ids:
706
723
            self.any_entries_deleted = True
707
724
            deleted = [(self.basis_tree.id2path(file_id), file_id)