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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
We really do want to make sure that the data is on disk before we close the
file, or at least try really hard. Errors from the fsync are ignored because we
can write to a file object that doesn't support fsync, like sys.stdout, or we
could have a pseudo-file object that doesn't support the fileno method.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Instead of duplicating the calling of the transaction methods in every
FileFormat, simply move those calls into the _open and _close methods in
FileFormat itself.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
This also includes a unit test to ensure that round-tripping works properly for
those serializations where it's supported.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Not that newfol is likely to work especially well on non-Unix systems, but
using os.devnull adds a little bit of portability.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
This inverted test, besides being wrong (and potentially closing something
important like sys.stdout), caused a ResourceWarning in testgit.py.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
The code had failed to pass through the transaction types, resulting in Git
transactions not working.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>