~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: John Arbash Meinel
  • Date: 2013-05-19 14:29:37 UTC
  • mfrom: (6437.63.9 2.5)
  • mto: (6437.63.10 2.5)
  • mto: This revision was merged to the branch mainline in revision 6575.
  • Revision ID: john@arbash-meinel.com-20130519142937-21ykz2n2y2f22za9
Merge in the actual 2.5 branch. It seems I failed before

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2011 Canonical Ltd
 
1
# Copyright (C) 2007-2012 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
1677
1677
    def supports_views(self):
1678
1678
        return True
1679
1679
 
 
1680
    def _get_matchingbzrdir(self):
 
1681
        """Overrideable method to get a bzrdir for testing."""
 
1682
        # We use 'development-subtree' instead of '2a', because we have a
 
1683
        # few tests that want to test tree references
 
1684
        return bzrdir.format_registry.make_bzrdir('development-subtree')
 
1685
 
1680
1686
 
1681
1687
class DirStateRevisionTree(InventoryTree):
1682
1688
    """A revision tree pulling the inventory from a dirstate.
1882
1888
        return self.inventory[file_id].text_size
1883
1889
 
1884
1890
    def get_file_text(self, file_id, path=None):
1885
 
        _, content = list(self.iter_files_bytes([(file_id, None)]))[0]
1886
 
        return ''.join(content)
 
1891
        content = None
 
1892
        for _, content_iter in self.iter_files_bytes([(file_id, None)]):
 
1893
            if content is not None:
 
1894
                raise AssertionError('iter_files_bytes returned'
 
1895
                    ' too many entries')
 
1896
            # For each entry returned by iter_files_bytes, we must consume the
 
1897
            # content_iter before we step the files iterator.
 
1898
            content = ''.join(content_iter)
 
1899
        if content is None:
 
1900
            raise AssertionError('iter_files_bytes did not return'
 
1901
                ' the requested data')
 
1902
        return content
1887
1903
 
1888
1904
    def get_reference_revision(self, file_id, path=None):
1889
1905
        return self.inventory[file_id].reference_revision