Skip to content

Versioning CLI and Python API#241

Open
sayefsakin wants to merge 112 commits into
mainfrom
versioning
Open

Versioning CLI and Python API#241
sayefsakin wants to merge 112 commits into
mainfrom
versioning

Conversation

@sayefsakin

Copy link
Copy Markdown
Collaborator

Adds Versioning with DSI.

  • A command line interface dsi-vcs (rsync-based file version control system) module located in dsi/utils/version_control/.

  • A python API integrated with DSI

  • CLI Commands - Full reference for all 7 commands:

    • init - Initialize repository
    • add - Stage files for commit
    • delete - Stage files for deletion
    • remove - Unstage files
    • commit - Create snapshots
    • log - View commit history
    • diff - Compare versions
    • restore - Restore to previous version
  • Python API - Complete Version class reference with usage examples

  • Helper Functions - Metadata collection utilities from vcs_metadata_helper.py

  • Database Functions and Schema - SQLite database operations and schema in vcs_db.py

sayefsakin and others added 13 commits April 15, 2026 12:09
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.
@sayefsakin sayefsakin requested a review from jpulidojr April 29, 2026 18:02
Comment thread dsi/utils/version_control/README.md Outdated
| 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 |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intended to be platform specific?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread dsi/utils/version_control/README.md Outdated
| 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 |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this store uid/gid instead?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread dsi/utils/version_control/README.md Outdated
| 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" |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just store one representation of the permissions? For octal, I would expect it to be stored as an integer instead of string.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also thought it was redundant. Will merge these two into one.

Comment thread dsi/dsi.py Outdated
- 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")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest removing this print.

Comment thread dsi/utils/version_control/README.md Outdated
| 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) |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these already be captured by the octal permissions?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. this was redundant. Will remove these.

@jpulidojr jpulidojr linked an issue May 14, 2026 that may be closed by this pull request
sayefsakin and others added 6 commits May 21, 2026 10:45
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.
Vedant1 and others added 30 commits July 15, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add native DSI Versioning tracking support

4 participants