Merge lp:~jelmer/bzr-cvs/controldir into lp:bzr-cvs

Proposed by Jelmer Vernooij
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: 4
Proposed branch: lp:~jelmer/bzr-cvs/controldir
Merge into: lp:bzr-cvs
Diff against target: 70 lines (+37/-10)
1 file modified
__init__.py (+37/-10)
To merge this branch: bzr merge lp:~jelmer/bzr-cvs/controldir
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+52337@code.launchpad.net

Description of the change

Support the new ControlDir/Prober API introduced in bzrlib 2.3

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

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

On 3/6/2011 8:25 PM, Jelmer Vernooij wrote:
> Jelmer Vernooij has proposed merging lp:~jelmer/bzr-cvs/controldir into lp:bzr-cvs.
>
> Requested reviews:
> Bazaar Developers (bzr)
>
> For more details, see:
> https://code.launchpad.net/~jelmer/bzr-cvs/controldir/+merge/52337
>
> Support the new ControlDir/Prober API introduced in bzrlib 2.3

TBH, I'm really not familiar with 'bzr-cvs'. Until today, I didn't know
it existed.

As such, I'm happy for you to land this, but I don't really know any
background.

The change looks reasonable to me. What about backwards compatibility,
though?

 merge: approve

John
=:->

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

iEYEARECAAYFAk105EAACgkQJdeBCYSNAAMUlgCgxb47bYrBNdntbIE0biUqpyOT
OD4An3HkyxJvScwjMistAYFdAekRDoUk
=qmg6
-----END PGP SIGNATURE-----

review: Approve
lp:~jelmer/bzr-cvs/controldir updated
4. By Jelmer Vernooij

Merge support for the new controldir API.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '__init__.py'
2--- __init__.py 2008-10-07 06:52:44 +0000
3+++ __init__.py 2011-03-07 17:46:30 +0000
4@@ -19,11 +19,26 @@
5 Currently limited to telling you you want to run CVS commands.
6 """
7
8-import bzrlib.bzrdir
9+try:
10+ from bzrlib.controldir import (
11+ ControlDirFormat,
12+ ControlDir,
13+ Prober,
14+ )
15+ has_controldir = True
16+except ImportError:
17+ from bzrlib.bzrdir import (
18+ BzrDirFormat,
19+ BzrDirFormat as ControlDirFormat,
20+ BzrDir as ControlDir,
21+ )
22+ Prober = object
23+ has_controldir = False
24+
25 import bzrlib.errors
26
27
28-class CVSDirFormat(bzrlib.bzrdir.BzrDirFormat):
29+class CVSDirFormat(ControlDirFormat):
30 """The CVS directory control format."""
31
32 def get_converter(self):
33@@ -44,17 +59,29 @@
34 raise bzrlib.errors.BzrCommandError(
35 "CVS working trees are not supported. To convert CVS projects to "
36 "bzr, please see http://bazaar-vcs.org/BzrMigration and/or "
37- "https://edge.launchpad.net/launchpad-bazaar/+faq/26.")
38+ "https://launchpad.net/launchpad-bazaar/+faq/26.")
39
40 @classmethod
41 def probe_transport(klass, transport):
42 """Our format is present if the transport ends in 'CVS/'."""
43+ return CVSProber().probe_transport(transport)
44+
45+
46+class CVSProber(Prober):
47+
48+ @classmethod
49+ def probe_transport(klass, transport):
50 # little ugly, but works
51- format = klass()
52 # try a manual probe first, its a little faster perhaps ?
53- if transport.has('CVS'):
54- return format
55- raise bzrlib.errors.NotBranchError(path=transport.base)
56-
57-
58-bzrlib.bzrdir.BzrDirFormat.register_control_format(CVSDirFormat)
59+ if not transport.has('CVS'):
60+ raise bzrlib.errors.NotBranchError(path=transport.base)
61+ if not transport.has('CVS/Repository'):
62+ raise bzrlib.errors.NotBranchError(path=transport.base)
63+ return CVSDirFormat()
64+
65+
66+if has_controldir:
67+ ControlDirFormat.register_prober(CVSProber)
68+ ControlDirFormat.register_format(CVSDirFormat())
69+else:
70+ BzrDirFormat.register_control_format(CVSDirFormat)

Subscribers

People subscribed via source and target branches

to all changes: