Merge lp:~mbp/bzr/192859-2.0-symlinks-add into lp:bzr/2.0

Proposed by Martin Pool
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: 4755
Proposed branch: lp:~mbp/bzr/192859-2.0-symlinks-add
Merge into: lp:bzr/2.0
Prerequisite: lp:~mbp/bzr/192859-2.0-symlinks
Diff against target: 59 lines (+28/-0)
3 files modified
NEWS (+5/-0)
bzrlib/mutabletree.py (+4/-0)
bzrlib/tests/per_workingtree/test_symlinks.py (+19/-0)
To merge this branch: bzr merge lp:~mbp/bzr/192859-2.0-symlinks-add
Reviewer Review Type Date Requested Status
bzr-core Pending
Review via email: mp+30183@code.launchpad.net

Commit message

``bzr add SYMLINK/FILE`` now works properly when the symlink points to a previously-unversioned directory within the tree: the directory is marked versioned too.

Description of the change

This fixes the symlink handling problem of <https://bugs.edge.launchpad.net/bzr/+bug/192859/comments/3> - the test is pretty self-explanatory.

To post a comment you must log in.
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
=== modified file 'NEWS'
--- NEWS 2010-07-17 17:19:40 +0000
+++ NEWS 2010-07-17 17:19:40 +0000
@@ -18,6 +18,11 @@
18 history no longer crash when deleted files are involved.18 history no longer crash when deleted files are involved.
19 (Vincent Ladeuil, John Arbash Meinel, #375898)19 (Vincent Ladeuil, John Arbash Meinel, #375898)
2020
21* ``bzr add SYMLINK/FILE`` now works properly when the symlink points to a
22 previously-unversioned directory within the tree: the directory is
23 marked versioned too.
24 (Martin Pool, #192859)
25
21* ``bzr commit SYMLINK`` now works, rather than trying to commit the26* ``bzr commit SYMLINK`` now works, rather than trying to commit the
22 target of the symlink.27 target of the symlink.
23 (Martin Pool, John Arbash Meinel, #128562)28 (Martin Pool, John Arbash Meinel, #128562)
2429
=== modified file 'bzrlib/mutabletree.py'
--- bzrlib/mutabletree.py 2010-07-17 17:19:40 +0000
+++ bzrlib/mutabletree.py 2010-07-17 17:19:40 +0000
@@ -389,6 +389,10 @@
389 dirs_to_add = []389 dirs_to_add = []
390 user_dirs = set()390 user_dirs = set()
391391
392 # expand any symlinks in the directory part, while leaving the
393 # filename alone
394 file_list = map(osutils.normalizepath, file_list)
395
392 # validate user file paths and convert all paths to tree396 # validate user file paths and convert all paths to tree
393 # relative : it's cheaper to make a tree relative path an abspath397 # relative : it's cheaper to make a tree relative path an abspath
394 # than to convert an abspath to tree relative, and it's cheaper to398 # than to convert an abspath to tree relative, and it's cheaper to
395399
=== modified file 'bzrlib/tests/per_workingtree/test_symlinks.py'
--- bzrlib/tests/per_workingtree/test_symlinks.py 2010-07-17 17:19:40 +0000
+++ bzrlib/tests/per_workingtree/test_symlinks.py 2010-07-17 17:19:40 +0000
@@ -55,6 +55,25 @@
55 self.assertEqual('symlink',55 self.assertEqual('symlink',
56 tree.kind(tree.path2id('link')))56 tree.kind(tree.path2id('link')))
5757
58 def test_add_file_under_symlink(self):
59 # similar to
60 # https://bugs.launchpad.net/bzr/+bug/192859/comments/3
61 tree = self.make_branch_and_tree('tree')
62 self.build_tree_contents([
63 ('tree/link@', 'dir'),
64 ('tree/dir/',),
65 ('tree/dir/file', 'content'),
66 ])
67 self.assertEquals(
68 tree.smart_add(['tree/link/file']),
69 ([u'dir', u'dir/file'], {}))
70 # should add the actual parent directory, not the apparent parent
71 # (which is actually a symlink)
72 self.assertTrue(tree.path2id('dir/file'))
73 self.assertTrue(tree.path2id('dir'))
74 self.assertIs(None, tree.path2id('link'))
75 self.assertIs(None, tree.path2id('link/file'))
76
5877
59class TestKindChanges(TestCaseWithWorkingTree):78class TestKindChanges(TestCaseWithWorkingTree):
6079

Subscribers

People subscribed via source and target branches