Commit graph

254 commits

Author SHA1 Message Date
Joey Hess
021e8e1e0e make Annex an opaque data type
Was a type alias; using newtype has the benefit that type errors will
show "Annex foo" rather than two lines of internal type nonsense. Yay!
There should be no other effects to size or runtime.

I've tried to do this at least twice before (each time I read RWH chapter 10);
finally understood how to this time.. sorta.
2011-08-19 14:28:07 -04:00
Joey Hess
9f1577f746 remove unused backend machinery
The only remaining vestiage of backends is different types of keys. These
are still called "backends", mostly to avoid needing to change user interface
and configuration. But everything to do with storing keys in different
backends was gone; instead different types of remotes are used.

In the refactoring, lots of code was moved out of odd corners like
Backend.File, to closer to where it's used, like Command.Drop and
Command.Fsck. Quite a lot of dead code was removed. Several data structures
became simpler, which may result in better runtime efficiency. There should
be no user-visible changes.
2011-07-05 19:57:46 -04:00
Joey Hess
f0497312a7 rename GitQueue to Git.Queue 2011-06-30 13:25:37 -04:00
Joey Hess
f6063a094e renamed GitRepo to Git
It was always imported qualified as Git anyway
2011-06-30 13:21:39 -04:00
Joey Hess
69d3c1cec9 cache the trustmap
Doubles the speed of fsck, and speeds up drop as well.
2011-06-23 21:25:39 -04:00
Joey Hess
8166facaef Branch handling improvements
Support creating the branch.

Unified branch state into a single data type.

Only commit changes when the index has been changed.
2011-06-22 15:58:30 -04:00
Joey Hess
78a325b093 add a small cache of the most recently accessed item from the git-annex branch
This will speed up typical cases like git-annex get, which currently
has to read the location log once, then read it a second time in order to
add a line to it. Since these reads now involve more than just reading
in a file, it seemed good to add a cache layer.

Only the most recent thing needs to be cached, because git-annex has
good locality; it operates on one file at a time, and only cares
about one item from the branch per file.
2011-06-22 14:18:49 -04:00
Joey Hess
c03af0ed0c code to update a git-annex branch
There is no suitable git hook to run code when pulling changes that
might need to be merged into the git-annex branch. The post-merge hook
is only run when changes are merged into HEAD, and it's possible,
and indeed likely that many pulls will only have changes in git-annex,
but not in HEAD, and not trigger it.

So, git-annex will have to take care to update the branch before reading
from it, to make sure it has merged in current info from remotes. Happily,
this can be done quite inexpensively, just a git-show-ref to list
branches, and a minimalized git-log to see if there are unmerged changes
on the branches. To further speed up, it will be done only once per
git-annex run, max.
2011-06-21 14:33:59 -04:00
Joey Hess
bc731ba6e0 pointless golfing 2011-06-20 21:37:18 -04:00
Joey Hess
703c437bd9 rename modules for data types into Types/ directory 2011-06-01 21:56:04 -04:00
Joey Hess
971ab27e78 better types allowed breaking module dep loop 2011-06-01 19:11:27 -04:00
Joey Hess
a8fb97d2ce Add --trust, --untrust, and --semitrust options. 2011-06-01 17:57:31 -04:00
Joey Hess
3d567aa64f Add --numcopies option. 2011-06-01 16:49:17 -04:00
Joey Hess
cd83541872 --backend now overrides any backend configured in .gitattributes files. 2011-05-18 19:34:46 -04:00
Joey Hess
6aab88fa25 more monadic operator use 2011-05-15 15:27:49 -04:00
Joey Hess
33d23a4ef9 Control.Monad.State import fix for debian stable
It doesn't export `state` there, so hiding it fails. Just list explicitly
what we use.
2011-04-26 19:42:40 -04:00
Joey Hess
43639f69f6 ghc7
* Update Debian build dependencies for ghc 7.
* Debian package is now built with S3 support. Thanks Joachim Breitner for
  making this possible, also thanks Greg Heartsfield for working to improve
  the hS3 library for git-annex.

Also hid a conflicting new symbol from Control.Monad.State
2011-04-21 02:22:40 -04:00
Joey Hess
9fe7e6be70 add cipher field to AnnexState 2011-04-16 16:41:46 -04:00
Joey Hess
bc51387e6d Periodically flush git command queue, to avoid boating memory usage too much.
Since the queue is flushed in between subcommand actions being run,
there should be no issues with actions that expect to queue up some stuff
and have it run after they do other stuff. So I didn't have to audit for
such assumptions.
2011-04-07 13:59:31 -04:00
Joey Hess
6b5918c295 some reorg and further remote generalization 2011-03-27 21:43:25 -04:00
Joey Hess
f30320aa75 add remotes slot to Annex
This required parameterizing the type for Remote, to avoid a cycle.
2011-03-27 16:17:56 -04:00
Joey Hess
c21998722c fast mode
Add --fast flag, that can enable less expensive, but also less thurough versions of some commands.

* Add --fast flag, that can enable less expensive, but also less thurough
  versions of some commands.
