Commit graph

566 commits

Author SHA1 Message Date
Joey Hess
a1bd5b1fa0 don't delay at startup
Still wait 1 minute after a change before waiting on the next change, but don't
wait at the start, when we might get a pull that contains config changes
right away.
2012-10-30 17:23:42 -04:00
Joey Hess
f6208bca0d reload uuid map after editing repo description and saving
Don't rely on the ConfigMonitor thread, it might be too slow.
2012-10-30 17:22:21 -04:00
Joey Hess
93ffd47d76 finished pushing Assistant monad into all relevant files
All temporary and old functions are removed.
2012-10-30 17:14:51 -04:00
Joey Hess
47d94eb9a4 pushed Assistant monad down into DaemonStatus code
Currently have three old versions of functions that more reworking is
needed to remove: getDaemonStatusOld, modifyDaemonStatusOld_, and
modifyDaemonStatusOld
2012-10-30 15:39:15 -04:00
Joey Hess
ea8df8fe9f cleanup daemonStatus accessors 2012-10-30 14:44:18 -04:00
Joey Hess
68118b8986 split remaining assistant types 2012-10-30 14:34:48 -04:00
Joey Hess
f78ca9bc58 split out daemonstatus types 2012-10-30 14:11:14 -04:00
Joey Hess
42babf5012 split Commits and lifted 2012-10-29 19:35:18 -04:00
Joey Hess
d2294f0dfa split Changes and lifted 2012-10-29 19:30:23 -04:00
Joey Hess
39a3adf434 split BranchChange and lifted 2012-10-29 19:20:54 -04:00
Joey Hess
0c584bf70d split ScanRemotes and lifted 2012-10-29 19:14:30 -04:00
Joey Hess
86cb3faf51 moved ThreadedMonad to Types 2012-10-29 19:07:10 -04:00
Joey Hess
87ba4f8677 split and lift Assistant.Pushes 2012-10-29 17:52:43 -04:00
Joey Hess
d5a5c05a79 tweak 2012-10-29 17:02:50 -04:00
Joey Hess
1852eddce6 lift alertWhile 2012-10-29 16:49:47 -04:00
Joey Hess
e18b733c81 move alert display functions 2012-10-29 16:34:11 -04:00
Joey Hess
94ae5d14e5 more lifting 2012-10-29 16:28:45 -04:00
Joey Hess
805ef65679 remove brokendebug 2012-10-29 16:23:22 -04:00
Joey Hess
5d57b28a34 lifted Assistant.Sync into Assistant monad
lots of nice cleanups
2012-10-29 16:22:14 -04:00
Joey Hess
0ffce4a942 tweak 2012-10-29 14:30:10 -04:00
Joey Hess
67ce7929a5 Assistant monad, stage 3
All toplevel named threads are converted to the Assistant monad.

Some utility functions still need to be converted.
2012-10-29 14:07:12 -04:00
Joey Hess
3eecb5b7bb converted 2 more threads.. only 2 more to go 2012-10-29 13:09:58 -04:00
Joey Hess
0ba4df3c1a tweak 2012-10-29 11:58:29 -04:00
Joey Hess
76768ad977 converted 6 more threads 2012-10-29 11:40:22 -04:00
Joey Hess
bad88e404a convert Watcher thread to Assistant monad
This is a nice win; much less code runs in Annex, so other threads have
more chances to run concurrently.

I do notice that renaming a file has gone from 1 to 2 commits. I think this
is due to the above improvement letting the committer run more frequently,
so it commits the rm first.
2012-10-29 09:55:40 -04:00
Joey Hess
4dbdc2b666 Assistant monad, stage 2.5
Converted several threads to run in the monad.

Added a lot of useful combinators for working with the monad.

Now the monad includes the name of the thread.

Some debugging messages are disabled pending converting other threads.
2012-10-29 02:21:04 -04:00
Joey Hess
4e765327ca Assistant monad, stage 1
This adds the Assistant monad, and an AssistantData structure.
So far, none of the assistant's threads run in the monad yet.
2012-10-29 00:15:43 -04:00
Joey Hess
64e1d7b579 send git-annex tag in initial presence
Will be used for finding other git-annex clients for pairing
2012-10-28 17:07:29 -04:00
Joey Hess
4ac2fd0a22 ensure that git-annex branch is pushed after a successful transfer
I now have this topology working:

   assistant ---> {bare repo, special remote} <--- assistant

