/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/mutabletree.py

  • Committer: Martin Pool
  • Date: 2009-06-05 23:21:51 UTC
  • mfrom: (4415 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4416.
  • Revision ID: mbp@sourcefrog.net-20090605232151-luwmyyl95siraqyz
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""MutableTree object.
18
18
 
232
232
        """Helper function for add - sets the entries of kinds."""
233
233
        raise NotImplementedError(self._gather_kinds)
234
234
 
235
 
    def get_file_with_stat(self, file_id, path=None):
236
 
        """Get a file handle and stat object for file_id.
237
 
 
238
 
        The default implementation returns (self.get_file, None) for backwards
239
 
        compatibility.
240
 
 
241
 
        :param file_id: The file id to read.
242
 
        :param path: The path of the file, if it is known.
243
 
        :return: A tuple (file_handle, stat_value_or_None). If the tree has
244
 
            no stat facility, or need for a stat cache feedback during commit,
245
 
            it may return None for the second element of the tuple.
246
 
        """
247
 
        return (self.get_file(file_id, path), None)
248
 
 
249
235
    @needs_read_lock
250
236
    def last_revision(self):
251
237
        """Return the revision id of the last commit performed in this tree.
552
538
        # WorkingTree classes for optimised versions for specific format trees.
553
539
        basis = self.basis_tree()
554
540
        basis.lock_read()
555
 
        inventory = basis.inventory
 
541
        # TODO: Consider re-evaluating the need for this with CHKInventory
 
542
        # we don't strictly need to mutate an inventory for this
 
543
        # it only makes sense when apply_delta is cheaper than get_inventory()
 
544
        inventory = basis.inventory._get_mutable_inventory()
556
545
        basis.unlock()
557
546
        inventory.apply_delta(delta)
558
547
        rev_tree = RevisionTree(self.branch.repository, inventory, new_revid)
569
558
 
570
559
        """
571
560
        hooks.Hooks.__init__(self)
572
 
        # Invoked before a commit is done in a tree. New in 1.4
573
 
        self['start_commit'] = []
 
561
        self.create_hook(hooks.HookPoint('start_commit',
 
562
            "Called before a commit is performed on a tree. The start commit "
 
563
            "hook is able to change the tree before the commit takes place. "
 
564
            "start_commit is called with the bzrlib.tree.MutableTree that the "
 
565
            "commit is being performed on.", (1, 4), None))
574
566
 
575
567
 
576
568
# install the default hooks into the MutableTree class.