Merge lp:~jelmer/brz/host-os-dereferences-symlinks into lp:brz/3.2

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/host-os-dereferences-symlinks
Merge into: lp:brz/3.2
Diff against target: 109 lines (+19/-29)
5 files modified
breezy/diff.py (+1/-1)
breezy/osutils.py (+0/-5)
breezy/tests/test_diff.py (+1/-1)
breezy/tests/test_osutils.py (+0/-3)
breezy/transport/local.py (+17/-19)
To merge this branch: bzr merge lp:~jelmer/brz/host-os-dereferences-symlinks
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+414074@code.launchpad.net

Commit message

Remove host_os_deferences_symlinks.

Description of the change

Remove host_os_deferences_symlinks.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/diff.py'
2--- breezy/diff.py 2020-06-01 19:35:12 +0000
3+++ breezy/diff.py 2022-01-12 23:44:34 +0000
4@@ -825,7 +825,7 @@
5
6 def _try_symlink_root(self, tree, prefix):
7 if (getattr(tree, 'abspath', None) is None or
8- not osutils.host_os_dereferences_symlinks()):
9+ not osutils.supports_symlinks(self._root)):
10 return False
11 try:
12 os.symlink(tree.abspath(''), osutils.pathjoin(self._root, prefix))
13
14=== modified file 'breezy/osutils.py'
15--- breezy/osutils.py 2021-12-24 17:11:16 +0000
16+++ breezy/osutils.py 2022-01-12 23:44:34 +0000
17@@ -1166,11 +1166,6 @@
18 return True
19
20
21-def host_os_dereferences_symlinks():
22- return (getattr(os, 'symlink', None) is not None
23- and sys.platform not in ('cygwin', 'win32'))
24-
25-
26 def readlink(abspath):
27 """Return a string representing the path to which the symbolic link points.
28
29
30=== modified file 'breezy/tests/test_diff.py'
31--- breezy/tests/test_diff.py 2021-12-08 18:46:11 +0000
32+++ breezy/tests/test_diff.py 2022-01-12 23:44:34 +0000
33@@ -981,7 +981,7 @@
34 self.assertContainsRe(new_path, 'tree/newname$')
35 self.assertFileEqual(b'oldcontent', old_path)
36 self.assertFileEqual(b'newcontent', new_path)
37- if osutils.host_os_dereferences_symlinks():
38+ if osutils.supports_symlinks(self.test_dir):
39 self.assertTrue(os.path.samefile('tree/newname', new_path))
40 # make sure we can create files with the same parent directories
41 diff_obj._prepare_files('oldname2', 'newname2')
42
43=== modified file 'breezy/tests/test_osutils.py'
44--- breezy/tests/test_osutils.py 2021-12-24 15:16:39 +0000
45+++ breezy/tests/test_osutils.py 2022-01-12 23:44:34 +0000
46@@ -525,9 +525,6 @@
47 osutils.make_readonly('dangling')
48 osutils.make_writable('dangling')
49
50- def test_host_os_dereferences_symlinks(self):
51- osutils.host_os_dereferences_symlinks()
52-
53
54 class TestCanonicalRelPath(tests.TestCaseInTempDir):
55
56
57=== modified file 'breezy/transport/local.py'
58--- breezy/transport/local.py 2021-12-24 14:58:11 +0000
59+++ breezy/transport/local.py 2022-01-12 23:44:34 +0000
60@@ -514,13 +514,23 @@
61 except (IOError, OSError) as e:
62 self._translate_error(e, path)
63
64- if osutils.host_os_dereferences_symlinks():
65- def readlink(self, relpath):
66- """See Transport.readlink."""
67- try:
68- return osutils.readlink(self._abspath(relpath))
69- except (IOError, OSError) as e:
70- self._translate_error(e, relpath)
71+ def symlink(self, source, link_name):
72+ """See Transport.symlink."""
73+ abs_link_dirpath = urlutils.dirname(self.abspath(link_name))
74+ source_rel = urlutils.file_relpath(
75+ abs_link_dirpath, self.abspath(source))
76+
77+ try:
78+ os.symlink(source_rel, self._abspath(link_name))
79+ except (IOError, OSError) as e:
80+ self._translate_error(e, source_rel)
81+
82+ def readlink(self, relpath):
83+ """See Transport.readlink."""
84+ try:
85+ return osutils.readlink(self._abspath(relpath))
86+ except (IOError, OSError) as e:
87+ self._translate_error(e, relpath)
88
89 if osutils.hardlinks_good():
90 def hardlink(self, source, link_name):
91@@ -530,18 +540,6 @@
92 except (IOError, OSError) as e:
93 self._translate_error(e, source)
94
95- if getattr(os, 'symlink', None) is not None:
96- def symlink(self, source, link_name):
97- """See Transport.symlink."""
98- abs_link_dirpath = urlutils.dirname(self.abspath(link_name))
99- source_rel = urlutils.file_relpath(
100- abs_link_dirpath, self.abspath(source))
101-
102- try:
103- os.symlink(source_rel, self._abspath(link_name))
104- except (IOError, OSError) as e:
105- self._translate_error(e, source_rel)
106-
107 def _can_roundtrip_unix_modebits(self):
108 if sys.platform == 'win32':
109 # anyone else?

Subscribers

People subscribed via source and target branches