Versioning CLI and Python API#241
Conversation
The rel_path branch results in only including staged files in the snapshot. Complete snapshots of the remote folder are needed so unchanged files are not omitted in a snapshot.
Previous metadata tracking was only for files. This tracks paths (both files and directories) so we can preserve permissions for directory trees.
This moves the dsi_vcs into dsi as a package under utils so it will be installed and available. This also begins tests for the utility.
| | root_folder | TEXT | Repository root path | | ||
| | commit_hash | TEXT | UUID4 hex (32 chars) | | ||
| | committed_at | TEXT | ISO-8601 timestamp | | ||
| | owner_name | TEXT | Linux user who committed | |
There was a problem hiding this comment.
Is this intended to be platform specific?
There was a problem hiding this comment.
No, its not supposed to. I was thinking only to store linux username for now. Later, we'll need to figure out how to bind this with unique id (like email) or manage if same user has different names on different platforms. Anyway, I'll update the description text to Username of the committer.
| | lstat | TEXT | JSON of os.lstat() result | | ||
| | permissions_octal | TEXT | e.g., "0o755" | | ||
| | permissions_str | TEXT | e.g., "rwxr-xr-x" | | ||
| | owner_name | TEXT | Username | |
There was a problem hiding this comment.
Should this store uid/gid instead?
There was a problem hiding this comment.
I mainly chose to store username instead of uid for the following reasons,
- uid will change in different platform.
- ACL only stores username not uid.
| | md5_hash | TEXT | Content hash (files only) | | ||
| | lstat | TEXT | JSON of os.lstat() result | | ||
| | permissions_octal | TEXT | e.g., "0o755" | | ||
| | permissions_str | TEXT | e.g., "rwxr-xr-x" | |
There was a problem hiding this comment.
Should we just store one representation of the permissions? For octal, I would expect it to be stored as an integer instead of string.
There was a problem hiding this comment.
I also thought it was redundant. Will merge these two into one.
| - diff: An optional argument to specify the versions to compare, specified as a space-separated string or list of commit hashes. | ||
| - restore: A required argument to specify the version to restore, specified by its commit hash. | ||
| """ | ||
| print("hello from versioning") |
There was a problem hiding this comment.
Suggest removing this print.
| | permissions_str | TEXT | e.g., "rwxr-xr-x" | | ||
| | owner_name | TEXT | Username | | ||
| | group_name | TEXT | Group name | | ||
| | setuid, setgid, sticky | INTEGER | Special bits (0/1) | |
There was a problem hiding this comment.
Shouldn't these already be captured by the octal permissions?
There was a problem hiding this comment.
Yes. this was redundant. Will remove these.
The rel_path branch results in only including staged files in the snapshot. Complete snapshots of the remote folder are needed so unchanged files are not omitted in a snapshot.
Adds Versioning with DSI.
A command line interface
dsi-vcs(rsync-based file version control system) module located indsi/utils/version_control/.A python API integrated with DSI
CLI Commands - Full reference for all 7 commands:
init- Initialize repositoryadd- Stage files for commitdelete- Stage files for deletionremove- Unstage filescommit- Create snapshotslog- View commit historydiff- Compare versionsrestore- Restore to previous versionPython API - Complete
Versionclass reference with usage examplesHelper Functions - Metadata collection utilities from
vcs_metadata_helper.pyDatabase Functions and Schema - SQLite database operations and schema in
vcs_db.py