Merge lp:~jameinel/bzr/2.5-merges-2.4 into lp:bzr/2.5

Proposed by John A Meinel
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: 6515
Proposed branch: lp:~jameinel/bzr/2.5-merges-2.4
Merge into: lp:bzr/2.5
Diff against target: 200 lines (+82/-19)
5 files modified
bzrlib/dirstate.py (+12/-3)
bzrlib/tests/blackbox/test_uncommit.py (+17/-0)
bzrlib/tests/per_workingtree/test_parents.py (+18/-3)
bzrlib/tests/test_dirstate.py (+14/-2)
doc/en/release-notes/bzr-2.4.txt (+21/-11)
To merge this branch: bzr merge lp:~jameinel/bzr/2.5-merges-2.4
Reviewer Review Type Date Requested Status
bzr-core Pending
Review via email: mp+166489@code.launchpad.net

Commit message

Merge 2.4 into 2.5, bringing in the fix for bug #855155 (Dirstate.update_basis_by_delta)

Description of the change

Just bringing in the last patches from 2.4.

2.4 now has the connection reset logic that 2.5 already had. So it involved a small amount of ignoring the 2.4 changes because the conflict needlessly. (It was backported, and then brought forward, and 2.5 has iterated into new changes since then, so 2.5 should be the canonical representation of the connection reset logic anyway.)

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

sent to pqm by email