* fsck: In fast mode, avoid checking checksums.
* unused: In fast mode, just show all existing temp files as unused,
  and avoid expensive scan for other unused content.
2011-03-22 17:41:06 -04:00
Joey Hess
bc21502b9a use queue when upgrading, flushing every so often
Added a cheap way to query the size of a queue.

runQueueAt is not the default yet only because there may be some code that
expects to be able to queue some suff, do something else, and run the whole
queue at the end.

10240 is an arbitrary size for the queue. If we assume annexed
filenames are between 10 and 255 characters long, then the queue will
build up between 100kb and 2550kb long commands. The max command line
length on linux is somewhere above 20k, so this is a fairly good balance --
the queue will buffer only a few megabytes of stuff and a minimal number
of commands will be run by xargs.

Also, insert queue items strictly, this should save memory.
2011-03-16 15:10:15 -04:00
Joey Hess
4594bd51c1 rename file 2011-03-15 22:04:50 -04:00
Joey Hess
aad1372880 move repoConfig out of Remotes 2011-03-05 15:31:46 -04:00
Joey Hess
4cd96ad2db rename 2011-02-28 16:25:31 -04:00
Joey Hess
fcdc4797a9 use ShellParam type
So, I have a type checked safe handling of filenames starting with dashes,
throughout the code.
2011-02-28 16:18:55 -04:00
Joey Hess
dd0f662849 hello, liftM 2011-02-19 17:00:40 -04:00
Joey Hess
616d1d4a20 rename TypeInternals to BackendTypes
Now that it only contains types used by the backends
2011-01-26 00:37:50 -04:00
Joey Hess
6a97b10fcb rework config storage
Moved away from a map of flags to storing config directly in the AnnexState
structure. Got rid of most accessor functions in Annex.

