Commit graph

637 commits

Author SHA1 Message Date
Joey Hess
2433f6ca5a use the ~/.config/git-annex/program file to find command when running transfers 2012-08-27 13:43:03 -04:00
Joey Hess
c58d553265 refactor 2012-08-26 14:45:47 -04:00
Joey Hess
f4ca592cd0 refactor 2012-08-26 14:34:30 -04:00
Joey Hess
8de7699f39 add transferkey command
Used by the assistant, rather than copy, this is faster because it avoids
using git ls-files, avoids checking the location log redundantly, and
runs in oneshot mode, avoiding making a commit to the git-annex branch
for every file transferred.
2012-08-24 17:23:58 -04:00
Joey Hess
715a9a2f8e keep logs of failed transfers, and requeue them when doing a non-full scan
of a remote
2012-08-23 15:24:15 -04:00
Joey Hess
5c3e14649e avoid unnecessary transfer scans when syncing a disconnected remote
Found a very cheap way to determine when a disconnected remote has
diverged, and has new content that needs to be transferred: Piggyback on
the git-annex branch update, which already checks for divergence.

However, this does not check if new content has appeared locally while
disconnected, that should be transferred to the remote.

Also, this does not handle cases where the two git repos are in sync,
but their content syncing has not caught up yet.

This code could have its efficiency improved:

* When multiple remotes are synced, if any one has diverged, they're
  all queued for transfer scans.
* The transfer scanner could be told whether the remote has new content,
  the local repo has new content, or both, and could optimise its scan
  accordingly.
2012-08-22 15:05:57 -04:00
Joey Hess
b6b8f6da9c implement resuming of paused transfers
Currently waits for a new transfer slot to open up, which probably needs to
change..
2012-08-12 12:11:20 -04:00
Joey Hess
94fcd0cf59 add routes to pause/start/cancel transfers
This commit includes a paydown on technical debt incurred two years ago,
when I didn't know that it was bad to make custom Read and Show instances
for types. As the routes need Read and Show for Transfer, which includes a
Key, and deriving my own Read instance of key was not practical,
I had to finally clean that up.

So the compact Key read and show functions are now file2key and key2file,
and Read and Show are now derived instances.

Changed all code that used the old instances, compiler checked.
(There were a few places, particularly in Command.Unused, and the test
suite where the Show instance continue to be used for legitimate
comparisons; ie show key_x == show key_y (though really in a bloom filter))
2012-08-08 16:20:24 -04:00
Joey Hess
fb4b19deed make the webapp honor the web.browser git config 2012-08-08 13:15:35 -04:00
Joey Hess
7e2d07484f Merge branch 'master' into assistant 2012-08-07 13:31:43 -04:00
Joey Hess
2a9077f4e9 fix transfer log cleanup crash
Avoid crashing when "git annex get" fails to download from one location,
and falls back to downloading from a second location.

The problem is that git annex get calls download recursively from within
itself if the first download attempt fails. So the first time through, it
writes a transfer info file, which is then overwritten on the second,
recursive call. Then on cleanup, it tries to delete the file twice, which
of course doesn't work.

Fixed both by not crashing if the transfer file is removed, and by
changing Get to not run download recursively like that. It's the only
thing that did so, and it just seems like a bad idea.
2012-08-07 13:30:08 -04:00
Joey Hess
5ae1f75a39 handle case of adding populated drive to just created repo
The just created repo has no master branch commits yet. This is now
handled, merging in the master branch from the populated drive.
2012-08-05 16:35:30 -04:00
Joey Hess
34fc0d358e fix crashes when run in a git repo that has been initted but has no master branch yet 2012-08-05 15:53:47 -04:00
Joey Hess
0833eb43a6 Merge remote-tracking branch 'origin/master' into assistant
Conflicts:
	Init.hs
