Merge lp:~abentley/bzr/config-branchname into lp:bzr
| Status: | Merged |
|---|---|
| Approved by: | John A Meinel on 2012-06-20 |
| Approved revision: | 6528 |
| Merged at revision: | 6526 |
| Proposed branch: | lp:~abentley/bzr/config-branchname |
| Merge into: | lp:bzr |
| Diff against target: |
111 lines (+49/-4) 3 files modified
bzrlib/config.py (+14/-4) bzrlib/help_topics/en/configuration.txt (+12/-0) bzrlib/tests/test_config.py (+23/-0) |
| To merge this branch: | bzr merge lp:~abentley/bzr/config-branchname |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| John A Meinel | 2012-06-18 | Approve on 2012-06-20 | |
|
Review via email:
|
|||
Commit Message
Support branchname config variable.
Description of the Change
This branch adds a "branchname" automatic config variable, which is the name of a native colocated branch, as specified by the "branch=" portion of its url. This allows the user to configure urls to reflect the branch name, just as they would use relpath or basename to configure other types of branches.
I have used it like so, in order to push this branch:
[/home/
push_location = bzr+ssh:
This is an itch that I am scratching. For me, the biggest advantage of bzr-colo colocation is that, since it uses standard branches, it can automatically configure the push and public locations. With this change, native colo branches will have parity in terms of configuration.
| James Westby (james-w) wrote : | # |
| Aaron Bentley (abentley) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 12-06-18 10:28 AM, James Westby wrote:
> On Mon, 18 Jun 2012 14:00:27 -0000, Aaron Bentley
> <email address hidden> wrote:
>> +Another such option is ``branchname``, which refers to the name
>> of a colocated +branch. It can be used like this::
>
> Is it just colocated branches, or does it work for all local
> branches?
No, it only works for branches which have names specified in their url
via ",branch=$NAME". Only colocated branches have URLs like that.
But I don't think they are required to be local.
> It seems like this could work for pipelines with much the same
> configuration if it does?
For bzr-colo style pipelines, the "basename" config variable will work
just as well. But pipelines can also be used with native-colocated
branches.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAk/
3YUAoIcg/
=3pFD
-----END PGP SIGNATURE-----
| John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 6/18/2012 4:40 PM, Aaron Bentley wrote:
> On 12-06-18 10:28 AM, James Westby wrote:
>> On Mon, 18 Jun 2012 14:00:27 -0000, Aaron Bentley
>> <email address hidden> wrote:
>>> +Another such option is ``branchname``, which refers to the
>>> name of a colocated +branch. It can be used like this::
>
>> Is it just colocated branches, or does it work for all local
>> branches?
>
> No, it only works for branches which have names specified in their
> url via ",branch=$NAME". Only colocated branches have URLs like
> that. But I don't think they are required to be local.
>
>> It seems like this could work for pipelines with much the same
>> configuration if it does?
>
> For bzr-colo style pipelines, the "basename" config variable will
> work just as well. But pipelines can also be used with
> native-colocated branches.
>
> Aaron
Would it be possible to have 'nick' available as a config variable
rather than 'branchname'? It seems that having to write things as
(basename or branchname) and not having a universal value is a bit odd.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAk/
a7IAnRqkPwxChQJ
=XsVC
-----END PGP SIGNATURE-----
| Aaron Bentley (abentley) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> Would it be possible to have 'nick' available as a config variable
> rather than 'branchname'? It seems that having to write things as
> (basename or branchname) and not having a universal value is a bit
> odd.
I agree that it would be nice to have a single thing that worked for
all of them.
It's possible to use 'nick', but that's expensive, changes the
locations.conf paradigm and introduces new failure modes.
It's expensive because of explicit nicks. It requires opening a
branch, and it can cause network traffic.
locations.conf has always configured locations, not branches, and this
would change that paradigm.
It would mean that locations.conf would need to handle branch-opening
failures, something it's never considered before.
Maybe we should drop the concept of explicit nicks. I think they're
pretty rarely used. If nicks could be calculated from URL alone, all
the above issues go away.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAk/
8eAAn19kIIMLT+
=iq4E
-----END PGP SIGNATURE-----
| John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 6/19/2012 4:37 PM, Aaron Bentley wrote:
>> Would it be possible to have 'nick' available as a config
>> variable rather than 'branchname'? It seems that having to write
>> things as (basename or branchname) and not having a universal
>> value is a bit odd.
>
> I agree that it would be nice to have a single thing that worked
> for all of them.
>
> It's possible to use 'nick', but that's expensive, changes the
> locations.conf paradigm and introduces new failure modes.
>
> It's expensive because of explicit nicks. It requires opening a
> branch, and it can cause network traffic.
>
> locations.conf has always configured locations, not branches, and
> this would change that paradigm.
>
> It would mean that locations.conf would need to handle
> branch-opening failures, something it's never considered before.
>
> Maybe we should drop the concept of explicit nicks. I think
> they're pretty rarely used. If nicks could be calculated from URL
> alone, all the above issues go away.
>
> Aaron
We could call it 'branchshortname' or something along those lines,
that would be essentially (basename or branchname).
I would be happy enough to have 'branchname' that worked along those
lines. (if ,branch=? then ?, else basename)
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAk/
kc4AoK3LAhELgZ5
=YUXp
-----END PGP SIGNATURE-----
- 6528. By Aaron Bentley on 2012-06-19
-
branchname falls back to basename.
| Aaron Bentley (abentley) wrote : | # |
I've made the changes you requested.
| John A Meinel (jameinel) wrote : | # |
Offhand it feels like we would need to unescape the basename if we are unescaping the branch portion. However your test seems to clearly state that isn't the case. That indicates we prob have an API issue (similar commands return different types, eg escaped URLs vs Unicode). But that isn't something you need to fix in this branch.
The doc seems a bit incomplete as it only indicates branchname works with Colo branches.
- 6529. By Aaron Bentley on 2012-06-20
-
Update docs.
| Aaron Bentley (abentley) wrote : | # |
> Offhand it feels like we would need to unescape the basename if we are
> unescaping the branch portion. However your test seems to clearly state that
> isn't the case. That indicates we prob have an API issue (similar commands
> return different types, eg escaped URLs vs Unicode). But that isn't something
> you need to fix in this branch.
We don't need to unescape the basename because for file:/// URLs, self.location is set to a filesystem path. This matches the behaviour of our existing config mechamism. However, I've realized it's really a bug, because it means that unescaping is not done for other URL types. I've filed bug #1015570 about this.
> The doc seems a bit incomplete as it only indicates branchname works with Colo
> branches.
I added this to the docs: For non-colocated branches, it behaves like basename.
- 6530. By Aaron Bentley on 2012-06-20
-
Merged dev into config-branchname.

On Mon, 18 Jun 2012 14:00:27 -0000, Aaron Bentley <email address hidden> wrote:
> +Another such option is ``branchname``, which refers to the name of a colocated
> +branch. It can be used like this::
Is it just colocated branches, or does it work for all local branches?
It seems like this could work for pipelines with much the same
configuration if it does?
Thanks,
James