Commit graph

614 commits

Author SHA1 Message Date
brian m. carlson
ec7365fb17
Pretty-print JSON output.
Sort the keys for YAML output, but don't pretty-print it, because it isn't
clear if that will affect its validity as YAML 1.0 and 1.1.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-25 01:20:35 +00:00
brian m. carlson
4a343d324c
Allow exporting all tables for non-CSV.
CSV output does not contain a table name, and therefore exporting all tables
would lose important information about which files were in which tables.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-25 01:10:50 +00:00
brian m. carlson
e7986043c0
Make help for table options refer to tables.
The help previously referred to databases, which was confusing.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-25 01:03:10 +00:00
brian m. carlson
6491b5ebaa
Add JSON as a valid storage format for databases.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-25 01:01:07 +00:00
brian m. carlson
e6f5b21988
Merge branch 'master' into peter
Conflicts:
	lib/newfol/database.py
2014-01-24 05:55:20 +00:00
brian m. carlson
3e64a897c2
Refactor out records property from DatabaseData.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-24 05:51:53 +00:00
brian m. carlson
4f8e04930b
Refactor out edoptions property from DatabaseData.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-24 05:47:41 +00:00
brian m. carlson
1af520e209
Refactor out the version property from DatabaseData.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-24 05:39:16 +00:00
brian m. carlson
2746bf0476
Refactor out the homedir property from DatabaseData.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-24 05:37:23 +00:00
brian m. carlson
8d7ef22319
Refactor database access in DatabaseData.
The eventual goal is to have all attributes come off the database, including
schema access.  When the DatabaseData object has only one method left (for
the database), it can then be refactored away itself.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-24 05:33:59 +00:00
brian m. carlson
1cd9478454
Remove property columns from DatabaseData.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-24 05:29:36 +00:00
brian m. carlson
9db7217230
Remove unused property nfields from DatabaseData.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-24 05:27:46 +00:00
brian m. carlson
d8089177e8
Remove legacy property layout from DatabaseData.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-24 05:26:15 +00:00
brian m. carlson
15e1dbb915
Parse palettes from the schema file.
The tag name "clr" is used because "col" is already used for columns.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-24 05:12:04 +00:00
brian m. carlson
58f407e1e8
Add support for overriding the built-in palette.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-24 05:11:03 +00:00
brian m. carlson
1dd2028245
Add palette attributes to the schema.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-24 04:53:13 +00:00
brian m. carlson
a917127d4a
Remove unused function.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-24 04:25:30 +00:00
brian m. carlson
0fa9b2224d Merge branch 'master' into peter 2014-01-23 23:47:40 +00:00
brian m. carlson
4a337e9a1d
Update version number to v5~pre0.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-23 23:46:43 +00:00
brian m. carlson
82c74d4e08
Update version number to version 4.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-23 23:43:59 +00:00
brian m. carlson
b6f3f49bf7
Document the DatabaseVersion methods.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-22 19:52:51 +00:00
brian m. carlson
f85219647d
Add tests for the Singleton metaclass.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-22 02:27:21 +00:00
brian m. carlson
5cb2c2dadf
Use a cleaner method to store additional files.
The git transactions had acquired a lot of in-depth knowledge about the
files that consisted of a database in order to store these additional files
in git as well.  Make the transaction code learn about a generic list of
additional files to be added and move the database-specific knowledge to the
database code, where it belongs.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-18 01:04:12 +00:00
brian m. carlson
ca72bdc562
filemanip: clone options hash before modifying.
If we want to change the contents of the option hash, we shouldn't modify
other users' copies of it.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-18 01:03:13 +00:00
brian m. carlson
c5d1b18a29 Merge branch 'master' into peter 2014-01-11 18:44:14 +00:00
brian m. carlson
df462e6c42
Switch newfol to use "hash" type instead of "sha256".
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-11 18:41:29 +00:00
brian m. carlson
94a0b685d4
Implement support for autodetecting hashes.
The appropriate hash to use for validating the data is automatically
detected, and if no hash type is specified, use SHA-512 on 64-bit systems
and SHA-256 on 32-bit systems, as this provides the best performance.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-11 18:37:40 +00:00
brian m. carlson
082fd07c62
Generate testcases on the fly.
Use hashlib to generate the testcases instead of relying on hard-coded
values.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-11 18:15:00 +00:00
brian m. carlson
2a8c8d2d2a
Support SHA-384 and SHA-512.
Turn the SHA256Transaction store into a HashTransactionStore and support
SHA-384 and SHA-512, which provide better performance on 64-bit systems.
Don't support SHA-224 since it is weaker and is only useful where the hash
would be truncated anyway.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-11 00:58:54 +00:00
brian m. carlson
810d33be99
Refactor transaction types into a list.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-11 00:44:44 +00:00
brian m. carlson
e7508bb172
Refactor backend selection.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-11 00:42:55 +00:00
brian m. carlson
44b9c5c031
Don't make the user's files read-only.
Copy the data to a temporary file before marking it read-only.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-11 00:36:30 +00:00
brian m. carlson
c3d30291ec Merge branch 'master' into peter 2014-01-11 00:20:33 +00:00
brian m. carlson
17b3afb3cf
Avoid using print().
The print() notation makes syntax checkers go crazy for some reason (notably
when Syntastic tries to validate Python 3 code with /usr/bin/python), so
switch to a syntax that is slightly more Python 2-friendly.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-10 00:24:50 +00:00
brian m. carlson
e514e62747
Add a RawFile object.
This provides support for storing raw data under the transactions
infrastructure.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-10 00:24:00 +00:00
brian m. carlson
b3b76c7a57
Add helpful comments to unit test.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-09 02:08:04 +00:00
brian m. carlson
09d0d11751
Add more SHA-256 tests.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-09 01:57:46 +00:00
brian m. carlson
831ba3206c Merge branch 'master' into peter 2014-01-08 03:36:50 +00:00
brian m. carlson
450bf7ff6a
Properly report open mode to transaction stores.
The mode was always being reported as "w" (write), which resulted in SHA-256
checksums not being validated on load.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-08 03:34:54 +00:00
brian m. carlson
3d39ca84e6
Silence ResourceWarning in tests.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-08 03:28:01 +00:00
brian m. carlson
41fef74e9d
Add more tests for SHA256TransactionStore.
One of the tests is a known failure because of a bug, so mark it accordingly.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-08 03:27:20 +00:00
brian m. carlson
e509dacc9a
Add a basic test for the SHA-256 Transaction store.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-05 19:29:21 +00:00
brian m. carlson
a454d033bd Merge branch 'master' into peter 2014-01-04 00:08:56 +00:00
brian m. carlson
9eafc61bda
newfol: make view in editor button work.
The keystroke for loading the search results in the editor worked, but the
button did not.  Fix this.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-04 00:03:46 +00:00
brian m. carlson
2f663da0ec Merge branch 'master' into peter 2014-01-01 21:13:48 +00:00
brian m. carlson
544fc064e9
filemanip: use reasonable committer ID for git.
We should not rely on the user setting up reasonable values for the committer
identification for git.  Use a committer name of newfol and an email address
consisting of the user's username and the FQDN of the machine.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-01 20:30:03 +00:00
brian m. carlson
a83ae0f348
database: add some tests for git transactions.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-01 20:02:21 +00:00
brian m. carlson
0d14ec597b
filemanip: add tests for YAML.
Since currently we can only serialize YAML, not load it, verify that it
serializes correctly twice.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2013-12-31 23:41:28 +00:00
brian m. carlson
cb17765453
Check that serialized data is stable.
Extend the filemanip tests to ensure that the data is serialized the same way
every time.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2013-12-31 23:38:25 +00:00
brian m. carlson
0774a4cdd7 Merge branch 'master' into peter 2013-12-31 22:41:17 +00:00