Rust 1.66.0 was announced[0].
The code fixes were all for the clippy warning regarding needless
borrows.
The doc tool now parses for HTML, so any <placeholder> now needs to
be wrapped in backticks, i.e. `<placeholder>`.
[0]: https://blog.rust-lang.org/2022/12/15/Rust-1.66.0.html
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
To have a clear separation of which are public functions and which are
private functions, two `impl Repository` blocks are created.
This lead to some refactoring of names and inclusion of helper
functions, removing the need for the `git2_repo` function.
The `get_commit_stats` function seemed off, since the `Stats` in this
case are to do with the repository. Thus, it does not take a commit
anymore and instead uses the `head` commit to calculate the
repository's `Stats`.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This is an overhaul of the diff module. The major changes are as
follows.
It shouldn't be possible for an added or deleted file to have any
other kind line changes other than additions or deletions. So there
are now 3 different kinds of changes, Addition, Deletion, or
Modification.
Hunk and Hunks now take a generic type parameter to allow for the
three types of changes. As a consequence a FileDiff does the same.
For the actual file representations, they fill in their parameters as
Addition, Deletion, or Modification.
During this refactor some renaming was also made:
* CreateFile -> Added -- as well as the created field being renamed
to added.
* DeleteFile -> Deleted
* MoveFile -> Moved
* CopyFile -> Copied
* ModifiedFile -> Modified
The Stats are also now carried in the Diff instead of being
calculated. They can be retrieved from the `git2::Diff`.
The final change was to remove the `source::Commit::stats` field in
favour of accessing the `Diff::stats` instead.
The above changes mean that the serialization of `Diff` and `Commit`
are not backwards compatible.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Refactor the source data types to reuse existing logic and update to
the latest protocol.
The `Blob` and `Tree` data types are updated to be backed by `File`
and `Directory` respectively. This allows the construction of them to
be much simpler and reuse any existing logic on those types. This also
lead to the removal of `ObjectType` and `Info`.
The `Revision` type was removed in favour of using the `Revision`
trait.
The `Revisions` type was renamed to `View`, while also renaming the
`revision` module to `view`. A `View` is a simple encoding of what a
peer's "view" would look like, i.e. what references do they have. This
also required the introduction of getting free-form categories in the
reference db, i.e. `refs/<category>`, and so a `Categories` iterator
was also introduced.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
The file_system types, Label & Path, are overengineered. It's more
natural to use the Path and PathBuf types provided by the std library.
This replaces any mention of Label with String and any use of the old
Path with either std::path::Path or std::path::PathBuf, depending on
what kind of ownwership is needed.
Anywhere a "root" directory is needed `PathBuf::new()` is used,
i.e. an empty `PathBuf`. Otherwise `Path::new` can used to pass
directory, or in fact a &str can also be used since it implements
AsRef<Path>.
The `File` and `Directory` types also contain there relative paths,
which can be retrieved while traversing the Tree.
Note the special file name `"special/faux\\path"` requires the use of an
escaping string construction, i.e. `r"special/faux\\path"`.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This patch applies some refactoring to the directory module. It
applies some renaming and adds some useful methods to the `File` and
`Directory` types.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Other VCS systems are no longer expected to be supported.
Remove the git hierarchy up to the top-level and remove the vcs
hierarchy.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
- Added Oid into Directory and File.
- Moved file content and directory content out into their own.
- Lazily load directory content on-demand.
- Take advantage of git2::tree to retrieve an entry on-demand.
Also added a new example for browsing.
Signed-off-by: Han Xu <keepsimple@gmail.com>
- Replace the existing Repository::new() with ::open()
- Add Repository::discover() to support searching parent directories.
Signed-off-by: Han Xu <keepsimple@gmail.com>
- Update design doc.
- Refactor History API.
- Use FromRevision and IntoCommit traits.
- Add more test cases.
Signed-off-by: Han Xu <keepsimple@gmail.com>
- Add a code browsing test
- Update design doc, mainly Code Browsing and Diff.
- Simplify `Directory`.
- Remove `Tree` and `Forest`, and `SystemType`.
- Use `Rev` in `diff()`.
Signed-off-by: Han Xu <keepsimple@gmail.com>