2012-08-05 15:06:44 -04:00
Joey Hess
b885c0c6c8 unused, status: Avoid crashing when ran in bare repo. 2012-08-05 15:01:26 -04:00
Joey Hess
3add2cd3ba wire up scan and transfer to newly added removable drive
remote setup still todo
2012-08-04 21:18:57 -04:00
Joey Hess
60da0d6ad2 full autostart support
git annex assistant --autostart will start separate daemons in each
listed autostart repo

running the webapp outside any git-annex repo will open it on the
first listed autostart repo
2012-08-02 00:42:33 -04:00
Joey Hess
d7a2600edd webapp is no longer a daemon
Remove --foreground and --stop options from it.
2012-08-01 16:40:38 -04:00
Joey Hess
ca512f1450 always run webapp in foreground 2012-08-01 16:34:17 -04:00
Joey Hess
8181b38ef6 write pid file even when running in foreground
This prevents multiple runs of the assistant in the foreground, and lets
--stop stop foregrounded runs too.

The webapp firstrun case also now writes a pid file, once it's made the git
repo to put it in.
2012-08-01 16:30:53 -04:00
Joey Hess
ecc168aba3 implemented firstrun repository creation and redirection to full webapp
Some of the trickiest code I've possibly ever written.
2012-08-01 16:10:26 -04:00
Joey Hess
bcf5c81593 when run in uninitialized git repo, do firstrun
My $HOME is in git, let's make it work :)
2012-07-31 16:19:24 -04:00
Joey Hess
1efb0d109e don't start webapp when in a git repo that has not been git-annex initted
Maybe later it can prompt if they want to use the repo with git-annex, but
for now this is a sane easy choice.
2012-07-31 12:20:31 -04:00
Joey Hess
04794eafc0 webapp now starts up when run not in a git repo 2012-07-31 12:17:31 -04:00
Joey Hess
0a66947e3b Merge branch 'master' into assistant 2012-07-27 21:05:34 -04:00
Joey Hess
13e9b275dd initremote: Avoid recording remote's description before checking that its config is valid. 2012-07-27 21:05:27 -04:00
Joey Hess
adae40a292 now the webapp has the same options as the assistant 2012-07-27 15:40:52 -04:00
Joey Hess
02ec8ea012 much better webapp startup of the assistant
This avoids forking another process, avoids polling, fixes a race,
and avoids a rare forkProcess thread hang that I saw once time
when starting the webapp.
2012-07-27 15:33:24 -04:00
Joey Hess
9b2eec2e7a increase timeout from 10 to 100 seconds
I've seen 10 be too short under load.
2012-07-26 18:04:09 -04:00
Joey Hess
e79198aacb when starting the assistant, wait for it to create the shim file, as well as the pid file
fixes a possible race
2012-07-26 15:28:08 -04:00
Joey Hess
860415aa5b webapp: check that the shim exists, and restart the assistant if not 2012-07-26 14:27:32 -04:00
Joey Hess
3c117685eb on second thought, let's use --restart rather than --force
--force could enable other, unwanted behavior
2012-07-26 12:17:28 -04:00
Joey Hess
cccdb44874 git annex webapp --force forces a restart of the daemon
Useful for testing..
2012-07-26 11:52:49 -04:00
Joey Hess
81b40cf882 fix editor damage 2012-07-25 23:50:14 -04:00
Joey Hess
1ffef3ad75 git annex webapp now opens a browser to the webapp
Also, starts the assistant if it wasn't already running.
2012-07-25 23:13:01 -04:00
Joey Hess
1db7d27a45 add back debug logging
Make Utility.Process wrap the parts of System.Process that I use,
and add debug logging to them.

Also wrote some higher-level code that allows running an action
with handles to a processes stdin or stdout (or both), and checking
its exit status, all in a single function call.

