[MERGE REVIEW] Tweaks to bundle merging

Martin Pool mbp at canonical.com
Wed Jun 14 21:36:33 BST 2006


On 07/06/2006, at 7:36 AM, Aaron Bentley wrote:

> BundleReadder
>> expect to see LF-only line-endings but instead got CRLF. During merge
>> there is MailformedBundle error raised and after then merge switch to
>> interpret bundle filepath as merge-branch location.
>
> We've been talking about this.  The solution we're leading toward is
> forcing the output to contain LF only.

My suggestion is this:

Line endings have to be carried correctly to generate the right sha1,  
and in any case they constitute user data that we should not lose.   
However, it's probably unrealistic to expect they can be passed  
around in email without getting lost.  It is common for files to  
consistently use all one type of ending but not the only possibility.

Therefore I suggest we add a field to the diff header saying what  
kind of newline is used in lines added by that diff.  This should be  
reasonably straightforward to add as an option to the method that  
produces this from a SequenceMatcher.

--- a   2006-06-15 06:36:02.000000000 +1000
+++ b   2006-06-15 06:36:03.000000000 +1000
~~~ line-endings: CRLF
@@ -1 +1 @@
-Thu Jun 15 06:36:02 EST 2006
+Thu Jun 15 06:36:03 EST 2006
zsh: exit 1     diff -u a b

If we have a file with mixed line endings then we can either treat it  
as binary; or emit several of these headers as needed (which is a bit  
more complex).

(Other kinds of whitespace may also get lost but escaping them all  
properly while still being readable is something for another day.)

-- 
Martin







More information about the bazaar mailing list