Merge lp:~mbp/bzr/remove-controlfiles into lp:bzr

Proposed by Martin Pool
Status: Work in progress
Proposed branch: lp:~mbp/bzr/remove-controlfiles
Merge into: lp:bzr
Diff against target: 64 lines (+4/-27) (has conflicts)
1 file modified
bzrlib/remote.py (+4/-27)
Text conflict in bzrlib/remote.py
To merge this branch: bzr merge lp:~mbp/bzr/remove-controlfiles
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+18752@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Martin Pool (mbp) wrote :

RemoteBranch.control_files shouldn't need to be exposed; all operations on the branch itself are done at a more abstract level.

I'm not 100% sure this is tested enough to catch callers that are depending on it.

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

this causes at least one failure in

  File "/usr/lib/python2.6/dist-packages/testtools/runtest.py", line 128, in _run_user
    return fn(*args)
  File "/usr/lib/python2.6/dist-packages/testtools/testcase.py", line 368, in _run_test_method
    testMethod()
  File "/home/mbp/bzr/remove-controlfiles/bzrlib/tests/per_branch/test_locking.py", line 64, in test_01_lock_read
    b = self.get_instrumented_branch()
  File "/home/mbp/bzr/remove-controlfiles/bzrlib/tests/per_branch/test_locking.py", line 42, in get_instrumented_branch
    bcf = b.control_files
  File "/home/mbp/bzr/remove-controlfiles/bzrlib/tests/lock_helpers.py", line 55, in __getattr__
    return getattr(self._other, attr)
  File "/home/mbp/bzr/remove-controlfiles/bzrlib/remote.py", line 2242, in control_files
    raise NotImplementedError("RemoteBranch.control_files is no longer supported")
NotImplementedError: RemoteBranch.control_files is no longer supported

but I think those tests sholud be locking the branch, not its control_files

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

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool wrote:
> this causes at least one failure in
>
> File "/usr/lib/python2.6/dist-packages/testtools/runtest.py", line 128, in _run_user
> return fn(*args)
> File "/usr/lib/python2.6/dist-packages/testtools/testcase.py", line 368, in _run_test_method
> testMethod()
> File "/home/mbp/bzr/remove-controlfiles/bzrlib/tests/per_branch/test_locking.py", line 64, in test_01_lock_read
> b = self.get_instrumented_branch()
> File "/home/mbp/bzr/remove-controlfiles/bzrlib/tests/per_branch/test_locking.py", line 42, in get_instrumented_branch
> bcf = b.control_files
> File "/home/mbp/bzr/remove-controlfiles/bzrlib/tests/lock_helpers.py", line 55, in __getattr__
> return getattr(self._other, attr)
> File "/home/mbp/bzr/remove-controlfiles/bzrlib/remote.py", line 2242, in control_files
> raise NotImplementedError("RemoteBranch.control_files is no longer supported")
> NotImplementedError: RemoteBranch.control_files is no longer supported
>
>
> but I think those tests sholud be locking the branch, not its control_files

It is a 'per_branch' 'test_locking' test, which certainly looks like it
should be testing at the Branch level.

The only question in whether '.control_files' is part of the Branch api,
and thus needs to be deprecated rather than just removed.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktt0scACgkQJdeBCYSNAAPAqwCfcTiV0x+/RIfRHy+oYJx0RtwI
n7gAoJecp6c0PAvbPd5gW8NR4K4gazup
=tCjB
-----END PGP SIGNATURE-----

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

> The only question in whether '.control_files' is part of the Branch api, and thus needs to be deprecated rather than just removed.

It probably does count of part of the api. I think it probably shouldn't be, because it's not any particularly distinct part of it, just a historic implementation detail. It probably should be specifically removed.

However our machinery for doing deprecations on things like this that can be called publicly, overridden, and also up-called is a bit weak.

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

I would say you should feel free to update the tests rather than require .control_files to be valid.

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

Setting this back to inprogress because it needs nontrivial fixes.

Unmerged revisions

5012. By Martin Pool <email address hidden>

Remove RemoteBranch._control_files member too

5011. By Martin Pool <email address hidden>

Remove unneeded RemoteBranchFormat.control_files

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/remote.py'
2--- bzrlib/remote.py 2010-04-20 04:16:50 +0000
3+++ bzrlib/remote.py 2010-04-22 01:41:30 +0000
4@@ -40,7 +40,6 @@
5 NoSuchRevision,
6 SmartProtocolError,
7 )
8-from bzrlib.lockable_files import LockableFiles
9 from bzrlib.smart import client, vfs, repository as smart_repo
10 from bzrlib.revision import ensure_null, NULL_REVISION
11 from bzrlib.trace import mutter, note, warning
12@@ -2002,26 +2001,6 @@
13 yield content
14
15
16-class RemoteBranchLockableFiles(LockableFiles):
17- """A 'LockableFiles' implementation that talks to a smart server.
18-
19- This is not a public interface class.
20- """
21-
22- def __init__(self, bzrdir, _client):
23- self.bzrdir = bzrdir
24- self._client = _client
25- self._need_find_modes = True
26- LockableFiles.__init__(
27- self, bzrdir.get_branch_transport(None),
28- 'lock', lockdir.LockDir)
29-
30- def _find_modes(self):
31- # RemoteBranches don't let the client set the mode of control files.
32- self._dir_mode = None
33- self._file_mode = None
34-
35-
36 class RemoteBranchFormat(branch.BranchFormat):
37
38 def __init__(self, network_name=None):
39@@ -2182,8 +2161,11 @@
40 # Fill out expected attributes of branch for bzrlib API users.
41 self._clear_cached_state()
42 self.base = self.bzrdir.root_transport.base
43+<<<<<<< TREE
44 self._name = name
45 self._control_files = None
46+=======
47+>>>>>>> MERGE-SOURCE
48 self._lock_mode = None
49 self._lock_token = None
50 self._repo_lock_token = None
51@@ -2291,12 +2273,7 @@
52
53 @property
54 def control_files(self):
55- # Defer actually creating RemoteBranchLockableFiles until its needed,
56- # because it triggers an _ensure_real that we otherwise might not need.
57- if self._control_files is None:
58- self._control_files = RemoteBranchLockableFiles(
59- self.bzrdir, self._client)
60- return self._control_files
61+ raise NotImplementedError("RemoteBranch.control_files is no longer supported")
62
63 def _get_checkout_format(self):
64 self._ensure_real()