Merge lp:~jelmer/bzr-loom/default-format into lp:bzr-loom

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 128
Proposed branch: lp:~jelmer/bzr-loom/default-format
Merge into: lp:bzr-loom
Diff against target: 22 lines (+8/-4)
1 file modified
branch.py (+8/-4)
To merge this branch: bzr merge lp:~jelmer/bzr-loom/default-format
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+50927@code.launchpad.net

Commit message

Use bzrlib.branch.format_registry.get_default(), if available.

Description of the change

Use the new public method to get the default format, if available.

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) :
review: Approve
lp:~jelmer/bzr-loom/default-format updated
128. By Jelmer Vernooij

Merge use of default branch format method, if available.

Revision history for this message
Vincent Ladeuil (vila) wrote :

Err, wait, there is an additional tweak required:

=== modified file 'formats.py'
--- formats.py 2010-06-18 04:44:52 +0000
+++ formats.py 2011-02-23 15:54:08 +0000
@@ -54,7 +54,13 @@
             branch.BzrBranchLoomFormat6(),
             branch.BzrBranchLoomFormat7(),
             ]
- map(_mod_branch.BranchFormat.register_format, branch_formats)
+ try:
+ format_registry = getattr(_mod_branch, 'format_registry')
+ register = format_registry.register
+ except AttributeError: # bzr < 2.4
+ register = _mod_branch.BranchFormat.register_format
+
+ map(register, branch_formats)

I'll add it and land.

@jelmer: You intend to deploy the lazy registration for plugins later right ?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'branch.py'
2--- branch.py 2010-12-16 01:32:05 +0000
3+++ branch.py 2011-02-23 14:13:00 +0000
4@@ -911,11 +911,15 @@
5
6 @classmethod
7 def _get_branch_formats_to_test(klass):
8+ try:
9+ format_registry = getattr(bzrlib.branch, "format_registry")
10+ except AttributeError: # bzr < 2.4
11+ default_format = bzrlib.branch.BranchFormat._default_format
12+ else:
13+ default_format = format_registry.get_default()
14 return [
15- (bzrlib.branch.BranchFormat._default_format,
16- BzrBranchLoomFormat7()),
17- (BzrBranchLoomFormat7(),
18- bzrlib.branch.BranchFormat._default_format),
19+ (default_format, BzrBranchLoomFormat7()),
20+ (BzrBranchLoomFormat7(), default_format),
21 (BzrBranchLoomFormat7(), BzrBranchLoomFormat7()),
22 ]
23

Subscribers

People subscribed via source and target branches