Skip to content

Commit 33fd4cd

Browse files
committed
resolves #18 and closes #13
Refactored the ngit source code to better suit ngit needs and implemented a minimal checkout that kinda works, should redo the checkout when we'll have staging area and index file The ngit.drawio, used to understand the relationship among functions can be found at: https://drive.google.com/file/d/1RpRVO7Vel1Bi0yjyIlCwQDp3Y9UYYhYr/view?usp=sharing This commit closes #10 also, because that's also kind of completed Signed-off-by: Nyx <189459385+nyx-4@users.noreply.github.com>
1 parent cd62a90 commit 33fd4cd

11 files changed

Lines changed: 663 additions & 432 deletions

File tree

CHANGELOG.md

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
- Security
1616
-->
1717

18-
## [Unreleased]
18+
## [unreleased]
19+
20+
21+
## [0.1.2]
1922

2023
### Added
2124
- Added Sub-ArgParser for `cat-file` sub-command
@@ -27,70 +30,76 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2730
- Added `CONTRIBUTING` guideline
2831
- Added a `kvlm_parser` and `kvlm_serializer` to parse and write git commits and tags
2932
- Added Sub-ArgParser for `log` sub-command
30-
- Added `ngit log`, git-inspired deviating from official WYAG.
33+
- Added `ngit log`, more git-inspired, i.e., deviating from official WYAG
3134
- Added `ngit ls-tree`, list the contents of a tree(-ish) object
35+
- Added `ngit checkout`, switch branches or restore working tree files
3236

3337

3438
### Changed
3539
- Changed some ruff defaults in pyproject.toml
3640
- The GitObject's sub-classes are moved to `object.py`
3741

3842

43+
### Fixed
44+
- The directory structure was fixed to reduce clutter and inter-project dependencies
45+
- Instead of using general `Exception`, more concrete exceptions are raised
46+
3947
## [0.1.1]
4048

4149
### Added
42-
- pre-commit hooks have beed added.
43-
- A new microproject `ngit` is added.
44-
- ArgParser is added for better CLI arguments support.
45-
- Added Sub-ArgParser for `init` sub-command.
46-
- Added `ngit init` that Initializes a new, empty repository.
47-
- Added `GitRepository` and some helper functions to assisst `ngit init`.
48-
- Added ngit/README stub.
50+
- pre-commit hooks have beed added
51+
- A new microproject `ngit` is added
52+
- ArgParser is added for better CLI arguments support
53+
- Added Sub-ArgParser for `init` sub-command
54+
- Added `ngit init` that Initializes a new, empty repository
55+
- Added `GitRepository` and some helper functions to assisst `ngit init`
56+
- Added ngit/README stub
4957

5058
### Fixed
51-
- Minor fixes in calc.
59+
- Minor fixes in calc
5260

5361

5462
## [0.1.0]
5563

5664
### Changed
57-
- The min, max and sum functions are changed to accomodate single argument.
65+
- The min, max and sum functions are changed to accomodate single argument
5866

5967
### Fixed
60-
- Fixed unary - operator.
61-
- Minor bug-fixes.
68+
- Fixed unary - operator
69+
- Minor bug-fixes
6270

6371
### Removed
64-
- The test cases that were failing were either edited, or removed completely.
72+
- The test cases that were failing were either edited, or removed completely
6573

6674

6775

6876
## [0.0.3]
6977

7078
### Added
7179

