monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] OS-specific line endings


From: Stephen Leake
Subject: [Monotone-devel] OS-specific line endings
Date: Sat, 03 Jul 2010 12:37:39 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (windows-nt)

I'd like to add some OS-specific line ending handling to mtn.

The rationale is to deal with a tool that doesn't quite do what I want,
but isn't open source so I can't fix it.

First I looked thru various documentation to see what line ending
handling is there.

NEWS mentions line endings in 0.19:

    - windows/unix working copy line ending conversion now
      works correctly.  Thanks to Emile Snyder

But monotone.texi only mentions it in passing, in Internationalization:

    File contents
    =============

       * Files are subject to character set conversion and line ending
         conversion.

    Cert values
    ===========

    Cert values may be either text or binary, depending on the return value
    of the hook `cert_is_binary'. If binary, the cert value is never
    printed to the screen (the literal string "<binary>" is displayed,
    instead), and is never subjected to line ending or character
    conversion. ...

The wiki mentions it in several places:

WorkspaceConflicts.mdwn:
    * remove the file munging line ending conversion stuff which is all
    tied up in this

LineEndingMunging.mdwn
    We currently control this stuff with a hook. This is manifestly
    broken. It should be controlled per-file with attrs (I think the
    only reason it isn't is that attrs didn't exist back then).

SummerOfCode/2007.mdwn
    lists line-ending handling as a project

LineEndingMunging.mdwn discusses some of the issues, but not much on
actual implementation.

I assume the current state is that there is no line munging code
in mtn. 

Interestingly, there is no NEWS entry saying we've dropped line-ending
handling.


My scenario is:

I'm using Altera Quartus to compile VHDL files. For each VHDL project, I
keep two files (beyond the VHDL files) in mtn: project.pin, project.qsf.
I run on both RedHat Gnu/Linux and MS Windows.

project.pin contains the FPGA pin assignments; this lets me see when
they change.

project.qsf contains various compiler settings. 

project.pin is written by Quartus, using OS-specific line endings. So
when I rebuild on the other OS, 'mtn status' reports a bogus change;
only the line endings have changed.

project.qsf is written by me, and by Quartus (because it assumes I'm
using the GUI to edit options, even though I'm actually using Emacs).
Again, 'mtn status' reports bogus changes.

I can invent an attr 'os_line_endings', and add a function to the
'attr_functions' hook to change the file line ending on workspace
update. But that doesn't fix the bogus changes reported by 'mtn status'.
In fact, it makes it worse; I only get the bogus changes now when I
actually run Quartus. The same workspace contains Ada code, which I
compile far more often. With this attr, I'll get bogus changes all the
time.

Looking thru the code for 'mtn status', it seems I need to modify
file_io.cc 'calculate_indent' to apply the reverse line ending
transformation before computing the file id.

However, I assume adding a call to a Lua hook in 'calculate_ident' will
slow things down a lot. So we'd need to have a fast table lookup of
which files need special treatment, or something. There will be very few
files in my typical workspace that have this attribute.

One way to handle it would be to call the Lua hook to invert the file
transform only if the file_id check fails. That would work in work.cc
workspace::update_current_roster_from_filesystem; I'm not clear about
other places where calculate_ident is used.

Thoughts?

-- 
-- Stephe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]