Alexandr N. Zamaraev wrote:
Trent W. Buck writes:
How do I specify the source file encoding?
You can't.  Darcs does not encode or decode files; it merely operates on
sequences of bytes (which for "text" files, are delimited by byte #x0A).
Darcs can not transcode files.
SVN does not do this too.
But SVN allows you to add additional file properties.
Using these properties of external utility can get the information they need, such as coding, programming language or executable.
Is there such a mechanism in Darcs?

No there is not currently a mechanism to set/grab per-file metadata. Darcs doesn't track such information, and to some extent does not need to.

An external utility is expected to get the file information from whatever sources such utilities normally get such information, such as the file extension, file header, or operating system service. For instance, if you need the mimetype of a file you might do a simple lookup from known extensions to mimetypes. The Win32 API has a look-up call against the OS' extension to mimetype table. Posix systems have a ``file`` command that uses the system "magic" tables to determine mimetype.

If you are looking to patch TracDarcs for better syntax highlighting, you might make use of Python's standard ``mimetype`` module:

http://docs.python.org/library/mimetypes.html

You may also want to look at whatever syntax highlighter you are currently using to see what their API for guessing a file type is. For instance, Pygments has a few analysis tools that start with guess_:

http://pygments.org/docs/quickstart/

Hope that helps.

--
--Max Battcher--
http://worldmaker.net
_______________________________________________
darcs-users mailing list
darcs-users@darcs.net
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to