~cjwatson/bzr/bzr-2.6.0-lp-2

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: Patch Queue Manager
  • Date: 2012-09-19 08:27:25 UTC
  • mfrom: (6562.1.1 2.6-merge-up-2.5)
  • Revision ID: pqm@pqm.ubuntu.com-20120919082725-dzvmca37zj5xx2hh
(jam) Merge bzr-2.5.2-dev into bzr trunk to get the ConnectionReset
        fixes.

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)