-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version Control Program and Rolling Backup Utility #88
base: main
Are you sure you want to change the base?
Conversation
I can code review this. |
I can code review this! |
High Level Checks:
Code Checks:
Using the updated version of Issue #69, this request fully resolves all purposed tasks. The request has a few test files, the |
High Level Checks:
Code Checks:
Wow! Great job. This request fully resolves all tasks, has multiple tests, follows formatting standards, compiles and runs and documentation is included. Instructions to run this program were super easy to follow, and many edge cases were considered, but I was especially impressed by the way it handles overwriting the saved versions when the user creates more than 3 versions. The code achieves its intended purpose, is organized and maintainable and maintains the same level of performance. I think its cool you can run this program both in qemu and in the OS space, but as I was running it I was a little confused about the difference between the two as the OS space was behaving a little differently, but this was outlined here in the PR "Saving, viewing, and listing can also be done for files in OS but not in the way the program was designed [vcpTest.txt]". I think the fact that it runs in the OS is above and beyond and it is really cool they executed such a large scope. This is a seemingly simple task but I can see there there are many edge cases that need to looked at that are handled beautifully. Some functions were a little chunky and could have been broken up, but besides that everything looks great! |
#define MAX_VERS 3 | ||
|
||
/** | ||
* Ensure the root directory "vctl" exists. This will be the root directory for all future |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice documentation!
* @param filename: current file name | ||
* @return verCount: total number of versions currently in directory | ||
*/ | ||
int retrieveVer_Count(char *filename) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is pretty large, could break it up a bit for readability.
} | ||
|
||
/** | ||
* Function that will implement that -saveVersion command/flag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here, this function could be broken up a little for reusability and readability.
return; | ||
} | ||
int fd_source = open(filename, O_RDONLY); | ||
if (fd_source < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice error checking throughout the whole project!
This is a cool idea and I appreciate how you built all the necessary infrastructure around it to make it work despite xv6's limitations.
I feel like Overall very cool project! These are minor issues, nice work! |
vcp
The "vcp" command revolves around the idea of a version control/backup program. A hidden root directory (vctl) is created when the command is ran; within it a sub-directory with the name of the file we are working with is also created. Within this sub-directory a maximum of 3 files can be saved (in essence 3 different versions of the sub-directory's file name).
Example: vctl / filename / Version1_filename
The point is to be able to save the most important versions of a program so that if necessary, the user can come back and review past versions of that exact program and extract the needed info that can be applied in the user's current program. When 3 versions already exist for a specific file and the user wants to save another version, the oldest of the 3 versions will be overwritten upon confirmation that the user agrees upon this process. If agreed, all existing versions will be shifted forward and renamed and the newest version will be added to the version control directory.
Example: Version2_filename -> Version1_filename, Version3_filename -> Version2_filename and filename -> Version3_filename
Added Files:
user/vcp.c
// Testing
FogOS-VCP/getlinetest.txt
FogOS-VCP/vcpTest.txt
our lab with broken.c to test long files
Modifications:
FogOS-VCP/Makefile
Flags:
(-saveVersion): saves the current state of the file as a new version and label it with its respective version number
(-listVersions) : displays a list of all saved versions of the specified file for example: Version3_filename.txt
(-viewVersion) : displays the selected file version existing in the list of file versions for the specified file like the format of 'cat [filename]' allowing user to copy and access functions or implementations they wish they didn't get rid of etc. For example: /vcp -viewVersion Version2_filename.txt
How to Test | How it Works | Limitations:
You can refer to the file vcpTest.txt where I included examples of how to test the program within QEMU.
As of now you can only test with files in your OS directory (where your Makefile exists) or with files you create in QEMU with echo. Future implementation will handle accessing files from other directories.
Due to limitations in xv6: only inside QEMU using echo can you really see the multiple versions of saving, viewing, and listing [refer to vcpTest.txt for why]. Saving, viewing, and listing can also be done for files in OS but not in the way the program was designed [vcpTest.txt]
If testing in OS, ensure the file is added to your Makefile fs.img: 2nd line only. Do not make clean after you save versions as this will erase all versions and directories you've saved with vcp (due to xv6 limitations). You can exit QEMU and then rerun QEMU and the data will still be there.
Inside QEMU:
The program will work like normal, saving max 3 versions and overwriting but all versions will have same content (but they are separate files [refer to vcpTest.txt])
If testing inside QEMU: create a program with content like so