post my current set of ideas for handling unlocking

This commit is contained in:
Joey Hess 2012-06-28 14:00:25 -04:00
parent e4596a133e
commit 343ecf999a

View file

@ -1,43 +1,28 @@
When having "git annex watch" running, unlocking files causes the watcher to immediately lock/commit them. Observe:
When having "git annex watch" running, unlocking files causes the watcher
to immediately lock/commit them.
bram@falafel% git annex unlock
unlock 01 - Crunchy Joe (featuring Sakhile Moleshe).flac (copying...) ok
unlock 02 - Get Busy Living (featuring Emily Bruce).flac (copying...) ok
unlock 03 - Show You How.flac (copying...) ok
unlock 04 - Call Me (featuring Monique Hellenberg).flac (copying...) ok
unlock 05 - Humbug (featuring Sakhile Moleshe).flac (copying...) ok
unlock 06 - Brush Your Hair.flac (copying...) ok
unlock 07 - We Come Together (featuring Sakhile Moleshe).flac (copying...) ok
unlock 08 - In Too Deep (featuring Emily Bruce).flac (copying...) ok
unlock 09 - My Rainbow.flac (copying...) ok
unlock 10 - Big Band Wolf.flac (copying...) ok
(Recording state in git...)
bram@falafel% ls -l 01\ -\ Crunchy\ Joe\ \(featuring\ Sakhile\ Moleshe\).flac
lrwxrwxrwx 1 bram bram 208 Jul 18 2011 01 - Crunchy Joe (featuring Sakhile Moleshe).flac -> ../../.git/annex/objects/KX/15/SHA256E-s23981083--5ffd30042e313f8e10cf51ded59c369dd03a600fa3b8c13962f833694af449b5.flac/SHA256E-s23981083--5ffd30042e313f8e10cf51ded59c369dd03a600fa3b8c13962f833694af449b5.flac
bram@falafel% tail ~/Media/.git/annex/daemon.log
add ./Uncategorized/Goldfish - Get Busy Living (2010)/04 - Call Me (featuring Monique Hellenberg).flac (checksum...) ok
add ./Uncategorized/Goldfish - Get Busy Living (2010)/03 - Show You How.flac (checksum...) ok
add ./Uncategorized/Goldfish - Get Busy Living (2010)/02 - Get Busy Living (featuring Emily Bruce).flac (checksum...) ok
add ./Uncategorized/Goldfish - Get Busy Living (2010)/10 - Big Band Wolf.flac (checksum...) ok
add ./Uncategorized/Goldfish - Get Busy Living (2010)/09 - My Rainbow.flac (checksum...) ok
add ./Uncategorized/Goldfish - Get Busy Living (2010)/08 - In Too Deep (featuring Emily Bruce).flac (checksum...) ok
add ./Uncategorized/Goldfish - Get Busy Living (2010)/07 - We Come Together (featuring Sakhile Moleshe).flac (checksum...) ok
add ./Uncategorized/Goldfish - Get Busy Living (2010)/06 - Brush Your Hair.flac (checksum...) ok
(Recording state in git...)
(Recording state in git...)
bram@falafel% git annex watch --stop
bram@falafel% git annex unlock
unlock 01 - Crunchy Joe (featuring Sakhile Moleshe).flac (copying...) ok
unlock 02 - Get Busy Living (featuring Emily Bruce).flac (copying...) ok
unlock 03 - Show You How.flac (copying...) ok
unlock 04 - Call Me (featuring Monique Hellenberg).flac (copying...) ok
unlock 05 - Humbug (featuring Sakhile Moleshe).flac (copying...) ok
unlock 06 - Brush Your Hair.flac (copying...) ok
unlock 07 - We Come Together (featuring Sakhile Moleshe).flac (copying...) ok
unlock 08 - In Too Deep (featuring Emily Bruce).flac (copying...) ok
unlock 09 - My Rainbow.flac (copying...) ok
unlock 10 - Big Band Wolf.flac (copying...) ok
bram@falafel% ls -l 01\ -\ Crunchy\ Joe\ \(featuring\ Sakhile\ Moleshe\).flac
-rw-r--r-- 1 bram bram 23981083 Jul 18 2011 01 - Crunchy Joe (featuring Sakhile Moleshe).flac
----
This is using git-annex 3.20120624 on Ubuntu, compiled with cabal (I upgraded my libghc-stm-dev package, as you mentioned in another bug, to get the watch command working on this version).
Possible approaches:
* The watcher could detect unlocked files by checking if newly added files
are a typechange of a file already in git. But this would add git overhead
to every file add.
* `git annex unlock` could add some type of flag file, which the assistant
could check. This would work fine, for users who want to use `git annex
unlock` with the assistant. That's probably not simple enough for most
users, though.
* There could be a UI in the assistant to pick a file and unlock it.
The assistant would have its own list of files it knows are unlocked.
But I'm trying to avoid mandatory UI to use the assistant.
* Perhaps instead, have a directory, like "edit". The assistant could notice
when files move into this special directory, and automatically unlock them.
Then when they're moved out, automatically commit them.
* Alternatively, files that are moved out of the repository entirely could be
automatically unlocked, and then when they're moved back in, it would
automatically do the right thing. This may be worth implementing in
combination with the "edit" directory, as different use cases would work
better with one or the other. However, I don't currently get inotify
events when files are moved out of the repository (well, I do, but it
just says "file moved", with no forwarding address, so I don't know
how to find the file to unlock it.