This allowed supporting multiple --exclude flags.
2011-01-26 00:17:38 -04:00
Joey Hess
082b022f9a successfully split Annex and AnnexState out of TypeInternals 2011-01-25 21:49:04 -04:00
Joey Hess
109a719b03 parameterize Backend type
This allows the Backend type to not depend on the Annex type, and
so the Annex type can later be moved out of TypeInternals.
2011-01-25 21:02:34 -04:00
Joey Hess
8d6da87eec better types 2011-01-11 18:13:26 -04:00
Joey Hess
eac433a84a use git-annex-shell configlist 2010-12-31 15:46:33 -04:00
Joey Hess
6a5be9d53c rename some stuff and prepare to break out more into Command/* 2010-12-30 14:19:16 -04:00
Joey Hess
c281747b0e add queueRun 2010-11-08 16:40:02 -04:00
Joey Hess
ab4de45491 Add annex.version, which will be used to automate upgrades. 2010-11-08 14:39:12 -04:00
Joey Hess
a3519c365f hlinted a few files 2010-11-06 17:07:11 -04:00
Joey Hess
99c522edef finished adding support for annex.ssh-options 2010-11-01 00:04:53 -04:00
Joey Hess
00d4c7cd01 simplify evals 2010-10-31 23:24:16 -04:00
Joey Hess
1576c48c80 more Wall cleaning 2010-10-31 14:32:18 -04:00
Joey Hess
045b051ec1 got rid of almost all 'return ()' 2010-10-28 12:40:05 -04:00
Joey Hess
833d4b342e copyright statements 2010-10-27 16:53:54 -04:00
Joey Hess
ef26076a5a add git queue to Annex monad
not used anywhere just yet..
2010-10-26 15:59:50 -04:00
Joey Hess
19fde4960d new fromkey subcommand, for registering urls, etc
had to redo Annex monad's flag storage
2010-10-21 16:30:16 -04:00
Joey Hess
f3dcc8489d gratuitous rename 2010-10-18 02:06:27 -04:00
Joey Hess
98676928c8 prune 2010-10-17 12:09:52 -04:00
Joey Hess
b471822cfe move supportedBackends list into annex monad
This was necessary so the File backend could import Backend w/o a cycle.

Moved code that checks whether enough backends have a file into File
backend.
2010-10-17 11:47:36 -04:00
Joey Hess
909f619c07 tweaks 2010-10-16 16:20:49 -04:00
Joey Hess
bbbe9858fe avoid empty commits 2010-10-14 23:52:45 -04:00
Joey Hess
29039fdf97 add flags, and change to subcommand style 2010-10-14 21:10:59 -04:00
Joey Hess
aa2f4bd810 bug 2010-10-14 16:13:43 -04:00
Joey Hess
6f3572e47f more reorg, spiffed up state monad 2010-10-14 03:18:11 -04:00
Joey Hess
4c1d8b9689 more namespace cleanup 2010-10-14 02:41:54 -04:00
Joey Hess
48643b68b3 convert GitRepo to qualified import 2010-10-14 02:36:41 -04:00
Joey Hess
eda80e44c5 add module that only exports abstract types 2010-10-14 02:12:41 -04:00
Joey Hess
89654751da bugfix 2010-10-13 21:35:10 -04:00
Joey Hess
b160748516 use a state monad
enormous reworking
2010-10-13 21:28:47 -04:00
Joey Hess
f87c5ed949 copying almost working 2010-10-13 16:21:50 -04:00
Joey Hess
e28ff5bdaf almost able to get files from remotes now! 2010-10-13 15:55:18 -04:00
Joey Hess
77055f5ff8 move some stuff out of IO 2010-10-13 14:51:09 -04:00
Joey Hess
771a6b36e1 cost ordering 2010-10-13 14:40:56 -04:00
Joey Hess
1dbf36bf9a cleanup3 2010-10-13 03:51:55 -04:00
Joey Hess
ff998a9a67 cleanup2 2010-10-13 03:46:40 -04:00
Joey Hess
99b2029236 key conversion back from file bugfixes 2010-10-13 03:41:12 -04:00
Joey Hess
cc5cf0093e cleanup 2010-10-13 03:30:51 -04:00
Joey Hess
4b801b265a error handling 2010-10-13 03:20:05 -04:00
Joey Hess
d1071bd1fe autobugfixing!
Converted Key to a real data type and caught all the places where I used
an unconverted filename as a key.

Had to loose some sanity checks around whether something is already
annexed, but I guess I can add those back other ways.
2010-10-13 02:31:24 -04:00
Joey Hess
4ecebfb218 bugfx 2010-10-13 01:43:24 -04:00
Joey Hess
3a18b6d2ae bugfix 2010-10-13 01:42:39 -04:00
Joey Hess
3e65384f06 fix relative symlink 2 2010-10-13 01:36:20 -04:00
Joey Hess
67ae9d7fa1 relative symlink to annexed file 2010-10-13 00:58:59 -04:00
Joey Hess
14d7b2ac13 update 2010-10-13 00:45:09 -04:00
Joey Hess
208bba8d30 got rid of the .git-annex/key.backend files 2010-10-13 00:42:46 -04:00
Joey Hess
b7858ada03 bugfixes 2010-10-12 20:04:36 -04:00
Joey Hess
3b89924f53 record annexed files in log 2010-10-12 18:25:41 -04:00
Joey Hess
10992b90c9 avoid redownload 2010-10-12 17:56:29 -04:00
Joey Hess
a36c39ad0a getting files via http working! 2010-10-12 17:26:34 -04:00
Joey Hess
cad916d926 hookup annexgetfile 2010-10-12 16:52:01 -04:00
Joey Hess
603e01e96c simplify some function signatures using state 2010-10-12 16:20:41 -04:00
Joey Hess
2ac47a3a59 thread State thru to backends 2010-10-12 16:06:10 -04:00
Joey Hess
759f146d0f update 2010-10-12 15:52:18 -04:00
Joey Hess
d257bad93c uuid type 2010-10-12 15:48:00 -04:00
Joey Hess
e53900a545 stub 2010-10-12 15:44:54 -04:00
Joey Hess
4fbdb197d5 correctness 2010-10-12 13:12:47 -04:00
Joey Hess
dc1d5e6831 update 2010-10-12 13:10:07 -04:00
Joey Hess
ea5d7fe07a add uuid 2010-10-12 13:02:41 -04:00
Joey Hess
8f069bd287 tweak 2010-10-12 02:40:09 -04:00
Joey Hess
92bf408c66 faddle 2010-10-12 00:53:42 -04:00
Joey Hess
cd1e39b127 moved config reading into GitRepo 2010-10-11 23:22:38 -04:00
Joey Hess
104fe9132a cleanup 2010-10-11 18:15:05 -04:00
Joey Hess
ebc3fbe9ae explicit exports 2010-10-11 17:52:46 -04:00
Joey Hess
af82586adf split up Types 2010-10-11 17:19:55 -04:00
Joey Hess
779ebba961 adjust merge config
*.log will merge, but foo.$backend files will not
2010-10-11 00:22:50 -04:00
Joey Hess
2bd3eea031 add git config lookups for annex.name, annex.backends, etc 2010-10-11 00:19:38 -04:00
Joey Hess
c5d7ca0a5a use Data.Time instead of Data.DateTime
The latter has shady rounding. The new module is a bit harder to use, but
worth it, it adds subsecond timestamps too.
2010-10-10 22:22:53 -04:00
Joey Hess
200bc6fdb8 better option handling
multiple-file support for all modes
2010-10-10 21:00:42 -04:00
Joey Hess
344f13394f update 2010-10-10 19:53:31 -04:00
Joey Hess
586266e444 robustness 2010-10-10 19:00:08 -04:00
Joey Hess
026adce5a0 update 2010-10-10 18:25:31 -04:00
Joey Hess
e5514e0cb0 update 2010-10-10 18:05:37 -04:00
Joey Hess
dce9c2e080 convert GitRepo to struct with constructor 2010-10-10 16:06:36 -04:00
Joey Hess
4631927a5c fix storing files in .git/annex by key 2010-10-10 15:21:17 -04:00
Joey Hess
f4d2a05e86 got annexing working 2010-10-10 15:04:07 -04:00