[PING] Request: please add to 0.8 release --no-prefix option to diff command

John Arbash Meinel john at arbash-meinel.com
Wed Apr 26 19:17:09 BST 2006


Goffredo Baroncelli wrote:
> On Wednesday 26 April 2006 16:11, John Arbash Meinel wrote:
>> Jan Hudec wrote:
>>> On Wed, Apr 26, 2006 at 10:19:53 +0300, Alexander Belchenko wrote:
>>>> New behaviour of diff command (with a/ - b/ prefixes) breaks
>>>> compatibility of bzr with some tools. In particular with my favorite FTE
>>>> editor that has built-in support of SVN that I extend to support bzr.
>>>>
>>>> Please inclide to 0.8 release --no-prefix options to bzr diff.
>>>> I think I saw the patch in the mailing list.
>>> In fact given how a/ and b/ look (ugly IMHO), I'd even prefer
>>> --prefix=<old>,<new>, defaulting to both being empty...
>>>
>> I would second this preference. I would even write the patch if it was
>> decided it would be included.
> 
> 
> I suggest to rename the --prefix option to a less generic --diff-prefix 
> option; morover if you add an entry in the [ALIAS] section of 
> the .bazaar/bazaar.conf file you can add a new command which generate the 
> desiderated output; also I dislike the a/,b/ prefix: if it is possible I 
> prefer to return to the old behaviour.
> 
> $ grep gdiff ~/.bazaar/bazaar.conf
> gdiff=diff --diff-prefix=:
> 
> $ ./bzr gdiff | head
> === modified file 'bzrlib/builtins.py'
> --- bzrlib/builtins.py
> +++ bzrlib/builtins.py
> @@ -997,12 +997,22 @@
>      # TODO: This probably handles non-Unix newlines poorly.
> 
>      takes_args = ['file*']
> [...]
> 
> BTW I replaced the ',' (comma) with a ':' (colon) because otherwise bzr 
> generates an error processing the ALIAS section...
> 
> As side note, we can add some prefix which are replaced by the revision-id ( o 
> revision-number )... as git does.

The easiest way to do that, would be to allow python expansion for
certain keys. Something like:
%(revision_id)s
Or %(revno)s

Then you would do:
bzr diff --diff-prefix=%(revno)s:%(revno)s

The code would then do:
	prefix % {'revno':branch.revno,
		 'revision_id':branch.last_revision()
		...
		}

An alternative would be to have a set of replacements like %r =>
revision id, %n => revision number, etc.
This would do something more like:

	prefix = (prefix.replace('%r', branch.last_revision())
			.replace('%n', str(branch.revno()))
		 ...
		)

I'm not positive where we would expand those values, but it should be
possible to do.


Other than what the defaults should be, +1 from me.

Alternatively, we could have the default of None be interpreted as 'a/'
and 'b/' at the lowest level. Then the upper levels just pass None, and
don't have to all have the same default values.

John
=:->


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060426/6b878f59/attachment.pgp 


More information about the bazaar mailing list