The changes in this commit add support for tracking the upstream head commit in virtual branches. This is done by introducing a new field `upstream_head` in the `Branch` struct. The `upstream_head` field represents the last commit that has been pushed to the upstream branch.
The following changes were made:
- Added `upstream_head` field to the `Branch` struct
- Updated the `create_virtual_branch` function to initialize the `upstream_head` field as `None`
- Updated the `push` function to set the `upstream_head` field to the current head commit of the virtual branch
- Updated the `create_virtual_branch_from_branch` function to initialize the `upstream_head` field as `None`
- Updated the `BranchWriter` struct to write the `upstream_head` field to the branch metadata
- Updated the `TryFrom<&dyn crate::reader::Reader>` implementation
* remove GB_FLUSH after processing it
* add test for flushing and deleting flush file
* add more unittests for cases:
* no session, file -> no flush, file deleted
* session, file -> flush, file deleted
* session, no file -> no flush
The `set_user` function in the client code has been updated to return the updated user object after setting it in the app. This change allows for better handling of the user object and enables further operations on it if needed. The updated function now returns a `Result<User, Error>` instead of `Result<(), Error>`.
The zip controller has been refactored to use the new zip module. This change includes updating the import statements and modifying the main function to generate the tauri context with the new zip module.
Additionally, the zip controller now has a new struct called Controller, which contains the necessary fields for handling zip operations. The TryFrom trait has been implemented for the Controller struct to allow for easy creation from the AppHandle.
The main changes include:
- Importing the zip module and updating import statements
- Refactoring the main function to generate the tauri context with the new zip module
- Creating a new Controller struct for handling zip operations
- Implementing the TryFrom trait for the Controller struct to allow for easy creation from the AppHandle
The changes in this commit refactor the error handling in the controller module. Instead of using a specific error type for storage errors, the code now uses the `anyhow` crate to handle errors more generically. This simplifies the code and allows for better error handling and reporting.
The users controller has been added to handle user-related operations such as getting, setting, and deleting user information. This controller is responsible for interacting with the storage module to perform these operations.
The mark_active_session function has been added to the Repository struct. This function updates the last_timestamp_ms field of the current session's metadata to the current system time. This is done to keep track of the last time the session was active.
This function is called in several places where the current session is required to be updated, such as when writing to targets, branches, deltas, bookmarks, and handling git file changes. By updating the session metadata, we ensure that the session remains active and up-to-date.
This change improves the accuracy of session tracking and helps in managing active sessions effectively.
The changes in this commit refactor the methods in the `projects_storage` module to use consistent naming and simplify the code. The following changes were made:
- Renamed the `update_project` method to `update` in the `projects_storage` module.
- Renamed the `add_project` method to `add` in the `projects_storage` module.
- Renamed the `get_project` method to `get` in the `projects_storage` module.
- Renamed the `list_projects` method to `list` in the `projects_storage` module.
These changes improve code readability and maintainability by using consistent naming conventions and simplifying the method signatures.
- The `upsert_bookmark` method was not properly handling the async code. It now properly awaits the necessary async operations.
- The `init_project` method now properly handles async code and awaits the necessary async operations.
- The `init` method now properly handles async code and awaits the necessary async operations.
- The `add_project` method now properly handles async code and awaits the necessary async operations.
This ensures that the async operations are properly executed and awaited, preventing potential race conditions or incorrect behavior.
The previous implementation used a string to represent the project path, which led to potential issues when manipulating paths. The update changes the project path to use the path::PathBuf type, which provides better path manipulation and error handling capabilities. This change improves the overall reliability and maintainability of the code.