Merge lp:~jameinel/bzr/2.5.2-get_file_text-1046284 into lp:bzr/2.5

Proposed by John A Meinel
Status: Merged
Merged at revision: 6509
Proposed branch: lp:~jameinel/bzr/2.5.2-get_file_text-1046284
Merge into: lp:bzr/2.5
Diff against target: 46 lines (+18/-3)
2 files modified
bzrlib/workingtree_4.py (+14/-3)
doc/en/release-notes/bzr-2.5.txt (+4/-0)
To merge this branch: bzr merge lp:~jameinel/bzr/2.5.2-get_file_text-1046284
Reviewer Review Type Date Requested Status
bzr-core Pending
Review via email: mp+123020@code.launchpad.net

Commit message

Fix bug #1046284. When iterating over iter_files_bytes, we should consume the content iterator before we proceed with the files iterator.

Description of the change

This is a quick fix for bug #1046284. It fixes get_file_text so that it consumes the content iterator before it consumes the outer iterator.

I don't have a specific test for it, because I'm working on bug #1046697 which has a bit bigger scope.

I'll see if I can get that branch up and working quickly for bzr-2.5 before we release bzr-2.5.2, but I don't think we have to block on getting all that working, rather than getting a fix out for users.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/workingtree_4.py'
--- bzrlib/workingtree_4.py 2012-01-06 14:09:04 +0000
+++ bzrlib/workingtree_4.py 2012-09-06 07:40:24 +0000
@@ -1,4 +1,4 @@
1# Copyright (C) 2007-2011 Canonical Ltd1# Copyright (C) 2007-2012 Canonical Ltd
2#2#
3# This program is free software; you can redistribute it and/or modify3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by4# it under the terms of the GNU General Public License as published by
@@ -1882,8 +1882,19 @@
1882 return self.inventory[file_id].text_size1882 return self.inventory[file_id].text_size
18831883
1884 def get_file_text(self, file_id, path=None):1884 def get_file_text(self, file_id, path=None):
1885 _, content = list(self.iter_files_bytes([(file_id, None)]))[0]1885 full_content = None
1886 return ''.join(content)1886 for _, content in self.iter_files_bytes([(file_id, None)]):
1887 if full_content is not None:
1888 raise AssertionError('iter_files_bytes returned'
1889 ' too many entries')
1890 # For each entry returned by iter_files_bytes, we must consume the
1891 # content before we step the iterator.
1892 full_content = ''.join(content)
1893 del content
1894 if full_content is None:
1895 raise AssertionError('iter_files_bytes did not return'
1896 ' the requested data')
1897 return full_content
18871898
1888 def get_reference_revision(self, file_id, path=None):1899 def get_reference_revision(self, file_id, path=None):
1889 return self.inventory[file_id].reference_revision1900 return self.inventory[file_id].reference_revision
18901901
=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- doc/en/release-notes/bzr-2.5.txt 2012-08-01 08:51:57 +0000
+++ doc/en/release-notes/bzr-2.5.txt 2012-09-06 07:40:24 +0000
@@ -35,6 +35,10 @@
35* ``bzr config`` properly handles aliases and references in the35* ``bzr config`` properly handles aliases and references in the
36 ``--directory`` parameter (Vincent Ladeuil, Wouter van Heyst, #947049)36 ``--directory`` parameter (Vincent Ladeuil, Wouter van Heyst, #947049)
3737
38* Lightweight checkouts of remote repositories had a bug with how they
39 extracted texts from the repository. (Just an ordering constraint on how
40 they consumed the stream.) (John Arbash Meinel, #1046284)
41
38* Revert use of --no-tty when gpg signing commits. (Jelmer Vernooij, #1014570)42* Revert use of --no-tty when gpg signing commits. (Jelmer Vernooij, #1014570)
3943
40Documentation44Documentation

Subscribers

People subscribed via source and target branches