The main dependant of `radicle-git`, and its crates, is [`heartwood`].
It is licensed under MIT or Apache-2.0, which has been incompatible with the GPL-3.0 license.
Since the intellectual property of this code base is with the Better Internet Foundation, it was
decided to re-license code in this repository to make the upstream repository compatible.
- Remove the license headers (and instructions to add them)
- Add MIT and Apache-2.0 licenses
- Remove the GPL-3.0 license
- Change the license declarations in the `Cargo.toml` files
[`heartwood`]: https://app.radicle.xyz/nodes/seed.radicle.xyz/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
The formatting configuration is not worth the maintenance of a nightly
version. Remove it and allow the default formatting to be used
instead.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Rust 1.67 was announced[0].
Update the nix sources to be on par with the latest rustc version.
This required fixes to clippy warnings for using variable
interpolation for format strings.
There was also an advisory error related to libgit2-sys[1], which is
transitively depended on via git2. The fix is included in the 0.16.1
version of git2.
[0]: https://blog.rust-lang.org/2023/01/26/Rust-1.67.0.html
[1]: https://rustsec.org/advisories/RUSTSEC-2023-0003
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
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
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
- 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>