~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Andrew Bennetts
  • Date: 2009-12-03 05:57:41 UTC
  • mfrom: (4857 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4869.
  • Revision ID: andrew.bennetts@canonical.com-20091203055741-vmmg0fmjgjw2pwvu
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
    merge,
66
66
    revision as _mod_revision,
67
67
    revisiontree,
68
 
    textui,
69
68
    trace,
70
69
    transform,
71
70
    ui,
544
543
        else:
545
544
            parents = [last_rev]
546
545
        try:
547
 
            merges_file = self._transport.get('pending-merges')
 
546
            merges_bytes = self._transport.get_bytes('pending-merges')
548
547
        except errors.NoSuchFile:
549
548
            pass
550
549
        else:
551
 
            for l in merges_file.readlines():
 
550
            for l in osutils.split_lines(merges_bytes):
552
551
                revision_id = l.rstrip('\n')
553
552
                parents.append(revision_id)
554
553
        return parents
1845
1844
    def _reset_data(self):
1846
1845
        """Reset transient data that cannot be revalidated."""
1847
1846
        self._inventory_is_modified = False
1848
 
        result = self._deserialize(self._transport.get('inventory'))
 
1847
        f = self._transport.get('inventory')
 
1848
        try:
 
1849
            result = self._deserialize(f)
 
1850
        finally:
 
1851
            f.close()
1849
1852
        self._set_inventory(result, dirty=False)
1850
1853
 
1851
1854
    @needs_tree_write_lock
1927
1930
        # binary.
1928
1931
        if self._inventory_is_modified:
1929
1932
            raise errors.InventoryModified(self)
1930
 
        result = self._deserialize(self._transport.get('inventory'))
 
1933
        f = self._transport.get('inventory')
 
1934
        try:
 
1935
            result = self._deserialize(f)
 
1936
        finally:
 
1937
            f.close()
1931
1938
        self._set_inventory(result, dirty=False)
1932
1939
        return result
1933
1940
 
1948
1955
 
1949
1956
        new_files=set()
1950
1957
        unknown_nested_files=set()
 
1958
        if to_file is None:
 
1959
            to_file = sys.stdout
1951
1960
 
1952
1961
        def recurse_directory_to_add_files(directory):
1953
1962
            # Recurse directory and add all files
2023
2032
                        new_status = 'I'
2024
2033
                    else:
2025
2034
                        new_status = '?'
2026
 
                    textui.show_status(new_status, self.kind(fid), f,
2027
 
                                       to_file=to_file)
 
2035
                    # XXX: Really should be a more abstract reporter interface
 
2036
                    kind_ch = osutils.kind_marker(self.kind(fid))
 
2037
                    to_file.write(new_status + '       ' + f + kind_ch + '\n')
2028
2038
                # Unversion file
2029
2039
                inv_delta.append((f, None, fid, None))
2030
2040
                message = "removed %s" % (f,)
2768
2778
        """Return the format for the working tree object in a_bzrdir."""
2769
2779
        try:
2770
2780
            transport = a_bzrdir.get_workingtree_transport(None)
2771
 
            format_string = transport.get("format").read()
 
2781
            format_string = transport.get_bytes("format")
2772
2782
            return klass._formats[format_string]
2773
2783
        except errors.NoSuchFile:
2774
2784
            raise errors.NoWorkingTree(base=transport.base)