diff UI not working properly for .rst files (BB-4088)

Vinay Sajip avatarVinay Sajip created an issue

If you look at the recent commits on https://bitbucket.org/vinay.sajip/pylauncher/, you'll see that changes to launcher.rst are not correctly shown. It only shows the first few lines of the file, even though there are changes throughout the file.



If you examine the changes in a CLI, you'll see that there are more than show up in the UI.

Comments (6)

  1. Nicolas Venegas

    Hi Vinay

    It seems this is being caused by incorrectly interpretting the diff due to the presence of ^M characters in the file.

    Mercurial reports that only one line changed (a single line which ^M characters embedded that represent newlines):

    % hg diff --change e73603fa89af --include='**/launcher.rst' | diffstat
     launcher.rst |    2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)

    But our parsing of the file and diff is treating the ^M characters as proper newlines, making the diff output misleading.

    I'll work on a fix.



  2. Vinay Sajip

    It looks as if the file was created on a Mac (not by me) - the line endings are all CR. I have now converted it to use CRLF line endings, as the file is mainly for Windows users, but I guess you need to deal with different line-endings anyway.

  3. Brodie Rao

    Closing this as won't fix. I agree that it's a little confusing that we handle MacOS-style CR line endings as line endings and Hg doesn't, but I'd say it's friendlier to interpret them.

  4. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.