And, I think, also this one:

        +----------- bare repo --------+
        v                              v
  assistant ---> special remote <--- assistant

While before with assistant <---> assistant connections, both sides got
location info updated after a transfer, in this topology, the bare repo
*might* get its location info updated, but the other assistant has no way to
know that it did. And a special remote doesn't record location info,
so transfers to it won't propigate out location log changes at all.

So, for these to work, after a transfer succeeds, the git-annex branch
needs to be pushed. This is done by recording a synthetic commit has
occurred, which lets the pusher handle pushing out the change (which will
include actually committing any still journalled changes to the git-annex
branch).

Of course, this means rather a lot more syncing action than happened
before. At least the pusher bundles together very close together pushes,
somewhat. Currently it just waits 2 seconds between each push.
2012-10-28 16:05:34 -04:00
Joey Hess
5406416234 add git-annex branch commit when assistant is syncing
Seems nothing else ensures the branch is committed anymore.
2012-10-28 15:33:21 -04:00
Joey Hess
531f1d1446 add XMPP nudge alert, displayed after making a cloud repository 2012-10-27 12:25:29 -04:00
Joey Hess
b72d04988f add an icon for The Cloud
I am befuddled that Twitter Bootstrap has no built-in Icon for The Cloud,
and also that Chromium's depiction of CLOUD (U+2601) has an uncanny
resemblance to PILE OF POO (U+1F4A9) when rendered small, and looks like a
looming Frankenstorm when rendered large, and not a sweet, sunny, nothing
can go wrong The Cloud.
<http://www.fileformat.info/info/unicode/char/2601/browsertest.htm>

So, I must resort to irony in my choice of icons.
2012-10-27 11:24:35 -04:00
Joey Hess
c71836269b (re)start XMPP when it's configured in the webapp 2012-10-27 00:50:14 -04:00
Joey Hess
2dc40ecbd1 reconnect XMPP when NetWatcher notices a change 2012-10-27 00:42:14 -04:00
Joey Hess
9fc8257392 xmpp reconnection
If it managed to run for 5 minutes, reconnect immediately. Otherwise,
wait 5 minutes before reconnecting.
2012-10-27 00:06:17 -04:00
Joey Hess
0c0ef99341 gnutls segfault fixed
Adjust build deps to ensure that only a fixed version of the library will
be used.

Also, removed the bound thread stuff, which I now think was (probably)
a red herring.
2012-10-26 23:07:30 -04:00
Joey Hess
d1e5f2d596 Merge branch 'master' into xmpp
Conflicts:
	Assistant/Threads/NetWatcher.hs
2012-10-26 19:42:24 -04:00
Joey Hess
8e4620a6c7 NetWatcher: When dbus connection is lost, try to reconnect.
MountWatcher can't do this, because it uses the session dbus,
and won't have access to the new DBUS_SESSION_BUS_ADDRESS if a new session
is started.

Bumped dbus library version, FD leak in it is fixed.
2012-10-26 19:38:27 -04:00
Joey Hess
6803667f00 store xmpp creds from form 2012-10-26 17:13:30 -04:00
Joey Hess
1d04dff4f0 split out xmpp utilities 2012-10-26 14:44:36 -04:00
Joey Hess
82b7e835e4 run xmpp test in bound thread 2012-10-26 14:39:22 -04:00
Joey Hess
07494cbb4b XMPP configuration form
Currently relies on SRV being set, or the JID's hostname being the server
hostname and the port being default. Future work: Allow manual
configuration of user name, hostname, and port.
2012-10-26 14:17:09 -04:00
Joey Hess
a11fb94c65 SRV record construction 2012-10-26 13:03:08 -04:00
Joey Hess
5544ca2fb8 build fix with pairing disabled 2012-10-26 12:56:19 -04:00
Joey Hess
8916ff1a6c hook up SRV lookups for XMPP 2012-10-26 12:55:29 -04:00
Joey Hess
0b1cf3a766 Merge branch 'master' into xmpp
Conflicts:
	Assistant/Threads/MountWatcher.hs
	Assistant/Threads/NetWatcher.hs
2012-10-26 00:10:41 -04:00
Joey Hess
ef7b53e784 improved dbus error handling
Now when the dbus connection is dropped, it'll fall back to polling.

I could make it try to reconnect, but there's a FD leak in the dbus
library, so not yet.
2012-10-26 00:02:03 -04:00
Joey Hess
7ee0ffaeb9 Use USER and HOME environment when set, and only fall back to getpwent, which doesn't work with LDAP or NIS. 2012-10-25 18:17:54 -04:00
Joey Hess
fe96b28b4d convert the assistant to use a bound thread for XMPP
This *may* solve the segfault I was seeing when the XMPP library called
startTLS. My hypothesis is as follows:

* TLS is documented
  (http://www.gnu.org/software/gnutls/manual/gnutls.html#Thread-safety)
  thread safe, but only when a single thread accesses it.
* forkIO threads are not bound to an OS thread, so it was possible for
  the threaded runtime to run part of the XMPP code on one thread, and
  then switch to another thread later.

So, forkOS, with its bound threads, should be used for the XMPP thread.
Since the crash doesn't happen reliably, I am not yet sure about this fix.

Note that I kept all the other threads in the assistant unbound, because
bound threads have significantly higher overhead.
2012-10-25 15:47:27 -04:00
Joey Hess
8c9c8e3110 only use one push attribute
When pushing to multiple UUIDs, combine them all into a single push
attribute.
2012-10-25 13:31:45 -04:00
Joey Hess
91c0c7b9ef switch from presence toggle hack to git-annex tag in presence extended content
Push notifications are actually working over XMPP now!
2012-10-25 13:04:43 -04:00
Joey Hess
52d380d7f0 add a separate field for the JID 2012-10-24 19:09:02 -04:00
Joey Hess
145202f21e flip availablility
Seems presence notifications are not sent to clients that have marked
themselves unavailable. (Testing with google talk.)

This is the death knell for the presence hack, because it has to stay
available, and even the toggle to unavailable and back could cause it to
miss a notification. Still, flipped it so it basically works, for now.
2012-10-24 17:23:21 -04:00
Joey Hess
422b426460 pull from one of the remotes in a push notification
Still need to do something about transfer queueing, however. This could be
a real can of worms.
2012-10-24 16:21:45 -04:00
Joey Hess
32497feb2a initial implementation of XMPP push notifier (untested)
Lacking error handling, reconnection, credentials configuration,
and doesn't actually do anything when it receives an incoming notification.

Other than that, it might work! :)
2012-10-24 15:42:02 -04:00
Joey Hess
ae8a3ab31e added push notifier thread, currently a no-op
Hooked up everything that needs to notify on pushes. Note that
syncNewRemote does not notify. This is probably ok, and I'd need to thread
more state through to make it do so.

This is only set up to support a single push notification method; I didn't
use a NotificationBroadcaster. Partly because I don't yet know what info
about pushes needs to be communicated, so my data types are only
preliminary.
2012-10-24 13:38:28 -04:00
Joey Hess
6b6ce30b42 use a newtype for better type safety 2012-10-24 13:15:31 -04:00
Joey Hess
95f17ed0de webapp: Switched to using the same multicast IP address that avahi uses. 2012-10-22 15:50:30 -04:00
Joey Hess
12efabf070 webapp: Allow dashes in ssh key comments when pairing. 2012-10-22 11:18:19 -04:00
Joey Hess
bcaf320ed8 push out config changes 2012-10-21 15:50:49 -04:00
Joey Hess
452e6819d0 !! removal 2012-10-21 00:51:42 -04:00
Joey Hess
c7c2015435 add ConfigMonitor thread
Monitors git-annex branch for changes, which are noticed by the Merger
thread whenever the branch ref is changed (either due to an incoming push,
or a local change), and refreshes cached config values for modified config
files.

Rate limited to run no more often than once per minute. This is important
because frequent git-annex branch changes happen when files are being
added, or transferred, etc.

A primary use case is that, when preferred content changes are made,
and get pushed to remotes, the remotes start honoring those settings.
Other use cases include propigating repository description and trust
changes to remotes, and learning when a remote has added a new special
remote, so the webapp can present the GUI to enable that special remote
locally.

Also added a uuid.log cache. All other config files already had caches.
2012-10-20 16:43:35 -04:00
Joey Hess
813b28aa49 removed 3 partial !! and got a much nicer implementation
Yay, monadic Either!
2012-10-20 16:21:39 -04:00
Joey Hess
14b376d440 Merge branch 'safesemaphore'
Conflicts:
	debian/changelog
	git-annex.cabal
2012-10-20 12:44:25 -04:00
Joey Hess
73c28d2ca7 nasty race workaround 2012-10-19 16:59:18 -04:00
Joey Hess
f4c3a45da0 check preferred content when a file is moved or created
This can result in the file being dropped, or being downloaded, or even
being dropped from some other repo.

It's even possible to create a file in a directory where content is not
wanted, which will make the assistant immediately send it elsewhere, and
then drop it.
2012-10-19 14:22:13 -04:00
Joey Hess
9c89924c05 check and drop after uploads 2012-10-18 16:05:43 -04:00
Joey Hess
ee9e0702a2 check and drop unwanted content from remotes after receiving a transfer 2012-10-18 15:37:57 -04:00
Joey Hess
dea125e1b7 split 2012-10-18 15:22:28 -04:00
Joey Hess
f7f34d2072 drop unwanted content in the transfer scan
This was complicated quite a bit by needing to check numcopies. I optimised
that, so it only looks up numcopies once per file, no matter how many
remotes it checks to drop from. Although it did just occur to me that
it might be better to first check if it wants to drop content, and only
then check numcopies..
2012-10-18 15:07:11 -04:00
Joey Hess
dbe8de40ab minor transfer scanner code reworking
Also a small optimisation using a Set
2012-10-18 13:42:17 -04:00
Nicolas Pouillard
03ba7d6a87 One more #ifdef WITH_S3 2012-10-18 12:43:24 -04:00
Nicolas Pouillard
6b0a6cd226 import S3 only when enabled 2012-10-18 12:42:57 -04:00
Joey Hess
362e18e3fd allow renaming git remotes in the edit form 2012-10-14 17:18:01 -04:00
Joey Hess
08e1efb278 make repo description optional 2012-10-14 16:32:55 -04:00
Joey Hess
8932acb5d0 redirect to the new repository version of the end form 2012-10-14 16:11:21 -04:00
Joey Hess
2aacae3ebb always make removable drive repos bare
None-bare removable drive repos don't have the assistant running in them,
so don't get their master branch updated as syncs come in. This will
probably change later, but for now, set up something that works.

Also, set the description of a newly added drive's repo locally. This
ensures that the repo edit form has the description in it.
2012-10-14 15:53:40 -04:00
Joey Hess
51ef707a59 nub the autostart file
It's possible for the file to get duplicate lines in it, and if so, we want
to ignore the dups.
2012-10-14 15:19:34 -04:00
Joey Hess
6144f325b9 reorder
get list of remotes after, rather than before, a potentially blocking action
2012-10-14 15:09:37 -04:00
Joey Hess
592d55ef7c fix display of transfers for remotes not in syncRemotes list 2012-10-14 14:51:11 -04:00
Joey Hess
6ea6a2e71c better variable name 2012-10-14 14:50:03 -04:00
Joey Hess
b2d266267f avoid queuing transfers for remotes after syncing to them is paused
This avoids the expensive transfer scan relying on its list of remotes
to scan being accurate throughout, which it will not be when the user
pauses syncing to a remote.

I feel it's ok to queue transfers to *any* known remote, not just the ones
being scanned.

Note that there are still small races where after syncing to a remote is
paused, a transfer can be queued for it. Not just in the expensive transfer
scan, but in the cheap failed transfer scan, and elsewhere.
2012-10-14 14:34:05 -04:00
Joey Hess
3f06c883f2 hook up syncing toggles
Although I observe that these toggles don't always prevent syncing.
When a transfer scan is active, it will still queue items from the disabled
remote.

Also, transfers from a disabled remote show up as from "unknown", which is
not ideal.
2012-10-12 12:45:16 -04:00
Joey Hess
549c779a38 use gitRepo 2012-10-12 01:17:45 -04:00
Joey Hess
a7642b3b6e add syncing enabled/disabled to repo list with icon, and toggle link
The toggle link doesn't work yet.

Also lots of refactoring and type improvements
2012-10-12 01:09:28 -04:00
Joey Hess
9b760150b7 fix crash when editing the current repo 2012-10-11 19:36:28 -04:00
Joey Hess
0b266f970f set/unset annex-sync, rather than annex-ignore
This reserves annex.ignore for repos that should not be visible at all;
repos with syncing disabled are now skipped by the assistant, but are
displayed in the list and can be configured.
2012-10-11 19:22:29 -04:00
Joey Hess
f31d292ab1 after setting up a new repo, go to a special version of the configuration page 2012-10-11 17:35:08 -04:00
Joey Hess
5b9900133c allow disabling syncing to a repo on its edit form
This is not quite right yet, since it disables it so hard it doesn't show
up in the repo list anymore!
2012-10-11 17:14:42 -04:00
Joey Hess
4ef6dac5c2 webapp: Improve wording of intro display. Closes: #689848 2012-10-11 15:04:38 -04:00
Joey Hess
7aef34f501 implement saving of repository settings 2012-10-10 19:13:49 -04:00
Joey Hess
f7214e4de3 avoid pairlistener crash
I noticed this while offline (so that lack of solar power is good for something).

Apparently it tries to bind multicast to lo, and that fails.
If this happens, catch it, and retry until a real network interface becomes
available.

It may be that this should tie into the NetWatcher, and rebind whenever
an interface comes up. Needs testing..
2012-10-10 16:48:06 -04:00
Joey Hess
5d85c1497c fix setting the group of the first repo created 2012-10-10 16:32:15 -04:00
Joey Hess
4e2e08b45a ui for selecting a repository group 2012-10-10 16:23:41 -04:00
Joey Hess
39be7eea40 add standard group selector to repo edit form 2012-10-10 16:04:28 -04:00
Joey Hess
9da7dd8874 webapp: configure new repos to use the standard preferred content settings 2012-10-10 15:35:10 -04:00
Joey Hess
3490977d97 webapp: put new repos in standard groups
I'm using transfer for most things, both removable drives and cloud
storage, because it's the safest choice. We'll see if it makes sense
to prompt for the group when setting this up, or let the user pick
something else after the fact.
2012-10-10 15:27:25 -04:00
Joey Hess
f06587ba23 basic repository edit form
Only shows description so far.
2012-10-09 15:11:48 -04:00
Joey Hess
b6a3f03f82 add "configure" link to each repository in the webapp's repo list 2012-10-09 14:43:53 -04:00
Joey Hess
a5781fd9ba webapp automatic grouping
webapp: Adds newly created repositories to one of these groups:
clients, drives, servers

This is heuristic, but it's a pretty good heuristic, and can always be
configured.
2012-10-09 14:24:17 -04:00
Joey Hess
8eb1ba4cfe revert bad change 2012-10-09 13:49:27 -04:00
Joey Hess
5ac15149cc assistant: Now honors preferred content settings when deciding what to transfer.
Both when queueing downloads, and uploads, consults the preferred content
settings.

I didn't make it check yet when requeing failed transfers or queuing
deferred downloads; dealing with the preferred content settings (or indeed,
other settings) changing while the assistant is running still needs work.
2012-10-09 12:18:41 -04:00
Ben Gamari
cff451b37c TransferSlots: Use SafeSemaphore's MSemN instead of QSemN from base
As described in the documentation, QSemN is unsafe for a variety of
reasons.
2012-10-05 17:02:51 -04:00
Joey Hess
47314c0fad fix last zombies in the assistant
Made Git.LsFiles return cleanup actions, and everything waits on
processes now, except of course for Seek.
2012-10-04 19:56:32 -04:00
Joey Hess
9a3471971b avoid crashing committer if it fails to stage changes
Just retry later.
2012-10-02 18:04:06 -04:00
Joey Hess
9aab70de66 always check with ls-files before adding new files
Makes it safe to use git annex unlock with the watcher/assistant.
And also to mix use of the watcher/assistant with regular files stored in git.

Long ago, I had avoided doing this check, except during the startup scan,
because it would be slow to run ls-files repeatedly.

But then I added the lsof check, and to make that fast, got it to detect
batch file adds. So let's move the ls-files check to also occur when it'll
have a batch, and can check them all with one call.

This does slow down adding a single file by just a bit, but really only
a little bit. (The lsof check is probably more expensive.) It also
speeds up the startup scan, especially when there are lots of new files
found by the scan.

Also, fixed the sleep for annex.delayadd to not run while the threadstate
lock is held, so it doesn't unnecessarily freeze everything else.

Also, --force no longer makes it skip the lsof check, which was not
documented, and seems never a good idea.
2012-10-02 17:41:23 -04:00
Joey Hess
33fdcd59be tweak 2012-09-29 16:22:53 -04:00
Joey Hess
74a6e8ff60 avoid some warnings when built w/o dbus 2012-09-29 16:09:07 -04:00
Joey Hess
0ccfb3bbb2 let's not -DOSX, that results in unwanted mangling 2012-09-29 14:49:15 -04:00
Joey Hess
cc0e5b7c52 use getAddrInfo, to support ipv6 2012-09-29 12:50:12 -04:00
Joey Hess
3f70dafcd4 sanitize all git remote names 2012-09-29 12:27:43 -04:00
Joey Hess
2f86fdc36a ifdef osx includes 2012-09-28 19:18:08 -04:00
Joey Hess
e88e3ba85b standalone linux app nearly ready
also made several fixes that apply to the OSX app
2012-09-28 19:08:13 -04:00
Joey Hess
fede52ac05 if the webapp is started with a cwd the user can't write to, don't suggest it
Fall back to somewhere under $HOME instead.

I had a report that git-annex.app on OSX was coming up with "/" as the
suggested location on first run.
2012-09-28 16:04:49 -04:00
Joey Hess
1087fac544 add a alert at the top of the main part of the webapp, above the transfers display
Based on feedback that it was too sparse to be clear what it's doing.
2012-09-28 13:30:29 -04:00
Joey Hess
64514a3db3 close unreproducible bug and remove expensive code added to debug it 2012-09-28 12:56:58 -04:00
Joey Hess
06a2427deb disable etags on yesod static site
Seems buggy, it was causing redirects from /static/jquery-full.js to
/jquery-full.js. Only in some builds, like Jimmy's.
2012-09-28 12:34:44 -04:00
Joey Hess
8b61bac418 put version on about page 2012-09-27 18:09:05 -04:00
Joey Hess
a02d6b36d8 Add OSX standalone app license bundle, and arrange for the About page
to link to it.
2012-09-27 16:47:52 -04:00
Joey Hess
8bc70a85c6 add tooltips 2012-09-27 12:55:00 -04:00
Joey Hess
7f78bc92b6 webapp: Avoid crashing when ssh-keygen -F chokes on an invalid known_hosts file. 2012-09-27 11:27:16 -04:00
Joey Hess
3979086035 use ~/.ssh/git-annex-shell wrapper
This was needed for the OSX self-contained app, but is a generally good
idea. It avoids needing perl; is probably faster; and could eventually
be replaced by something faster yet.
2012-09-26 18:59:18 -04:00
Joey Hess
9c4a23cab1 install a git-annex-shell shim script when the standalone OSX app runs
I put it in ~/.ssh/ because there's no reliable way to get it into PATH,
and OSX ssh doesn't even honor user's PATH by default.

authorized_keys generators will need to check if it's there. Not done yet.
2012-09-26 17:23:45 -04:00
Joey Hess
3da78cc241 make the standalone OSX app automatically install itself when run 2012-09-26 16:50:04 -04:00
Joey Hess
c2c577f34f allow enabling existing S3 repos 2012-09-26 15:24:23 -04:00
Joey Hess
17708dd173 add a configurator for S3 2012-09-26 14:44:07 -04:00
Joey Hess
cb3c9340f8 license the webapp under the AGPL 3+
This means that anyone serving up the webapp to users as a service
(ie, without providing any git-annex binary at all to the user) still needs
to provide a link to the source code for it, including any modifications
they may make.

This may make git-annex be covered by the AGPL as a whole when it is built
with the webapp. If in doubt, you should ask a lawyer.

When git-annex is built with the webapp disabled, no AGPLed code is used.
Even building in the assistant does not pull in AGPLed code.
2012-09-24 14:48:47 -04:00
Joey Hess
96b0e3d6e9 quiet calls to transferkey 2012-09-24 13:36:05 -04:00
Joey Hess
364b40e5fc don't queue uploads for failed downloads 2012-09-24 13:16:08 -04:00
Joey Hess
2840105ec4 default annex.delayadd to 1 on OSX 2012-09-21 19:43:15 -04:00
Joey Hess
084aba8aaf fix breakage caught by test suite
Can't use show-ref --tags --branches, as that omits remote branches.
Instead, filter out the synced refs directly.
2012-09-21 00:49:48 -04:00
Joey Hess
68ad7de4d0 watch for changes to transfer info files, to update progress bars on upload
This is handled differently for inotify, which can track modifications of
existing files, and kqueue, which cannot (TTBOMK). On the inotify side,
the TransferWatcher just waits for the file to be updated and reads the new
bytesComplete. On the kqueue side, the TransferPoller has to re-read the
file every update (currently 0.5 seconds, might need to increase that).

I did think about working around kqueue's limitations by somehow creating
a new file each time the size changed. But cleaning up all the files that
would result seemed difficult. And really, this is not a lot worse than
the TransferWatcher's behavior for downloads, which stats a file every 0.5
seconds. As long as the OS has decent file caching behavior..
2012-09-20 17:24:40 -04:00
Joey Hess
19e35f7f0d upload progress bar for git remote on same filesystem
cp is used here, but we can just watch the size of the destination file

This commit made from within the ruins of an old mill, overlooking a
beautiful waterfall.
2012-09-20 13:35:53 -04:00
Joey Hess
45a26175d6 renamed RsyncFile -> Rsync 2012-09-19 14:28:32 -04:00
Joey Hess
355ef8f3ea add annex.delayadd configuration 2012-09-19 13:30:25 -04:00
Joey Hess
d50d89eb6f support old versions of git that do not have --allow-empty-message 2012-09-19 12:58:53 -04:00
Joey Hess
c4e8591351 add missing --no-verify to prevent the pre-commit hook's git annex fix 2012-09-19 12:48:32 -04:00
Joey Hess
18bae020ed make other repositories list list all autostarted repos
And add a form to add another, unrelated repository
2012-09-18 17:50:07 -04:00
Joey Hess
ba27483c6a avoid making empty commits
This doesn't avoid it sometimes attempting to commit when there are no
changes. Typically that happens when a change is pushed in from another
repo; the watcher sees the file and tries to stage it, resulting in an
empty commit. Really fixing that would probably use more CPU than
occasionally trying to make an empty commit.

However, this does save a lot of unnecessary work, as those empty commits
had to be synced out, which no longer happens.
2012-09-18 14:43:56 -04:00
Joey Hess
9f05d19108 avoid sending uploads right back to where the download came from
Just an optimisation.
2012-09-18 14:24:51 -04:00
Joey Hess
3a0cffcfed when a Download finishes, queue Uploads
This ensures file propigate takes place in situations such as: Usb drive A
is connected to B. A's master branch is already in sync with B, but it is
being used to sneakernet some files around, so B downloads those. There is no
master branch change, so C does not request these files. B needs to upload
the files it just downloaded on to C, etc.