As a bonus, the debug logging now indicates whether the process
is being run to read from it, feed it data, chat with it (writing and
reading), or just call it for its side effect.
2012-07-19 00:46:52 -04:00
Joey Hess
21d35f88d8 pull in transfer log code from assistant branch
New log file format.
2012-07-18 21:45:41 -04:00
Joey Hess
f2ed3d6c8e Merge branch 'threaded' into assistant 2012-07-18 18:17:33 -04:00
Joey Hess
d1da9cf221 switch from System.Cmd.Utils to System.Process
Test suite now passes with -threaded!

I traced back all the hangs with -threaded to System.Cmd.Utils. It seems
it's just crappy/unsafe/outdated, and should not be used. System.Process
seems to be the cool new thing, so converted all the code to use it
instead.

In the process, --debug stopped printing commands it runs. I may try to
bring that back later.

Note that even SafeSystem was switched to use System.Process. Since that
was a modified version of code from System.Cmd.Utils, it needed to be
converted too. I also got rid of nearly all calls to forkProcess,
and all calls to executeFile, which I'm also doubtful about working
well with -threaded.
2012-07-18 18:00:24 -04:00
Joey Hess
30f7b1599c Merge branch 'master' into assistant 2012-07-17 12:27:12 -04:00
Joey Hess
f5f8879471 map: Write map.dot to .git/annex, which avoids watch trying to annex it. 2012-07-17 12:27:06 -04:00
Joey Hess
fa3aef96e2 Merge branch 'master' into assistant 2012-07-16 15:06:08 -04:00
Joey Hess
aa558f0b00 copy, drop: Avoid checking numcopies attribute unnecessarily 2012-07-10 11:53:45 -06:00
Joey Hess
71b5ad8398 wrote transfer thread
finally!
2012-07-05 14:34:20 -06:00
Joey Hess
3ea708e03b Merge branch 'master' into assistant 2012-07-02 15:45:20 -04:00
Joey Hess
760e028dca pass associatedfile and remoteuuid to git-annex-shell
This *almost* works.

Along the way, I noticed that the --uuid parameter was being accidentially
passed after the --, so that has never been actually used by
git-annex-shell to verify it's running in the expected repository. Oops. Fixed.
2012-07-02 10:57:51 -04:00
Joey Hess
bea0ac0274 record transfers for git-annex-shell
Not yet tested and places git-annex-shell is run need to be modified to
pass the new field settings.

Note that rsyncServerSend was changed to fork, rather than directly exec
rsync, because it needs to keep the transfer lock held, and clean up the
transfer log when done.
2012-07-02 01:31:10 -04:00
Joey Hess
7625319c2c Merge branch 'master' into assistant 2012-07-01 21:00:43 -04:00
Joey Hess
7225c2bfc0 record transfer information on local git remotes
In order to record a semi-useful filename associated with the key,
this required plumbing the filename all the way through to the remotes'
storeKey and retrieveKeyFile.

Note that there is potential for deadlock here, narrowly avoided.
Suppose the repos are A and B. A sends file foo to B, and at the same
time, B gets file foo from A. So, A locks its upload transfer info file,
and then locks B's download transfer info file. At the same time,
B is taking the two locks in the opposite order. This is only not a
deadlock because the lock code does not wait, and aborts. So one of A or
B's transfers will be aborted and the other transfer will continue.
Whew!
2012-07-01 17:15:11 -04:00
Joey Hess
e5fd8b67b7 get, move, copy: Now refuse to do anything when the requested file transfer is already in progress by another process.
Note this is per-remote, so trying to get the same file from multiple
remotes can still let duplicate downloads run. (And uploading the same file
to multiple remotes is not duplicate at all of course.)

get, move, and copy are the only git-annex subcommands that transfer
files, but there's still git-annex-shell recvkey and sendkey to deal with too.

I considered modifying retrieveKeyFile or getViaTmp, but they are called
by other code that does not involve expensive file transfers (migrate)
or that does file transfers that should not be checked by this (fsck --from).
2012-07-01 17:15:11 -04:00