Merge lp:~mbp/bzr/408193-hardlink into lp:~bzr/bzr/trunk-old

Proposed by Martin Pool
Status: Merged
Merged at revision: not available
Proposed branch: lp:~mbp/bzr/408193-hardlink
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: 136 lines
To merge this branch: bzr merge lp:~mbp/bzr/408193-hardlink
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+9567@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Martin Pool (mbp) wrote :

See bug 408193:

The attached branch https://code.launchpad.net/~mbp/bzr/408193-hardlink

 * gives a warning if hardlinking won't be done
 * turns the tests into KnownFailure if they see this message and hardlinking fails

Before actually reenabling the feature I'd like to talk to Ian and/or measure this possible performance loss.

Revision history for this message
Robert Collins (lifeless) wrote :

 review +1

I think its fine to not hardlink; bzr extracts texts _very_ fast from 2a
formats anyway.

-Rob

review: Approve
Revision history for this message
Martin Pool (mbp) wrote :

> review +1
>
> I think its fine to not hardlink; bzr extracts texts _very_ fast from 2a
> formats anyway.

As I said in the bug, users might want it for other reasons, like disk space. But it's not a high priority bug once this patch is in.

Thanks

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2009-08-04 04:07:13 +0000
+++ NEWS 2009-08-04 11:35:14 +0000
@@ -107,6 +107,11 @@
107 imported. This caused significant slowdowns when reading data from107 imported. This caused significant slowdowns when reading data from
108 repositories. (Andrew Bennetts, #405653)108 repositories. (Andrew Bennetts, #405653)
109 109
110* The ``--hardlink`` option to ``branch`` and ``checkout`` is not
111 supported at the moment on workingtree formats that can do content
112 filtering. (See <https://bugs.edge.launchpad.net/bzr/+bug/408193>.)
113 bzr now says so, rather than just ignoring the option. (Martin Pool)
114
110* There was a bug in ``osutils.relpath`` that was only triggered on115* There was a bug in ``osutils.relpath`` that was only triggered on
111 Windows. Essentially if you were at the root of a drive, and did116 Windows. Essentially if you were at the root of a drive, and did
112 something to a branch/repo on another drive, we would go into an117 something to a branch/repo on another drive, we would go into an
113118
=== modified file 'bzrlib/bzrdir.py'
--- bzrlib/bzrdir.py 2009-07-18 21:09:00 +0000
+++ bzrlib/bzrdir.py 2009-08-04 11:35:14 +0000
@@ -77,6 +77,7 @@
77from bzrlib.trace import (77from bzrlib.trace import (
78 mutter,78 mutter,
79 note,79 note,
80 warning,
80 )81 )
8182
82from bzrlib import (83from bzrlib import (
@@ -1384,6 +1385,9 @@
1384 # that can do wonky stuff here, and that only1385 # that can do wonky stuff here, and that only
1385 # happens for creating checkouts, which cannot be1386 # happens for creating checkouts, which cannot be
1386 # done on this format anyway. So - acceptable wart.1387 # done on this format anyway. So - acceptable wart.
1388 if hardlink:
1389 warning("can't support hardlinked working trees in %r"
1390 % (self,))
1387 try:1391 try:
1388 result = self.open_workingtree(recommend_upgrade=False)1392 result = self.open_workingtree(recommend_upgrade=False)
1389 except errors.NoSuchFile:1393 except errors.NoSuchFile:
13901394
=== modified file 'bzrlib/tests/blackbox/test_branch.py'
--- bzrlib/tests/blackbox/test_branch.py 2009-07-01 15:25:31 +0000
+++ bzrlib/tests/blackbox/test_branch.py 2009-08-04 11:35:14 +0000
@@ -22,7 +22,10 @@
22from bzrlib import (branch, bzrdir, errors, repository)22from bzrlib import (branch, bzrdir, errors, repository)
23from bzrlib.repofmt.knitrepo import RepositoryFormatKnit123from bzrlib.repofmt.knitrepo import RepositoryFormatKnit1
24from bzrlib.tests.blackbox import ExternalBase24from bzrlib.tests.blackbox import ExternalBase
25from bzrlib.tests import HardlinkFeature25from bzrlib.tests import (
26 KnownFailure,
27 HardlinkFeature,
28 )
26from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer29from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
27from bzrlib.urlutils import local_path_to_url, strip_trailing_slash30from bzrlib.urlutils import local_path_to_url, strip_trailing_slash
28from bzrlib.workingtree import WorkingTree31from bzrlib.workingtree import WorkingTree
@@ -93,10 +96,18 @@
93 self.build_tree(['source/file1'])96 self.build_tree(['source/file1'])
94 source.add('file1')97 source.add('file1')
95 source.commit('added file')98 source.commit('added file')
96 self.run_bzr(['branch', 'source', 'target', '--hardlink'])99 out, err = self.run_bzr(['branch', 'source', 'target', '--hardlink'])
97 source_stat = os.stat('source/file1')100 source_stat = os.stat('source/file1')
98 target_stat = os.stat('target/file1')101 target_stat = os.stat('target/file1')
99 self.assertEqual(source_stat, target_stat)102 same_file = (source_stat == target_stat)
103 if same_file:
104 pass
105 else:
106 # https://bugs.edge.launchpad.net/bzr/+bug/408193
107 self.assertContainsRe(err, "hardlinking working copy files is "
108 "not currently supported")
109 raise KnownFailure("--hardlink doesn't work in formats "
110 "that support content filtering (#408193)")
100111
101 def test_branch_standalone(self):112 def test_branch_standalone(self):
102 shared_repo = self.make_repository('repo', shared=True)113 shared_repo = self.make_repository('repo', shared=True)
103114
=== modified file 'bzrlib/tests/blackbox/test_checkout.py'
--- bzrlib/tests/blackbox/test_checkout.py 2009-03-23 14:59:43 +0000
+++ bzrlib/tests/blackbox/test_checkout.py 2009-08-04 11:35:14 +0000
@@ -1,4 +1,4 @@
1# Copyright (C) 2005, 2006 Canonical Ltd1# Copyright (C) 2005, 2006, 2009 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
@@ -28,8 +28,13 @@
28 errors,28 errors,
29 workingtree,29 workingtree,
30 )30 )
31from bzrlib.tests.blackbox import ExternalBase31from bzrlib.tests.blackbox import (
32from bzrlib.tests import HardlinkFeature32 ExternalBase,
33 )
34from bzrlib.tests import (
35 HardlinkFeature,
36 KnownFailure,
37 )
3338
3439
35class TestCheckout(ExternalBase):40class TestCheckout(ExternalBase):
@@ -150,8 +155,17 @@
150 self.build_tree(['source/file1'])155 self.build_tree(['source/file1'])
151 source.add('file1')156 source.add('file1')
152 source.commit('added file')157 source.commit('added file')
153 self.run_bzr(['checkout', 'source', 'target', '--files-from', 'source',158 out, err = self.run_bzr(['checkout', 'source', 'target',
154 '--hardlink'])159 '--files-from', 'source',
160 '--hardlink'])
155 source_stat = os.stat('source/file1')161 source_stat = os.stat('source/file1')
156 target_stat = os.stat('target/file1')162 target_stat = os.stat('target/file1')
157 self.assertEqual(source_stat, target_stat)163 same_file = (source_stat == target_stat)
164 if same_file:
165 pass
166 else:
167 # https://bugs.edge.launchpad.net/bzr/+bug/408193
168 self.assertContainsRe(err, "hardlinking working copy files is "
169 "not currently supported")
170 raise KnownFailure("--hardlink doesn't work in formats "
171 "that support content filtering (#408193)")
158172
=== modified file 'bzrlib/workingtree_4.py'
--- bzrlib/workingtree_4.py 2009-07-17 06:04:35 +0000
+++ bzrlib/workingtree_4.py 2009-08-04 11:35:14 +0000
@@ -1423,6 +1423,10 @@
1423 # applied so we can't safely build the inventory delta from1423 # applied so we can't safely build the inventory delta from
1424 # the source tree.1424 # the source tree.
1425 if wt.supports_content_filtering():1425 if wt.supports_content_filtering():
1426 if hardlink:
1427 # see https://bugs.edge.launchpad.net/bzr/+bug/408193
1428 trace.warning("hardlinking working copy files is not currently "
1429 "supported in %r" % (wt,))
1426 accelerator_tree = None1430 accelerator_tree = None
1427 delta_from_tree = False1431 delta_from_tree = False
1428 else:1432 else: