Commit graph

425 commits

Author SHA1 Message Date
Joey Hess
95db595e91 make startup scan for deleted files work in direct mode
git add --update cannot be used, because it'll stage typechanged direct
mode files. Intead, use ls-files to find deleted files, and stage them
ourselves.

It seems that no commit was made before when the scan staged deleted files.
(Probably masked since if files were added, a commit happened then..)
Now that I'm doing the staging, I was also able to fix that bug.
2012-12-24 14:24:13 -04:00
Joey Hess
c6d2bbe402 assistant adding of files in direct mode 2012-12-24 13:37:29 -04:00
Joey Hess
82617b92e9 move thirdparty program installation for standalone bundle into haskell program
This allows it to use Build.SysConfig to always install the programs
configure detected. Amoung other fixes, this ensures the right uuid
generator and checksum programs are installed.

I also cleaned up the handling of lsof's path; configure now checks for
it in PATH, but falls back to looking for it in sbin directories.
2012-12-14 16:07:59 -04:00
Joey Hess
0d50a6105b whitespace fixes 2012-12-13 00:45:27 -04:00
Joey Hess
99a8a5297c --auto fixes
* get/copy --auto: Transfer data even if it would exceed numcopies,
  when preferred content settings want it.
* drop --auto: Fix dropping content when there are no preferred content
  settings.
2012-12-06 13:22:16 -04:00
Joey Hess
5de0215986 remove dead code 2012-12-01 15:21:24 -04:00
Joey Hess
2f50af5273 better function name 2012-12-01 15:00:03 -04:00
Joey Hess
d2df2e52b4 remove hard link when sanity check failed
See http://git-annex.branchable.com/forum/dot_git_slash_annex_slash_tmp/
2012-11-29 16:54:51 -04:00
Joey Hess
3b35cde0e8 assistant: Retrival from glacier now handled. 2012-11-29 15:23:33 -04:00
Joey Hess
18fe34222a allow building webapp w/o webdav 2012-11-25 14:36:24 -04:00
Joey Hess
463cf58140 webapp and assistant glacier support 2012-11-24 16:30:15 -04:00
Joey Hess
c282c8b492 queue uploads when a new or renamed symlink is handled 2012-11-24 15:38:24 -04:00
Joey Hess
7addb89dc1 webapp: support box.com 2012-11-17 15:30:11 -04:00
Joey Hess
d468e37f46 automatic repolist updating 2012-11-13 17:50:54 -04:00
Joey Hess
8b22bd8831 add a yes/no confirm for xmpp pairing requests 2012-11-11 22:29:16 -04:00
Joey Hess
522e228aef auto-accept pair requests from JIDs already paired with 2012-11-11 18:16:11 -04:00
Joey Hess
5e44ab177c don't try to transfer data to/from XMPP remotes
Partition syncRemotes into ones needing git sync (ie, non-special remotes),
and ones needing data sync (ie, non-XMPP remotes).
2012-11-11 16:23:16 -04:00
Joey Hess
217eeede43 allow both one push and one receive-pack to run at the same time
Noticed that when pairing, sometimes both sides start to push, and the other
side sends a PushRequest, and the two deadlock, neither doing anything.
(Timeout eventually breaks this.) So, let both run at the same time.
2012-11-11 15:42:03 -04:00
Joey Hess
41085cdc8c set negative XMPP presence priority
This should help prevent git-annex clients receiving messages that
were intended for normal clients they're sharing the account with.

Changed XMPP protocol use to always send chat messages directed at the
specific client, as the negative priority blocks less directed messages.
2012-11-10 15:33:12 -04:00
Joey Hess
7a20b3f1d5 more refactoring 2012-11-10 14:01:24 -04:00
Joey Hess
0cf4c3ba9c more nice refactoring 2012-11-10 13:00:13 -04:00
Joey Hess
81953c2131 separate data type for push stages
This improves type safety.
2012-11-10 12:18:00 -04:00
Joey Hess
8b8964b523 refactor 2012-11-10 02:35:54 -04:00
Joey Hess
235f2ecb91 use a lookup table for speed 2012-11-10 02:18:19 -04:00
Joey Hess
16b2472574 refactor 2012-11-10 01:40:50 -04:00
Joey Hess
6acc4fa83f avoid excessive debugging 2012-11-09 17:51:26 -04:00
Joey Hess
47c032a748 run xmpp push actions in separate thread from xmpp client
Took me a while to figure out why the xmpp client was not receiving git xmpp
push messages after a push started.
2012-11-09 16:04:55 -04:00
Joey Hess
13547aa659 add canpush xmpp command 2012-11-09 14:34:06 -04:00
Joey Hess
fb3b9412e4 xmpp push control flow
It might even work, although nothing yet triggers XMPP pushes.

