~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: John Arbash Meinel
  • Date: 2012-09-19 07:58:27 UTC
  • mfrom: (6437.63.9 2.5)
  • mto: This revision was merged to the branch mainline in revision 6563.
  • Revision ID: john@arbash-meinel.com-20120919075827-36b2b042kiaps0d3
Merge bzr-2.5.2 into trunk to get the fixes for ConnectionReset.

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
1693
1693
    def supports_views(self):
1694
1694
        return True
1695
1695
 
 
1696
    def _get_matchingbzrdir(self):
 
1697
        """Overrideable method to get a bzrdir for testing."""
 
1698
        # We use 'development-subtree' instead of '2a', because we have a
 
1699
        # few tests that want to test tree references
 
1700
        return bzrdir.format_registry.make_bzrdir('development-subtree')
 
1701
 
1696
1702
 
1697
1703
class DirStateRevisionTree(InventoryTree):
1698
1704
    """A revision tree pulling the inventory from a dirstate.
1901
1907
        return inv[inv_file_id].text_size
1902
1908
 
1903
1909
    def get_file_text(self, file_id, path=None):
1904
 
        _, content = list(self.iter_files_bytes([(file_id, None)]))[0]
1905
 
        return ''.join(content)
 
1910
        content = None
 
1911
        for _, content_iter in self.iter_files_bytes([(file_id, None)]):
 
1912
            if content is not None:
 
1913
                raise AssertionError('iter_files_bytes returned'
 
1914
                    ' too many entries')
 
1915
            # For each entry returned by iter_files_bytes, we must consume the
 
1916
            # content_iter before we step the files iterator.
 
1917
            content = ''.join(content_iter)
 
1918
        if content is None:
 
1919
            raise AssertionError('iter_files_bytes did not return'
 
1920
                ' the requested data')
 
1921
        return content
1906
1922
 
1907
1923
    def get_reference_revision(self, file_id, path=None):
1908
1924
        inv, inv_file_id = self._unpack_file_id(file_id)