Merge lp:~jelmer/bzr-pqm/2.5-compat into lp:bzr-pqm
| Status: | Merged |
|---|---|
| Approved by: | Vincent Ladeuil on 2012-01-20 |
| Approved revision: | 83 |
| Merged at revision: | 83 |
| Proposed branch: | lp:~jelmer/bzr-pqm/2.5-compat |
| Merge into: | lp:bzr-pqm |
| Diff against target: |
85 lines (+26/-10) 1 file modified
pqm_submit.py (+26/-10) |
| To merge this branch: | bzr merge lp:~jelmer/bzr-pqm/2.5-compat |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Vincent Ladeuil | 2012-01-20 | Needs Fixing on 2012-01-20 | |
|
Review via email:
|
|||
Description of the Change
Fix compatibility with bzr 2.5, which has a different configuration API.
This will simplify the code quite a bit once we can drop support for older bzr versions (< 2.3).
| Jelmer Vernooij (jelmer) wrote : | # |
On 01/20/2012 09:42 AM, Vincent Ladeuil wrote:
> Review: Needs Fixing
>
> You beat me to it ;)
>
> 8 +
>
> Spurious.
>
> 16 + get = _get_user_option
> 17 +
>
> Cunning !
>
> 42 + if bzrlib_version< (2, 5, 0, 'dev', 5):
>
> (2,5,0,'beta',5)< (2, 5, 0, 'dev', 5)
> True
>
> Oops !
>
> I think we should go with just (2,5) instead, people encountering issues
> with 2.5 compatibility are likely to 1) use at least 2.5b5 or trunk 2) upgrade to at least 2.5b5 anyway.
Fair enough.
>
>
> 51 + sections = []
> 52 + if branch:
> 53 + bstore = branch.
> 54 + sections.
> 55 if public_location:
> 56 - config.
> 57 - config.
> 58 + lstore = _mod_config.
> 59 + sections.
> 60 + public_
> 61 + gstore = _mod_config.
> 62 + sections.
> 63 + config = _mod_config.
>
> This doesn't look correct (locations.conf should override branch,conf when
> 'branch' is not None and -O also needs to supported), I think we want:
It's consistent with the behaviour in the pre-2.5 version of bzr-pqm. I
don't think we should change that.
Cheers,
Jelmer
| Vincent Ladeuil (vila) wrote : | # |
> > This doesn't look correct (locations.conf should override branch,conf when
> > 'branch' is not None and -O also needs to supported), I think we want:
> It's consistent with the behaviour in the pre-2.5 version of bzr-pqm. I
> don't think we should change that.
Yeah, your proposal is bug-compatible but do we need to file a bug first ?
It's a common misconception that branch.conf overrides locations.conf (or that locations.conf provides default values for branch.conf), I'm pretty sure whoever coded that was misled.
| Vincent Ladeuil (vila) wrote : | # |
Meh, I've re-read the original code:
config = StackedConfig()
if branch:
else:
if public_location:
So that's indeed what my fix does, either there is a branch and the usual location/
| Jelmer Vernooij (jelmer) wrote : | # |
On 01/20/2012 03:17 PM, Vincent Ladeuil wrote:
> Meh, I've re-read the original code:
>
> config = StackedConfig()
> if branch:
> config.
> else:
> if public_location:
> config.
> config.
>
> So that's indeed what my fix does, either there is a branch and the usual location/
Ah, I see. I'll fix my code and land.
Cheers,
Jelmer

You beat me to it ;)
8 +
Spurious.
16 + get = _get_user_option
17 +
Cunning !
42 + if bzrlib_version < (2, 5, 0, 'dev', 5):
(2,5,0,'beta',5) < (2, 5, 0, 'dev', 5)
True
Oops !
I think we should go with just (2,5) instead, people encountering issues
with 2.5 compatibility are likely to 1) use at least 2.5b5 or trunk 2) upgrade to at least 2.5b5 anyway.
51 + sections = [] _get_config_ store() append( _mod_config. NameMatcher( bstore, None).get_sections) add_source( _mod_config. LocationConfig( public_ location) ) add_source( _mod_config. GlobalConfig( )) LocationStore( ) append( _mod_config. LocationMatcher (lstore, location) .get_sections) GlobalStore( ) append( _mod_config. NameMatcher( gstore, 'DEFAULT' ).get_sections) Stack(sections)
52 + if branch:
53 + bstore = branch.
54 + sections.
55 if public_location:
56 - config.
57 - config.
58 + lstore = _mod_config.
59 + sections.
60 + public_
61 + gstore = _mod_config.
62 + sections.
63 + config = _mod_config.
This doesn't look correct (locations.conf should override branch,conf when
'branch' is not None and -O also needs to supported), I think we want:
=== modified file 'pqm_submit.py'
config. add_source( _mod_config. LocationConfig( public_ location) )
config. add_source( _mod_config. GlobalConfig( )) _get_config_ store() append( _mod_config. NameMatcher( bstore, None).get_sections) LocationStore( ) append( _mod_config. LocationMatcher (lstore, location) .get_sections) GlobalStore( ) append( _mod_config. NameMatcher( gstore, 'DEFAULT' ).get_sections) Stack(sections) get_config_ stack() LocationStack( public_ location) GlobalStack( )
--- pqm_submit.py 2012-01-20 00:58:05 +0000
+++ pqm_submit.py 2012-01-20 08:23:21 +0000
@@ -258,17 +258,12 @@
else:
- sections = []
if branch:
- bstore = branch.
- sections.
- if public_location:
- lstore = _mod_config.
- sections.
- public_
- gstore = _mod_config.
- sections.
- config = _mod_config.
+ config = branch.
+ elif public_location:
+ config = _mod_config.
+ else:
+ config = _mod_config.
Which still pass the plugin tests.
I've tested these additional changes and pushed them on lp:~bzr-pqm-devel/bzr-pqm/2.5-compat/
If you agree with them, get them, if you don't tweak them and land the result.