Also added a set of deferred push messages. Only one push can run at a
time, and unrelated push messages get deferred. The set will never grow
very large, because it only puts two types of messages in there, that
can only vary in the client doing the push.
2012-11-08 16:46:29 -04:00
Joey Hess
0238e4ba07 hooked up XMPP git push send/receive (but not yet control flow) 2012-11-08 14:04:41 -04:00
Joey Hess
b827afba03 rename another 'close' 2012-11-07 14:56:32 -04:00
Joey Hess
b8585a9452 NetManager is only currently used with dbus 2012-11-07 14:56:32 -04:00
Joey Hess
8f08aa3f45 better handling of lifting from XMPP -> Assistant 2012-11-05 19:39:08 -04:00
Joey Hess
fdb6a88877 ignore Messages from our client's own jid
shouldn't ever happen, but hey
2012-11-05 17:54:21 -04:00
Joey Hess
da6fb44446 finished XMPP pairing!
This includes keeping track of which buddies we're pairing with, to know
which PairAck are legitimate.
2012-11-05 17:43:17 -04:00
Joey Hess
da65c5c1d1 tweak 2012-11-05 16:00:55 -04:00
Joey Hess
db36b11e28 switch to silent chat messages for XMPP pairing
Along the way, significantly cleaned up Assistant.XMPP, and made XMPP
message decoding more efficient.
2012-11-05 15:40:56 -04:00
Joey Hess
0b8027e527 webapp: When setting up authorized_keys, use GIT_ANNEX_SHELL_DIRECTORY. 2012-11-05 12:35:05 -04:00
Joey Hess
a6cecfcf33 workaround for Google Talk's insane handling of self-directed presence
Maybe the spec allows it, but broadcasting self-directed presence info to
all buddies is just insane.

I had to bring back the IQ messages for self-pairing, while still using
directed presence for other pairing. Ugly.
2012-11-03 22:52:41 -04:00
Joey Hess
9cff286ea3 avoid repeated pairing alerts 2012-11-03 21:38:27 -04:00
Joey Hess
17e84a8096 switch to directed presence for pair requests
Testing between Google Talk and prosody, the directed IQ messages
were not received. Google Talk probably only relays them between
clients using the same account.

I first tried even more directed presence, with each client JID being sent
a separate presence, but that didn't work on Google Talk, particularly
it was ignored when one client sent it to another client using the same
account.

So, presence directed at the user@host of the client to pair with. Tested
working between Google Talk and prosody (in both directions), as well
as between two clients with the same account on Google Talk, and
two clients with the same account on prosody.

Only problem with this form of directed presence is that if I also use it
for git pushes, more clients than are interested in a push's data will
receive it. So I may need some better approach, or a hybrid between
directed IQ and directed presence.
2012-11-03 21:19:59 -04:00
Joey Hess
42f030c905 XMPP pair requests are now received, and an alert displayed 2012-11-03 17:46:22 -04:00
Joey Hess
b95c255b6d XMPP pairing notifications are now sent
Rest of pairing process still to do.
2012-11-03 16:01:09 -04:00
Joey Hess
cbbfd4d00b bugfix 2012-11-03 14:32:59 -04:00
Joey Hess
9a8d0be866 send a presence query when the buddy list is displayed
This ensures that clients that have not sent presence in a while will show
up in the list.
2012-11-03 14:25:06 -04:00
Joey Hess
a1228e27ed refactor XMPP client 2012-11-03 14:16:17 -04:00
Joey Hess
bf17262986 ignore our own client presence 2012-11-02 21:23:58 -04:00
Joey Hess
6a61829e2d add buddy list to pairing UI 2012-11-02 21:13:06 -04:00
Joey Hess
2ae43e71e0 xmpp buddy list tracking 2012-11-02 14:28:36 -04:00
Joey Hess
88d1907278 where indentation 2012-10-31 02:34:03 -04:00
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
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
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
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
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
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
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
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
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
6b0a6cd226 import S3 only when enabled 2012-10-18 12:42:57 -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
549c779a38 use gitRepo 2012-10-12 01:17:45 -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
b6a3f03f82 add "configure" link to each repository in the webapp's repo list 2012-10-09 14:43:53 -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
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
74a6e8ff60 avoid some warnings when built w/o dbus 2012-09-29 16:09:07 -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
17708dd173 add a configurator for S3 2012-09-26 14:44:07 -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
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
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
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
df337bb63b hlint 2012-09-13 00:57:52 -04:00
Richard Hartmann
af657b10fd Remove trailing whitespace 2012-09-11 16:17:26 -04:00
Joey Hess
4d592aaec2 fixed all pairing alert issues 2012-09-11 16:11:28 -04:00
Joey Hess
99d52f26bc fix combining of pairing alerts 2012-09-11 15:43:33 -04:00
Joey Hess
2c1ceeeaf9 pairing works!!
Finally.

Last bug fixes here: Send PairResp with same UUID in the PairReq.
Fix off-by-one in code that filters out our own pairing messages.

Also reworked the pairing alerts, which are still slightly buggy.
2012-09-11 15:09:00 -04:00
Joey Hess
aace44454a keep track of the stage we're at in pairing
This avoids us responding to our own pairing messages, as well
as ignoring any out of order messages that might be received somehow.
2012-09-11 12:58:00 -04:00
Joey Hess
084dc188c7 additional security sanity checks on pairing messages 2012-09-11 11:48:50 -04:00
Joey Hess
0208d6aa82 add a UUID to pair requests
Pair requests the the same UUID are part of the same pairing session,
which allows us to detect attempts to brute force the shared secret,
as that will result in pair requests with the same UUID that are
not verified with the right secret.
2012-09-11 03:16:00 -04:00