Adding a Recent Changes Filter:
For Lab 2, I contributed to my teammate Steven's project Repo_Code_packager. The goal was to add a new feature so that the tool can package only the files modified in the last 7 days. This was done by implementing a --recent (or -r) command-line flag.
Step 1: Filing an Issue
I first checked the repo’s Issues to make sure no one had already started this feature. Since I didn’t find it, I filed a new issue: Add support for --recent flag.
In the issue, I explained:
-> The new flag I wanted to add (--recent / -r)
-> The expected behavior (include only files modified in the last 7 days)
-> Example usage with commands and expected output
-> This gave the maintainer enough detail to understand the feature before I started coding.
Step 2: Fork, Clone, Branch
I forked the repo into my GitHub account https://github.com/kkrishnan10/Repo_Code_packager, then cloned it locally:
git clone https://github.com/kkrishnan10/Repo_Code_packager.git
cd Repo_Code_packager
git checkout -b feature-recent-files
All my changes were committed on the new branch feature-recent-files.
Step 3: Implementation
I made three main changes in src/main.py:
-> Added a timestamp check
-> Updated the file discovery logic
The program now filters files so only those modified in the last 7 days are included when --recent or -r is used.
-> Added a new “Recent Changes” section in the output
Step 4: Testing
I tested my changes locally:
python src/main.py . --recent
python src/main.py . -r -o recent-output.txt
Expected result: Only files modified in the last 7 days appeared in both the console and the saved output file.
Actual result: Worked as expected.
Step 5: Pull Request
Finally, I pushed my branch and opened a Pull Request.
My PR description included:
-> Summary of the feature
-> Implementation details
-> Example usage with code blocks
Links:
Repo: https://github.com/Jongwan93/Repo_Code_packager
Issue: https://github.com/Jongwan93/Repo_Code_packager/pull/4
Pull Request: https://github.com/Jongwan93/Repo_Code_packager/pull/4
Top comments (0)