Merge lp:~jelmer/bzr/diff-git into lp:bzr
| Status: | Superseded |
|---|---|
| Proposed branch: | lp:~jelmer/bzr/diff-git |
| Merge into: | lp:bzr |
| Diff against target: |
70 lines (+15/-3) 4 files modified
bzrlib/builtins.py (+2/-1) bzrlib/option.py (+2/-2) bzrlib/tests/blackbox/test_diff.py (+3/-0) bzrlib/tests/test_options.py (+8/-0) |
| To merge this branch: | bzr merge lp:~jelmer/bzr/diff-git |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Vincent Ladeuil | 2010-12-20 | Abstain on 2010-12-20 | |
|
Review via email:
|
|||
This proposal has been superseded by a proposal from 2011-01-14.
Commit Message
Support value switches for 'bzr diff' formats.
| Jelmer Vernooij (jelmer) wrote : | # |
| Andrew Bennetts (spiv) wrote : | # |
I'm +0 on the UI change... I think it's probably ok, but I'm a big user of non-default diff formats so I'd feel more comfortable if Martin's impeccable UI taste says so too. Martin?
The diff itself is reasonable, although you should add release-notes and whats-new entries.
| Martin Pool (mbp) wrote : | # |
On 20 December 2010 17:16, Andrew Bennetts
<email address hidden> wrote:
> I'm +0 on the UI change... I think it's probably ok, but I'm a big user of non-default diff formats so I'd feel more comfortable if Martin's impeccable UI taste says so too. Martin?
>
> The diff itself is reasonable, although you should add release-notes and whats-new entries.
Generally speaking I'm not a big fan of format_switches, because
- it makes the help a bit less readable (though that could in
principle be fixed)
- it looks like there are more options than there actually are
- related, values that are reasonable option arguments cause trouble
with sphinx etc when presented as actual options, eg things that
contain a dot
- if we get an unknown option (because eg we don't have a plugin
installed) it is a bit harder to explain why (though this is only
theoretical because we don't currently explain why in this case)
I wonder here if we could instead support say -Fgit? Would that both
work, and be reasonably concise?
--
Martin
| Vincent Ladeuil (vila) wrote : | # |
I'm not a big fan of format_switches either :-/
On the other hand either we should stop using them or not object when they *can* be used...
But for your current issue, why don't you just use "bzr alias diff-git='bzr diff --format=git" ?
This will save you 2 keystrokes by invocation so the definition should be amortized with as little as 21 uses ;)
| Jelmer Vernooij (jelmer) wrote : | # |
On Mon, 2010-12-20 at 07:37 +0000, Martin Pool wrote:
> On 20 December 2010 17:16, Andrew Bennetts
> <email address hidden> wrote:
> > I'm +0 on the UI change... I think it's probably ok, but I'm a big user of non-default diff formats so I'd feel more comfortable if Martin's impeccable UI taste says so too. Martin?
> >
> > The diff itself is reasonable, although you should add release-notes and whats-new entries.
>
> Generally speaking I'm not a big fan of format_switches, because
>
> - it makes the help a bit less readable (though that could in
> principle be fixed)
> - it looks like there are more options than there actually are
> - related, values that are reasonable option arguments cause trouble
> with sphinx etc when presented as actual options, eg things that
> contain a dot
> - if we get an unknown option (because eg we don't have a plugin
> installed) it is a bit harder to explain why (though this is only
> theoretical because we don't currently explain why in this case)
>
> I wonder here if we could instead support say -Fgit? Would that both
> work, and be reasonably concise?
Hmm, that's true. I guess there's a bit of hypocrisy here on my part as
I've complained about format switches myself in the past, in particular
in upgrade.
A short format option would be nice.
Another reason for having value switches was discoverability. I wonder
if we could perhaps list the possible values in the help string for a
RegistryOption if value_switches is not set? At the moment "bzr diff
--format=git" is not very discoverable. I'm thinking along the lines of:
...
--format=ARG Diff format to use. (unified, git) [unified]
...
Cheers,
Jelmer
| Jelmer Vernooij (jelmer) wrote : | # |
On Mon, 2010-12-20 at 12:41 +0000, Vincent Ladeuil wrote:
> Review: Abstain
> I'm not a big fan of format_switches either :-/
>
> On the other hand either we should stop using them or not object when they *can* be used...
>
> But for your current issue, why don't you just use "bzr alias diff-git='bzr diff --format=git" ?
>
> This will save you 2 keystrokes by invocation so the definition should be amortized with as little as 21 uses ;)
Bazaar should have good usability out of the box as much as possible. As
this is something that would affect other users too I'm wary of working
around it with a local alias.
There are two issues with --format=git:
* it's not discoverable
* it's not very short
Having "bzr git --diff" is one way of addressing those. Perhaps there
are better alternatives (see my other reply).
Cheers,
Jelmer
- 5577. By Jelmer Vernooij on 2011-01-14
-
Add -F as alias for 'bzr diff -F format'
- 5578. By Jelmer Vernooij on 2011-01-19
-
merge bzr.dev.
- 5579. By Jelmer Vernooij on 2011-01-19
-
Fix test.

This makes it possible to use value switches for the formats of "bzr diff". I use "bzr diff --format=git" quite a lot these days when communicating with upstreams, and it'd be great if I can just use "bzr diff --git".