Revision history for this message
John A Meinel (jameinel) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/dirstate.py'
2--- bzrlib/dirstate.py 2013-05-23 09:27:10 +0000
3+++ bzrlib/dirstate.py 2013-05-30 12:26:34 +0000
4@@ -1648,9 +1648,18 @@
5 entry_key = st(dirname, basename, file_id)
6 block_index, present = self._find_block_index_from_key(entry_key)
7 if not present:
8- self._raise_invalid(new_path, file_id,
9- "Unable to find block for this record."
10- " Was the parent added?")
11+ # The block where we want to put the file is not present.
12+ # However, it might have just been an empty directory. Look for
13+ # the parent in the basis-so-far before throwing an error.
14+ parent_dir, parent_base = osutils.split(dirname)
15+ parent_block_idx, parent_entry_idx, _, parent_present = \
16+ self._get_block_entry_index(parent_dir, parent_base, 1)
17+ if not parent_present:
18+ self._raise_invalid(new_path, file_id,
19+ "Unable to find block for this record."
20+ " Was the parent added?")
21+ self._ensure_block(parent_block_idx, parent_entry_idx, dirname)
22+
23 block = self._dirblocks[block_index][1]
24 entry_index, present = self._find_entry_index(entry_key, block)
25 if real_add:
26
27=== modified file 'bzrlib/tests/blackbox/test_uncommit.py'
28--- bzrlib/tests/blackbox/test_uncommit.py 2011-12-14 20:21:52 +0000
29+++ bzrlib/tests/blackbox/test_uncommit.py 2013-05-30 12:26:34 +0000
30@@ -314,3 +314,20 @@
31 self.assertLength(14, self.hpss_calls)
32 self.assertLength(1, self.hpss_connections)
33 self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
34+
35+
36+class TestInconsistentDelta(TestCaseWithTransport):
37+ # See https://bugs.launchpad.net/bzr/+bug/855155
38+ # See https://bugs.launchpad.net/bzr/+bug/1100385
39+ # bzr uncommit may result in error
40+ # 'An inconsistent delta was supplied involving'
41+
42+ def test_inconsistent_delta(self):
43+ # Script taken from https://bugs.launchpad.net/bzr/+bug/855155/comments/26
44+ wt = self.make_branch_and_tree('test')
45+ self.build_tree(['test/a/', 'test/a/b', 'test/a/c'])
46+ wt.add(['a', 'a/b', 'a/c'])
47+ wt.commit('initial commit', rev_id='a1')
48+ wt.remove(['a/b', 'a/c'])
49+ wt.commit('remove b and c', rev_id='a2')
50+ self.run_bzr("uncommit --force test")
51
52=== modified file 'bzrlib/tests/per_workingtree/test_parents.py'
53--- bzrlib/tests/per_workingtree/test_parents.py 2012-09-06 09:00:45 +0000
54+++ bzrlib/tests/per_workingtree/test_parents.py 2013-05-30 12:26:34 +0000
55@@ -450,7 +450,7 @@
56 self.add_dir(new_shape, new_revid, 'root-id', None, '')
57
58 def assertTransitionFromBasisToShape(self, basis_shape, basis_revid,
59- new_shape, new_revid, extra_parent=None):
60+ new_shape, new_revid, extra_parent=None, set_current_inventory=True):
61 # set the inventory revision ids.
62 basis_shape.revision_id = basis_revid
63 new_shape.revision_id = new_revid
64@@ -465,8 +465,9 @@
65 parents.append(extra_parent)
66 tree.set_parent_ids(parents)
67 self.fake_up_revision(tree, new_revid, new_shape)
68- # give tree an inventory of new_shape
69- tree._write_inventory(new_shape)
70+ if set_current_inventory:
71+ # give tree an inventory of new_shape
72+ tree._write_inventory(new_shape)
73 self.assertDeltaApplicationResultsInExpectedBasis(tree, new_revid,
74 delta, new_shape)
75 # The tree should be internally consistent; while this is a moderately
76@@ -764,3 +765,17 @@
77 self.add_link(new_shape, old_revid, 'link-id-C', 'dir-id-B', 'C', 'D')
78 self.assertTransitionFromBasisToShape(basis_shape, old_revid,
79 new_shape, new_revid)
80+
81+ def test_add_files_to_empty_directory(self):
82+ old_revid = 'old-parent'
83+ basis_shape = Inventory(root_id=None)
84+ self.add_dir(basis_shape, old_revid, 'root-id', None, '')
85+ self.add_dir(basis_shape, old_revid, 'dir-id-A', 'root-id', 'A')
86+ new_revid = 'new-parent'
87+ new_shape = Inventory(root_id=None)
88+ self.add_new_root(new_shape, old_revid, new_revid)
89+ self.add_dir(new_shape, old_revid, 'dir-id-A', 'root-id', 'A')
90+ self.add_file(new_shape, new_revid, 'file-id-B', 'dir-id-A', 'B',
91+ '1' * 32, 24)
92+ self.assertTransitionFromBasisToShape(basis_shape, old_revid,
93+ new_shape, new_revid, set_current_inventory=False)
94
95=== modified file 'bzrlib/tests/test_dirstate.py'
96--- bzrlib/tests/test_dirstate.py 2011-06-14 01:26:41 +0000
97+++ bzrlib/tests/test_dirstate.py 2013-05-30 12:26:34 +0000
98@@ -2480,7 +2480,12 @@
99 def create_tree_from_shape(self, rev_id, shape):
100 dir_ids = {'': 'root-id'}
101 inv = inventory.Inventory('root-id', rev_id)
102- for path, file_id in shape:
103+ for info in shape:
104+ if len(info) == 2:
105+ path, file_id = info
106+ ie_rev_id = rev_id
107+ else:
108+ path, file_id, ie_rev_id = info
109 if path == '':
110 # Replace the root entry
111 del inv._byid[inv.root.file_id]
112@@ -2488,7 +2493,7 @@
113 inv._byid[file_id] = inv.root
114 dir_ids[''] = file_id
115 continue
116- inv.add(self.path_to_ie(path, file_id, rev_id, dir_ids))
117+ inv.add(self.path_to_ie(path, file_id, ie_rev_id, dir_ids))
118 return revisiontree.InventoryRevisionTree(_Repo(), inv, rev_id)
119
120 def create_empty_dirstate(self):
121@@ -2616,6 +2621,13 @@
122 target=[('file', 'file-id')],
123 )
124
125+ def test_add_file_in_empty_dir_not_matching_active_state(self):
126+ state = self.assertUpdate(
127+ active=[],
128+ basis=[('dir/', 'dir-id')],
129+ target=[('dir/', 'dir-id', 'basis'), ('dir/file', 'file-id')],
130+ )
131+
132 def test_add_file_missing_in_active_state(self):
133 state = self.assertUpdate(
134 active=[],
135
136=== modified file 'doc/en/release-notes/bzr-2.4.txt'
137--- doc/en/release-notes/bzr-2.4.txt 2013-05-23 09:27:10 +0000
138+++ doc/en/release-notes/bzr-2.4.txt 2013-05-30 12:26:34 +0000
139@@ -35,22 +35,20 @@
140 * Cope with Unix filesystems, such as smbfs, where chmod gives 'permission
141 denied'. (Martin Pool, #606537)
142
143-* Fix a traceback when trying to checkout a tree that also has an entry
144- with file-id `TREE_ROOT` somewhere other than at the root directory.
145- (John Arbash Meinel, #830947)
146-
147-* When the ``limbo`` or ``pending-deletion`` directories exist, typically
148- because of an interrupted tree update, but are empty, bzr no longer
149- errors out, because there is nothing for the user to clean up. Also,
150- errors in creation of these directories are no longer squelched.
151- (Martin Pool, #427773)
152-
153 * During merges, when two entries end up using the same path for two
154 different file-ids (the same file being 'bzr added' in two different
155 branches) , 'duplicate' conflicts are created instead of 'content'
156 ones. This was previously leading to a 'Malformed tramsform' exception.
157 (Vincent Ladeuil, #880701)
158
159+* Fix a traceback when trying to checkout a tree that also has an entry
160+ with file-id `TREE_ROOT` somewhere other than at the root directory.
161+ (John Arbash Meinel, #830947)
162+
163+* Handle when an uncommit/update tries to add a file to an otherwise empty
164+ directory. The ``Dirstate.update_basis_by_delta`` would end up
165+ incorrectly flagging the delta as invalid. (Brian de Alwis, #855155)
166+
167 * 'Malformed transform' exceptions are now recognized as internal errors
168 instead of user errors and report a traceback. This will reduce user
169 confusion as there is generally nothing users can do about them.
170@@ -63,10 +61,22 @@
171 This shouldn't be treated as a fatal error.
172 (John Arbash Meinel, #1075108)
173
174+* Teach the bzr client how to reconnect if we get ``ConnectionReset``
175+ while making an RPC request. This doesn't handle all possible network
176+ disconnects, but it should at least handle when the server is asked to
177+ shutdown gracefully. This is a backport of the functionality in bzr-2.5.
178+ (John Arbash Meinel, #819604)
179+
180 * Use ``encoding_type='exact'`` for ``bzr testament`` so that on Windows
181 the sha hash of the long testament matches the sha hash in the short
182 form. (John Arbash Meinel, #1010339)
183
184+* When the ``limbo`` or ``pending-deletion`` directories exist, typically
185+ because of an interrupted tree update, but are empty, bzr no longer
186+ errors out, because there is nothing for the user to clean up. Also,
187+ errors in creation of these directories are no longer squelched.
188+ (Martin Pool, #427773)
189+
190 * _Win32Stat object provides members st_uid and st_gid, those are present
191 in Python's os.stat object. These members required for external tools like
192 bzr-git and dulwich. (Alexander Belchenko, #967060)
193@@ -144,7 +154,7 @@
194 * Return early from create_delta_index_from_delta given tiny inputs. This
195 avoids raising a spurious MemoryError on certain platforms such as AIX.
196 (John Arbash Meinel, #856731)
197-
198+
199 Documentation
200 *************
201

Subscribers

People subscribed via source and target branches