|
From: | Thomas Keller |
Subject: | Re: [Monotone-devel] mtn cat vs. mtn automate get_file |
Date: | Sun, 19 Nov 2006 16:47:38 +0100 |
User-agent: | Thunderbird 1.5.0.8 (Macintosh/20061025) |
Nathaniel Smith schrieb:
Does it matter? If the file can be displayed reasonably as text, then you might as well do so; if it can't, then it doesn't matter what the user says, you can't show it as text. I think a heuristic based on the file contents should be sufficient here... (this is exactly what diff(1) does, for that matter).
Now, if monotone could serve me such a heuristic, this would be nice. Otherwise I could only think of "check every byte in a string and if there is a zero byte \0, handle it as binary". I don't know if its that simple, but I doubt it a bit. What could make problems for example is text encoded in different encodings which use multiple bytes and I could accidently handle the first byte of one letter as a binary indicator. This leads me to another interesting question: Has monotone any internal knowledge of different charsets or is just everything utf-8 and only decoded into the user's charset if its written to disk? So, do I get contents in utf-8 out or the charset (whichever it was) the user checked in?
'cat' seems like a fundamental enough operation that we might as well just provide it as a primitive. ('get_file' is a primitive too, in a difference sense.) Perhaps get_file_of, by analogy to get_manifest_of?
Out of curiousity: What is the difference between both primitives beside that they take different arguments? Wouldn't it be better to have one command with different input rather than two?
Thomas. -- ICQ: 85945241 | SIP: 1-747-027-0392 | http://www.thomaskeller.biz > Guitone, a frontend for monotone: http://guitone.berlios.de > Music lyrics and more: http://musicmademe.com
[Prev in Thread] | Current Thread | [Next in Thread] |