Merge lp:~maxb/bzr-svn/638697 into lp:bzr-svn/1.0

Proposed by Max Bowsher
Status: Merged
Merged at revision: 3469
Proposed branch: lp:~maxb/bzr-svn/638697
Merge into: lp:bzr-svn/1.0
Diff against target: 36 lines (+16/-0)
2 files modified
fetch.py (+2/-0)
tests/test_fetch.py (+14/-0)
To merge this branch: bzr merge lp:~maxb/bzr-svn/638697
Reviewer Review Type Date Requested Status
bzr-svn developers Pending
Review via email: mp+35573@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Max Bowsher (maxb) wrote :

This is the essence of the fix - I have one uncertainty, which is whether I need to add .encode("utf-8") to ie.symlink_target here.

lp:~maxb/bzr-svn/638697 updated
3469. By Max Bowsher

ie.symlink_target is unicode, file data should be a bytestring.

Revision history for this message
Max Bowsher (maxb) wrote :

> This is the essence of the fix - I have one uncertainty, which is whether I
> need to add .encode("utf-8") to ie.symlink_target here.

I do need to. Done.

lp:~maxb/bzr-svn/638697 updated
3470. By Max Bowsher

Add a test.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'fetch.py'
2--- fetch.py 2010-09-01 00:35:18 +0000
3+++ fetch.py 2010-09-15 21:50:56 +0000
4@@ -793,6 +793,8 @@
5 return inv[file_id]
6
7 def _get_chunked(self, ie):
8+ if ie.kind == 'symlink':
9+ return ("link ", ie.symlink_target.encode("utf-8"))
10 key = (ie.file_id, ie.revision)
11 file_data = self._text_cache.get(key)
12 if file_data is not None:
13
14=== modified file 'tests/test_fetch.py'
15--- tests/test_fetch.py 2010-08-29 18:17:01 +0000
16+++ tests/test_fetch.py 2010-09-15 21:50:56 +0000
17@@ -1827,6 +1827,20 @@
18 oldrepos.generate_revision_id(2, "", mapping))
19 self.assertEqual('file', inv1[inv1.path2id("mylink")].kind)
20
21+ # Now test the same thing again as two separate copy_content calls, to
22+ # check it also works if the symlink's "text" is not in the fetch
23+ # text_cache.
24+ dir2 = BzrDir.create("f2")
25+ newrepos2 = dir2.create_repository()
26+ self.copy_content(oldrepos, newrepos2,
27+ oldrepos.generate_revision_id(1, "", mapping))
28+ self.copy_content(oldrepos, newrepos2)
29+ self.assertTrue(newrepos2.has_revision(
30+ oldrepos.generate_revision_id(2, "", mapping)))
31+ inv2 = newrepos2.get_inventory(
32+ oldrepos.generate_revision_id(2, "", mapping))
33+ self.assertEqual('file', inv2[inv2.path2id("mylink")].kind)
34+
35 def test_fetch_special_becomes_symlink(self):
36 repos_url = self.make_repository('d')
37

Subscribers

People subscribed via source and target branches