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
=== modified file 'branch.py'
--- branch.py 2010-12-16 01:32:05 +0000
+++ branch.py 2011-02-23 14:13:00 +0000
@@ -911,11 +911,15 @@
911911
912 @classmethod912 @classmethod
913 def _get_branch_formats_to_test(klass):913 def _get_branch_formats_to_test(klass):
914 try:
915 format_registry = getattr(bzrlib.branch, "format_registry")
916 except AttributeError: # bzr < 2.4
917 default_format = bzrlib.branch.BranchFormat._default_format
918 else:
919 default_format = format_registry.get_default()
914 return [920 return [
915 (bzrlib.branch.BranchFormat._default_format,921 (default_format, BzrBranchLoomFormat7()),
916 BzrBranchLoomFormat7()),922 (BzrBranchLoomFormat7(), default_format),
917 (BzrBranchLoomFormat7(),
918 bzrlib.branch.BranchFormat._default_format),
919 (BzrBranchLoomFormat7(), BzrBranchLoomFormat7()),923 (BzrBranchLoomFormat7(), BzrBranchLoomFormat7()),
920 ]924 ]
921925

Subscribers

People subscribed via source and target branches