72-
- Ported tests from [fish-shell](https://github.com/fish-shell/fish-shell/blob/master/tests/checks/math.fish) to pytest.
73-
- Ported examples from [math - perform mathematics calculations](https://fishshell.com/docs/current/cmds/math.html#examples) to check50 and pytest.
74-
- Added a simple lexical analyzer (without Error handling).
80+
- Ported tests from [fish-shell](https://github.com/fish-shell/fish-shell/blob/master/tests/checks/math.fish) to pytest
81+
- Ported examples from [math - perform mathematics calculations](https://fishshell.com/docs/current/cmds/math.html#examples) to check50 and pytest
82+
- Added a simple lexical analyzer (without Error handling)
7583
- Added GitHub workflow for automated testing using pytest
7684
- Added GitHub workflow for deploymeny to PyPI and TestPyPI
77-
- Added Shunting yard algorithm to solve Operator precedence.
78-
- Linked all math.* function in `known_lexemes` by default.
85+
- Added Shunting yard algorithm to solve Operator precedence
86+
- Linked all math.* function in `known_lexemes` by default
7987
- Added reverse polish notation converter & solver
8088
- Added support for base 2, 8, and 16 using `--base` flag
8189

8290

8391
### Changed
84-
- The format of `token_stream` returned by `analyzer.lexical_analyzer` is changed.
85-
- Some tests are changed to simplify logic.
92+
- The format of `token_stream` returned by `analyzer.lexical_analyzer` is changed
93+
- Some tests are changed to simplify logic
8694

8795
## [0.0.1]
88-
- Setup the skeleton of MicroProjects in an extensible manner.
96+
- Setup the skeleton of MicroProjects in an extensible manner
8997
- Added Calculator module
9098

9199

92-
<!-- Here comes the `git diff` of each version. -->
93-
[unreleased]: https://github.com/nyx-4/MicroProjects/compare/v0.1.1...HEAD
100+
<!-- Here comes the `git diff` of each version -->
101+
[unreleased]: https://github.com/nyx-4/MicroProjects/compare/v0.1.2...HEAD
102+
[0.1.2]: https://github.com/nyx-4/MicroProjects/compare/v0.1.1...v1.1.2
94103
[0.1.1]: https://github.com/nyx-4/MicroProjects/compare/v0.1.0...v0.1.1
95104
[0.1.0]: https://github.com/nyx-4/MicroProjects/compare/v0.0.3...v0.1.0
96105
[0.0.3]: https://github.com/nyx-4/MicroProjects/compare/v0.0.1...v0.0.3

microprojects/ngit/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ The supported subset of Git's commands are listed here.
8080
8181

8282
### add
83+
8384
### cat-file
8485
```sh
8586
usage: ngit [-h] [-e | -p | -t | -s] [<type>] object
@@ -99,8 +100,25 @@ options:
99100
```
100101
101102
### check-ignore
103+
102104
### checkout
105+
```sh
106+
usage: ngit [-h] [-q] [-f] [--dest DEST] [branch]
107+
108+
Switch branches or restore working tree files
109+
110+
positional arguments:
111+
branch The branch or commit or tree to checkout
112+
113+
options:
114+
-h, --help show this help message and exit
115+
-q, --quiet Quiet, suppress feedback messages
116+
-f, --force When switching branches, throw away local changes and any untracked files or directories
117+
--dest DEST checkout to <dest> instead of current repository, provided <dest> is empty directory
118+
```
119+
103120
### commit
121+
104122
### hash-object
105123
```sh
106124
usage: ngit [-h] [-t <type>] [-w] [--stdin-paths] [-i] [path ...]
@@ -172,8 +190,31 @@ options:
172190
Pretty-print the contents of the commit logs in a given format
173191
--date FORMAT The format to use for dates in ngit log
174192
```
193+
175194
### ls-files
176195
### ls-tree
196+
```sh
197+
usage: ngit [-h] [--format FORMAT_STR] [-d] [-r] [-t] [-l] [-z] [--name-only] [--object-only] [tree]
198+
199+
List the contents of a tree object
200+
201+
positional arguments:
202+
tree Tree(-ish) object to start at.
203+
204+
options:
205+
-h, --help show this help message and exit
206+
--format, --pretty FORMAT_STR
207+
Pretty-print the contents of the tree in a given format
208+
-d Show only the named tree entry itself, not its children.
209+
-r Recurse into sub-trees.
210+
-t Show tree entries even when going to recurse them.
211+
-l, --long Show object size of blob (file) entries.
212+
-z \0 line termination on output and do not quote filenames.
213+
--name-only, --name-status
214+
List only filenames, one per line.
215+
--object-only List only names of the objects, one per line.
216+
```
217+
177218
### rev-parse
178219
### rm
179220
### show-ref

microprojects/ngit/kvlm.py

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)