My first try at this, I saw loops happen. B uploaded to C, which then
tried to upload back to B (because it had not received the updated
git-annex branch from B yet). B already had the file, but it still created
a transfer info file from the incoming transfer, and its watcher saw
that be removed, and tried to upload back to C.

These loops should have been fixed by my previous commit. (They never
affected ssh remotes, only local ones, it seemed.) While C might still try
to upload to B, or to some other remote that already has the file, the
extra work dies out there.
2012-09-18 14:10:33 -04:00
Joey Hess
adf5195082 run current branch merge in annex monad
I was seeing some interesting crashes after the previous commit,
when making file changes slightly faster than the assistant could keep up.

error: Ref refs/heads/master is at 7074f8e0a11110c532d06746e334f2fec6af6ab4 but expected 95ea86008d72a40d97a81cfc8fb47a0da92166bd
fatal: cannot lock HEAD ref
Committer crashed: git commit [Param "--allow-empty-message",Param "-m",Param "",Param "--allow-empty",Param "--quiet"] failed
Pusher crashed: thread blocked indefinitely in an STM transaction

Clearly the the merger ended up running at the same time as the committer,
and with both modifying HEAD the committer crashed. I fixed that by
making the Merger run its merge inside the annex monad, which avoids
it running concurrently with other git operations. Also by making
the committer not crash if git fails.

What I don't understand is why the pusher then crashed with a STM deadlock.
That must be in either the DaemonStatusHandle or the FailedPushMap,
and the latter is only used by the pusher. Did the committer's crash somehow
break STM?

The BlockedIndefinitelyOnSTM exception is described as:

-- |The thread is waiting to retry an STM transaction, but there are no
-- other references to any @TVar@s involved, so it can't ever continue.

If the Committer had a reference to a TVar and crashed, I can sort of see
this leading to that exception..

The crash was quite easy to reproduce after the previous commit, but
after making the above change, I have yet to see it again. Here's hoping.
2012-09-17 22:04:43 -04:00
Joey Hess
3c22977e44 deferred downloads
Now when a download is queued and there's no known remote to get it from,
it's added to a deferred download list, which will be retried later.

The Merger thread tries to queue any deferred downloads when it receives
a push to the git-annex branch.

Note that the Merger thread now also forces an update of the git-annex
branch. The assistant was not updating this branch before, and it saw a
(mostly) correct view of state, but now that incoming pushes go to
synced/git-annex, it needs to be merged in.
2012-09-17 21:05:50 -04:00
Joey Hess
7a86dc9443 cleanup 2012-09-17 14:58:43 -04:00
Joey Hess
70cf66fded simplify 2012-09-17 13:41:13 -04:00
Joey Hess
e8188ea611 flip catchDefaultIO 2012-09-17 00:18:07 -04:00
Joey Hess
ba744c84a4 better name for fallback sync refs
Don't expose these as branches in refs/heads/. Instead hide them away in
refs/synced/ where only show-ref will find them.

Make unused only look at branches and tags, not these other things,
so it won't care if some stale sync ref used to use a file.

This means they don't need to be deleted, which could have
led to an incoming sync being missed.
2012-09-16 23:09:08 -04:00
Joey Hess
ddacbbe798 ensure outgoing sync pushes always succeed when repo is accessible
The fallback branches pushed to contain the uuid of the pusher, which is
ugly. That's why syncing doesn't normally use this method.

The merger deletes fallback branches after merging them, to contain the
ugliness, and so unused doesn't look at data from these branches.
(The fallback git-annex branch is left behind for now.)
2012-09-16 19:57:13 -04:00
Joey Hess
6cddda4143 make the merger merge any equivilant sync branch into the current branch
Not just synced/master, but synced/UUID/master, for example
2012-09-16 19:41:26 -04:00
Joey Hess
74906ed13f UI for enabling special remotes
Now other repositories can configure special remotes, and when their
configuration has propigated out, they'll appear in the webapp's list of
repositories, with a link to enable them.

Added support for enabling rsync special remotes, and directory special
remotes that are on removable drives. However, encrypted directory special
remotes are not supported yet. The removable drive configuator doesn't
support them yet anyway.
2012-09-13 16:50:02 -04:00