[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] File encoding for getting old revisions in psvn.el

From: Andre Colomb <acolomb_at_schickhardt.org>
Date: Mon, 27 Aug 2012 17:21:40 +0200

Hello again!

It appears that the contributed Emacs Subversion management mode psvn.el
does not handle file EOL encodings well when retrieving old file
revisions from the repository. The attached patch tries to fix some
problems in this code.

Suppose you have a file foo in a repository which contains CRLF style
line endings and does _not_ have the svn:eol-style property set. When
checking out a working copy and opening the file, Emacs will
automatically switch the coding system to something ending in "-dos"
becasue it finds these line ending marks.

When using psvn.el to retrieve a specific revision (say, PREV) of the
file from the repository (by calling svn-status-get-specific-revision,
usually bound to ~ in svn-status mode), the opened buffer does not show
the contents correctly. It is downloaded and saved as stored in the
repository, by using a call to "svn cat foo". However, the buffer
displaying the downloaded file foo.~PREV~ shows all the CR line endings
as ^M characters. Closing and re-opening the file fixes this.

Emacs does not automatically detect the EOL coding style of the content
when psvn.el displays the downloaded revision buffer. This is especially
annoying when using ediff to compare to an older revision from within
svn-status mode. All lines will have differences because of the
different line endings.

The attached patch fixes this by calling detect-coding-string on the
buffer content and then sets the detected value for saving the file
later, thus preserving the actual content. I tested it on GNU Emacs
23.3.1 on Ubuntu and 24.1 on Windows.

Please consider committing this to the contrib tree in trunk. If there
are any open questions, please don't hesitate to reply.

Regards
André

-- 
Greetings...
From: Andre Colomb <acolomb_at_schickhardt.org>

Received on 2012-08-27 17:22:16 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.