conflict markers at end of file without newline

Bug #36399 reported by David Allouche
12
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Low
Unassigned

Bug Description

When displaying conflicts at the end of a file, and some of the presented chunks do not have a final newline, bzr produces a surprising format. Real life example:

<<<<<<< TREE
    >>> sorted([bug.id for bug in branch.related_bugs])
    [1, 4, 5]||||||| BASE-REVISION
    >>> [bug.id for bug in branch.related_bugs]
    [1]=======
    >>> [bug.id for bug in branch.related_bugs]
    [1]
>>>>>>> MERGE-SOURCE

It would be much more readable (and would be better handled by tools like emacs smerge-mode) if the tree and base-revision hunks had a newline appended so the "|||||||" and "=======" would be at line starts.

These lines could be decorated to preserve the "no newline information". I propose:

<<<<<<< TREE
    >>> sorted([bug.id for bug in branch.related_bugs])
    [1, 4, 5]
||||||| BASE-REVISION \ No newline at end of file
    >>> [bug.id for bug in branch.related_bugs]
    [1]
======= \ No newline at end of file
    >>> [bug.id for bug in branch.related_bugs]
    [1]
>>>>>>> MERGE-SOURCE

Revision history for this message
Martin Pool (mbp) wrote :

Still a bug in bzr.dev today.

This behaviour is consistent with CVS, but adding the newline would probably be better. As a compromise we could show

<<<<<<< THIS [no eol]

Changed in bzr:
status: Unconfirmed → Confirmed
Revision history for this message
David Allouche (ddaa) wrote :

I do not think putting the "[no eol]" marker at the beginning of the section would be appropriate.

Conflict blocks can sometimes be pretty large (longer than a screenful). If we are to preserve the "no eol" information, we should place the marker as close to the affected location as possible.

Since that can be potentially confusing (in my example, it might be unclear whether the newline is missing at the end of TREE or at the end of BASE), I proposed a creative reuse the diff syntax. The actual diff syntax cannot be used because inline conflict markers do not have the benefit of the "first line character gives the line type" syntax.

Maybe the confusion could be helped by changing "\ No newline at end of file" in my proposal to " \ No newline at end of previous file".

Also, I think "no eol" is pretty cryptic.

Revision history for this message
Martin Pool (mbp) wrote :

OK that makes sense.

Revision history for this message
John A Meinel (jameinel) wrote :

This bug still exists. We end up with:
foo
<<<<<<< TREE
baz=======
bar>>>>>>> MERGE-SOURCE

At the end of the file.

As mentioned, this is consistent with CVS, so I'm making the priority Low, and it shouldn't block 0.9

Changed in bzr:
importance: Medium → Low
Jelmer Vernooij (jelmer)
tags: added: conflicts
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.