[texworks] Automatic update of resources

Stefan Löffler st.loeffler at gmail.com
Sun Jan 16 20:09:27 CET 2011


Hi all,

I've just committed (r728) a first implementation of an often requested
feature: automatic updates of resources (i.e., templates, scripts,
configurations, etc.). This way, files on your hard disk are updated
automatically when updates land upstream (in the svn repository) and you
download the new revision. Note that this does _not_ update Tw itself
automatically - you still have to/can do that yourself.

So much for the summary. Now the call for testing and warnings:
This new code is highly experimental, and involves commands that add,
change, and delete files on your hard disk. It should only do that when
updating unmodified files, but this naturally needs testing. I strongly
advise you to make a backup of any files in your resource directory, and
to possibly use Tw's portable mode. Because of the potential dangers
involved, I won't upload the version to GC or the Ubuntu repository
(until we have asserted that there is no (obvious) unintended behavior).
If you want to test it, there are Windows binaries available at
http://web.student.tuwien.ac.at/~e0325258/projects/c/texworks/; Ubuntu
users will have to build this version of Tw themselves.

So, how does this auto-update work, and how to test it.
This feature works by creating a file version database named
TwFileVersions.db in the resource directory. This is a simple text file
with three columns: the svn revision number, an md5 hash, and the file
name. Whenever a new file is installed by Tw, a new entry is created.
When updating, the existing file on the hard disk is compared to the
corresponding entry in the database and only if the two match the file
is updated.
For testing purposes, I've attached a zip file containing the resource
directory as it looked like in r700 (together with a file version
database). You can use that to test how files behave during an update
(since then, the files scripts/system.js, scripts/Hooks/latexErrors.js,
and /templates/Basic LaTeX documents/article.tex have changed; I also
removed completion/tw-basic.txt and added completion/basic.txt instead
to test upstream changes to files).
A few test cases that I can imagine (and that should all work out as
intended) are:
 1) All files as in original revision (i.e., no files added, removed,
changed) -> all should be updated to the current version, new files that
don't exist yet should be added, old files that are no longer maintained
should be removed, and the database should be updated as well
 2) A file was added -> it should not be touched, and should not be
added to the database
 3a) A file was changed -> it should not be touched, and the database
entry should remain at the old version
 3b) After 3a, if the file is changed back to its original form ->
update should proceed as normal (including database)
 3c) After 3a, if the file is replaced by the current version (from svn)
of the file -> database should be updated to show latest version
 4a) A file is removed -> it should not be recreated, old database entry
should be kept
 4b) After 4a, the original file is restored -> update should proceed as
normal (including database)
 4c) After 4a, if the current version (from svn) of the file is put back
-> database should be updated to show latest version

Note: templates only get updated when you call "New from template".

So, all of you who feel adventurous, please test this and report
everything (problems, but also success!). Don't use this in production
environments, though. And don't blame me for data loss - you have been
warned ;).

Cheers,
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: resfiles-r700.zip
Type: application/zip
Size: 31835 bytes
Desc: not available
URL: <http://tug.org/pipermail/texworks/attachments/20110116/e789c325/attachment-0001.zip>


More information about the texworks mailing list