diff options
Diffstat (limited to 'vendor/gix-revision')
-rw-r--r-- | vendor/gix-revision/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/gix-revision/CHANGELOG.md | 171 | ||||
-rw-r--r-- | vendor/gix-revision/Cargo.toml | 17 | ||||
-rw-r--r-- | vendor/gix-revision/LICENSE-APACHE | 191 | ||||
-rw-r--r-- | vendor/gix-revision/LICENSE-MIT | 21 | ||||
-rw-r--r-- | vendor/gix-revision/src/describe.rs | 187 | ||||
-rw-r--r-- | vendor/gix-revision/src/lib.rs | 4 | ||||
-rw-r--r-- | vendor/gix-revision/src/spec/mod.rs | 51 | ||||
-rw-r--r-- | vendor/gix-revision/src/spec/parse/function.rs | 4 | ||||
-rw-r--r-- | vendor/gix-revision/src/types.rs | 48 |
10 files changed, 506 insertions, 190 deletions
diff --git a/vendor/gix-revision/.cargo-checksum.json b/vendor/gix-revision/.cargo-checksum.json index a4281e115..434b15248 100644 --- a/vendor/gix-revision/.cargo-checksum.json +++ b/vendor/gix-revision/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"273973dd2b8016144e2b944e12b86e82b4e8fc4215696fa2d9ce8293b45e09bf","Cargo.toml":"1a6d0c90d98126520ee5309f4622803c7ddb529467504106bcd055036ab00721","README.md":"809c88a6c70ec74eabc883e40f5be368890c1929f7575e49e38256cde671f813","src/describe.rs":"2eebe90d99919f4dbb5a2bb2c0113d7c74cc199ad78c2182bf7964ce6639deb0","src/lib.rs":"17f9751f585ae2bc1b16691a4834898b583508c0de8276fcb5cf1d6c4c045e92","src/spec/mod.rs":"669af4fa43750d52fb2b4e65bb0031a27396bae574df6e02c40839bb7558dcae","src/spec/parse/delegate.rs":"b00c2d9ab8fdea72200f7f781662bf07f31164cb8b5a9831824c8a8d9d0c2277","src/spec/parse/function.rs":"3446a5f372aeeda60e5cf1507bf9c8a25981b5f2d33afe7a3ce787f15f92043c","src/spec/parse/mod.rs":"a5a565d483088cd3a4a48cad09fa78f9eae2f18fd844ffb0b9fb0afd4bfd7617","src/types.rs":"62395bf474daf0a09a4de5c6d11e5b4354033b2f1fff2edcbd3b11d87841edc2"},"package":"810f35e9afeccca999d5d348b239f9c162353127d2e13ff3240e31b919e35476"}
\ No newline at end of file +{"files":{"CHANGELOG.md":"30d8b9a076cf1efa365c29ba2197e8bd9cdc9968b3846732ceb9d024165f304c","Cargo.toml":"3ac849639d24b10be26527b927f81e34fdcb90c396dd8b0f346c82d19cf3864a","LICENSE-APACHE":"cb4780590812826851ba250f90bed0ed19506ec98f6865a0e2e20bbf62391ff9","LICENSE-MIT":"49df47913ab2beafe8dc45607877ae64198bf0eee64aaad3e82ed9e4d27424e8","README.md":"809c88a6c70ec74eabc883e40f5be368890c1929f7575e49e38256cde671f813","src/describe.rs":"6b9a4c4e9bc7ebba84efedb0036ebb90bb7a4a547859a556986076cb32bd5128","src/lib.rs":"1456d5eef6a545d5c6e230b120970bf80c0372ca6592c8eb9b79ddbbd0bbdbb6","src/spec/mod.rs":"f95f2d547c913aace4a0e895b9cfda7d38400f171886a85f6ee2f73313d27950","src/spec/parse/delegate.rs":"b00c2d9ab8fdea72200f7f781662bf07f31164cb8b5a9831824c8a8d9d0c2277","src/spec/parse/function.rs":"fa7943761759b1f7b292e2f31ef510bc7b9efd5f6ce89746e5dc53ab963e1d9f","src/spec/parse/mod.rs":"a5a565d483088cd3a4a48cad09fa78f9eae2f18fd844ffb0b9fb0afd4bfd7617"},"package":"5044f56cd7a487ce9b034cbe0252ae0b6b47ff56ca3dabd79bc30214d0932cd7"}
\ No newline at end of file diff --git a/vendor/gix-revision/CHANGELOG.md b/vendor/gix-revision/CHANGELOG.md index 8df1aff19..18c8cd63c 100644 --- a/vendor/gix-revision/CHANGELOG.md +++ b/vendor/gix-revision/CHANGELOG.md @@ -5,6 +5,174 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.15.2 (2023-06-10) + +<csr-id-4deea8a9cf5a9e77ec138311267c9853172db14c/> + +### Other + + - <csr-id-4deea8a9cf5a9e77ec138311267c9853172db14c/> Add information on how to turn `LazyCommit` into commit. + This is to more easily support custm graph walks later. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 5 commits contributed to the release. + - 3 days passed between releases. + - 1 commit was understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Prepare changelogs prior to release ([`298f3d7`](https://github.com/Byron/gitoxide/commit/298f3d7359c5b183314d8c584e45dcdd559d88b3)) + - Merge branch 'walk-with-commitgraph' ([`fdee9a2`](https://github.com/Byron/gitoxide/commit/fdee9a22873a13ae644d3dc92f8fe93f8f0266c0)) + - Adapt to changes in `gix-revwalk` ([`f7d95d1`](https://github.com/Byron/gitoxide/commit/f7d95d189af1422a7ba48db1857452e32e1d9db9)) + - Add new `gix-revwalk` crate for support types related to revision walking. ([`13ce887`](https://github.com/Byron/gitoxide/commit/13ce887682f5c31d1f78a63613ca97b811e4ffba)) + - Add information on how to turn `LazyCommit` into commit. ([`4deea8a`](https://github.com/Byron/gitoxide/commit/4deea8a9cf5a9e77ec138311267c9853172db14c)) +</details> + +## 0.15.1 (2023-06-06) + +### Bug Fixes + + - <csr-id-fd2593cc1e5824687f3bcc4be4badc3d7920e5fc/> avoid duplicate error message + "There was an error looking up a commit" could be printed twice in error stacks + due to a copy-paste error. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 3 commits contributed to the release. + - 1 commit was understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Release gix-revision v0.15.1, gix v0.45.1 ([`11766a0`](https://github.com/Byron/gitoxide/commit/11766a0a82754fee9918ccdb8eaf92af6d2561ba)) + - Merge branch 'adjustments-for-cargo' ([`04f011c`](https://github.com/Byron/gitoxide/commit/04f011c3c3e49e87a3b868d4bf6e77a361b96da8)) + - Avoid duplicate error message ([`fd2593c`](https://github.com/Byron/gitoxide/commit/fd2593cc1e5824687f3bcc4be4badc3d7920e5fc)) +</details> + +## 0.15.0 (2023-06-06) + +<csr-id-dbc6cbb4363c2532f81b0bd6e351c4577bb9e9a3/> + +### Chore + + - <csr-id-dbc6cbb4363c2532f81b0bd6e351c4577bb9e9a3/> inline format args + +### New Features + + - <csr-id-1bd93bedd2f184510239c50c345d3dbc41d7d13b/> allow graph sharing by unifying `Flags` type. + This makes the graph used in `gix-negotiate` shareable by callers, which can + do their own traversal and store their own flags. The knowlege of this traversal + can be kept using such shared flags, like the `PARSED` bit which should be set whenever + parents are traversed. + + That way we are able to emulate the algorithms git uses perfectly, as we keep exactly the + same state. + - <csr-id-9ab205102eacaf0758c143941f43831a481a1f06/> various improvements to the API + * make `CommitterTimestamp` available as type, making the code using it more descriptive. +* add `new()` to `PriorityQueue` +* add `Graph::try_lookup_and_insert_default()` +* add `Debug` impl for `Graph` + +### New Features (BREAKING) + + - <csr-id-11ad8a890a6233befb5d2b6b41caadbcb296c3f5/> Add version of Graph that handles fully-parsed commits + This renames `graph::Commit` to `graph::LazyCommit` to make space for `graph::Commit` to be a fully owned. + `LazyCommit::to_owned()` was added to obtain fully owned `Commit` instances. + Rename `Graph::try_lookup_and_insert()` to `Graph::try_lookup_or_insert()` and + `Graph::try_lookup_and_insert_default()` to `Graph::try_lookup_or_insert_default()` + + Additionally, add the `peek()` and `iter_unordered()` method to the `PriorityQueue`, along with an implementation for `Clone` + Rename `PriorityQueue::iter_random()` to `::iter_unordered()`. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 15 commits contributed to the release over the course of 13 calendar days. + - 18 days passed between releases. + - 4 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Release gix-date v0.5.1, gix-hash v0.11.2, gix-features v0.30.0, gix-actor v0.21.0, gix-path v0.8.1, gix-glob v0.8.0, gix-quote v0.4.4, gix-attributes v0.13.0, gix-chunk v0.4.2, gix-commitgraph v0.16.0, gix-config-value v0.12.1, gix-fs v0.2.0, gix-tempfile v6.0.0, gix-utils v0.1.2, gix-lock v6.0.0, gix-validate v0.7.5, gix-object v0.30.0, gix-ref v0.30.0, gix-sec v0.8.1, gix-config v0.23.0, gix-command v0.2.5, gix-prompt v0.5.1, gix-url v0.19.0, gix-credentials v0.15.0, gix-diff v0.30.0, gix-discover v0.19.0, gix-hashtable v0.2.1, gix-ignore v0.3.0, gix-bitmap v0.2.4, gix-traverse v0.26.0, gix-index v0.17.0, gix-mailmap v0.13.0, gix-revision v0.15.0, gix-negotiate v0.2.0, gix-pack v0.36.0, gix-odb v0.46.0, gix-packetline v0.16.2, gix-transport v0.32.0, gix-protocol v0.33.0, gix-refspec v0.11.0, gix-worktree v0.18.0, gix v0.45.0, safety bump 29 crates ([`9a9fa96`](https://github.com/Byron/gitoxide/commit/9a9fa96fa8a722bddc5c3b2270b0edf8f6615141)) + - `just fmt` ([`ffc1276`](https://github.com/Byron/gitoxide/commit/ffc1276e0c991ac33ce842f5dca0b45ac69680c0)) + - Prepare changelogs prior to release ([`8f15cec`](https://github.com/Byron/gitoxide/commit/8f15cec1ec7d5a9d56bb158f155011ef2bb3539b)) + - Merge branch 'integrate-gix-negotiate' ([`ae845de`](https://github.com/Byron/gitoxide/commit/ae845dea6cee6523c88a23d7a14293589cf8092f)) + - Allow graph sharing by unifying `Flags` type. ([`1bd93be`](https://github.com/Byron/gitoxide/commit/1bd93bedd2f184510239c50c345d3dbc41d7d13b)) + - Add version of Graph that handles fully-parsed commits ([`11ad8a8`](https://github.com/Byron/gitoxide/commit/11ad8a890a6233befb5d2b6b41caadbcb296c3f5)) + - Merge branch 'auto-clippy' ([`dbf8aa1`](https://github.com/Byron/gitoxide/commit/dbf8aa19d19109195d0274928eae4b94f248cd88)) + - Autofix map-or-unwrap clippy lint (and manual fix what was left) ([`2087032`](https://github.com/Byron/gitoxide/commit/2087032b5956dcd82bce6ac57e530e8724b57f17)) + - Merge branch 'main' into auto-clippy ([`3ef5c90`](https://github.com/Byron/gitoxide/commit/3ef5c90aebce23385815f1df674c1d28d58b4b0d)) + - Merge pull request #864 from nyurik/lint-fmt ([`279dc09`](https://github.com/Byron/gitoxide/commit/279dc09446f41d7f1d76350fbfafb444e53cd7da)) + - Merge branch 'blinxen/main' ([`9375cd7`](https://github.com/Byron/gitoxide/commit/9375cd75b01aa22a0e2eed6305fe45fabfd6c1ac)) + - Inline format args ([`dbc6cbb`](https://github.com/Byron/gitoxide/commit/dbc6cbb4363c2532f81b0bd6e351c4577bb9e9a3)) + - Include license files in all crates ([`facaaf6`](https://github.com/Byron/gitoxide/commit/facaaf633f01c857dcf2572c6dbe0a92b7105c1c)) + - Merge branch 'consecutive-negotiation' ([`97b3f7e`](https://github.com/Byron/gitoxide/commit/97b3f7e2eaddea20c98f2f7ab6a0d2e2117b0793)) + - Various improvements to the API ([`9ab2051`](https://github.com/Byron/gitoxide/commit/9ab205102eacaf0758c143941f43831a481a1f06)) +</details> + +## 0.14.0 (2023-05-19) + +### New Features + + - <csr-id-59ce4c606f8ccd9b6a16da2025e6746984d32fd6/> A Graph for quick access to commits and for associating state with them. + This data structure should be used whenever stateful traversal is required, usually + by associating information with each commit to remember what was seen and what wasn't. + - <csr-id-dde8c3aca545ba20cd5752f02283b98647fd3970/> A PriorityQueue that is useful for graph traversal. + +### New Features (BREAKING) + + - <csr-id-ed258da9015d2d68734aeac485dd009760fc4da4/> `describe` usees commitgraph. + With it it can leverage the commitgraph data structure would would be more prominent + on server-side applications, presumably. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 7 commits contributed to the release over the course of 7 calendar days. + - 22 days passed between releases. + - 3 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Release gix-commitgraph v0.15.0, gix-revision v0.14.0, gix-negotiate v0.1.0, safety bump 7 crates ([`92832ca`](https://github.com/Byron/gitoxide/commit/92832ca2899cd2f222f4c7b1cc9e766178f55806)) + - Merge branch 'consecutive-negotiation' ([`4507f94`](https://github.com/Byron/gitoxide/commit/4507f94984c811ea098e43472e5f54ec4dbb90c1)) + - `describe` usees commitgraph. ([`ed258da`](https://github.com/Byron/gitoxide/commit/ed258da9015d2d68734aeac485dd009760fc4da4)) + - A Graph for quick access to commits and for associating state with them. ([`59ce4c6`](https://github.com/Byron/gitoxide/commit/59ce4c606f8ccd9b6a16da2025e6746984d32fd6)) + - A PriorityQueue that is useful for graph traversal. ([`dde8c3a`](https://github.com/Byron/gitoxide/commit/dde8c3aca545ba20cd5752f02283b98647fd3970)) + - Make clear that we do handle shallow repos, refactor tests ([`fc423e4`](https://github.com/Byron/gitoxide/commit/fc423e470de50491a725d4802066d26c05bd2b2a)) + - Release gix-object v0.29.2 ([`4f879bf`](https://github.com/Byron/gitoxide/commit/4f879bf35653bdc8f9729d524c6e8e1fb3c6886b)) +</details> + ## 0.13.0 (2023-04-26) ### New Features (BREAKING) @@ -21,7 +189,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 <csr-read-only-do-not-edit/> - - 10 commits contributed to the release over the course of 14 calendar days. + - 11 commits contributed to the release over the course of 14 calendar days. - 25 days passed between releases. - 1 commit was understood as [conventional](https://www.conventionalcommits.org). - 1 unique issue was worked on: [#814](https://github.com/Byron/gitoxide/issues/814) @@ -41,6 +209,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * **[#814](https://github.com/Byron/gitoxide/issues/814)** - Rename `serde1` cargo feature to `serde` and use the weak-deps cargo capability. ([`b83ee36`](https://github.com/Byron/gitoxide/commit/b83ee366a3c65c717beb587ad809268f1c54b8ad)) * **Uncategorized** + - Release gix-index v0.16.0, gix-mailmap v0.12.0, gix-pack v0.34.0, gix-odb v0.44.0, gix-packetline v0.16.0, gix-transport v0.30.0, gix-protocol v0.31.0, gix-revision v0.13.0, gix-refspec v0.10.0, gix-worktree v0.16.0, gix v0.44.0 ([`d7173b2`](https://github.com/Byron/gitoxide/commit/d7173b2d2cb79685fdf7f618c31c576db24fa648)) - Release gix-index v0.16.0, gix-mailmap v0.12.0, gix-pack v0.34.0, gix-odb v0.44.0, gix-packetline v0.16.0, gix-transport v0.30.0, gix-protocol v0.31.0, gix-revision v0.13.0, gix-refspec v0.10.0, gix-worktree v0.16.0, gix v0.44.0 ([`e4df557`](https://github.com/Byron/gitoxide/commit/e4df5574c0813a0236319fa6e8b3b41bab179fc8)) - Release gix-hash v0.11.1, gix-path v0.7.4, gix-glob v0.6.0, gix-attributes v0.11.0, gix-config-value v0.11.0, gix-fs v0.1.1, gix-tempfile v5.0.3, gix-utils v0.1.1, gix-lock v5.0.1, gix-object v0.29.1, gix-ref v0.28.0, gix-sec v0.7.0, gix-config v0.21.0, gix-prompt v0.4.0, gix-url v0.17.0, gix-credentials v0.13.0, gix-diff v0.29.0, gix-discover v0.17.0, gix-hashtable v0.2.0, gix-ignore v0.1.0, gix-bitmap v0.2.3, gix-traverse v0.25.0, gix-index v0.16.0, gix-mailmap v0.12.0, gix-pack v0.34.0, gix-odb v0.44.0, gix-packetline v0.16.0, gix-transport v0.30.0, gix-protocol v0.31.0, gix-revision v0.13.0, gix-refspec v0.10.0, gix-worktree v0.16.0, gix v0.44.0, safety bump 7 crates ([`91134a1`](https://github.com/Byron/gitoxide/commit/91134a11c8ba0e942f692488ec9bce9fa1086324)) - Prepare changelogs prior to release ([`30a1a71`](https://github.com/Byron/gitoxide/commit/30a1a71f36f24faac0e0b362ffdfedea7f9cdbf1)) diff --git a/vendor/gix-revision/Cargo.toml b/vendor/gix-revision/Cargo.toml index d8a43419f..92db8e065 100644 --- a/vendor/gix-revision/Cargo.toml +++ b/vendor/gix-revision/Cargo.toml @@ -13,14 +13,14 @@ edition = "2021" rust-version = "1.64" name = "gix-revision" -version = "0.13.0" +version = "0.15.2" authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"] include = [ "src/**/*", + "LICENSE-*", "CHANGELOG.md", "README.md", ] -autotests = false description = "A WIP crate of the gitoxide project dealing with finding names for revisions and parsing specifications" readme = "README.md" license = "MIT/Apache-2.0" @@ -47,16 +47,19 @@ version = "0.2.1" optional = true [dependencies.gix-date] -version = "^0.5.0" +version = "^0.5.1" [dependencies.gix-hash] -version = "^0.11.1" +version = "^0.11.2" [dependencies.gix-hashtable] -version = "^0.2.0" +version = "^0.2.1" [dependencies.gix-object] -version = "^0.29.1" +version = "^0.30.0" + +[dependencies.gix-revwalk] +version = "^0.1.0" [dependencies.serde] version = "1.0.114" @@ -67,6 +70,8 @@ default-features = false [dependencies.thiserror] version = "1.0.26" +[dev-dependencies] + [features] serde = [ "dep:serde", diff --git a/vendor/gix-revision/LICENSE-APACHE b/vendor/gix-revision/LICENSE-APACHE new file mode 100644 index 000000000..a51f59a06 --- /dev/null +++ b/vendor/gix-revision/LICENSE-APACHE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2018-2021 Sebastian Thiel, and [contributors](https://github.com/byron/gitoxide/contributors) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/gix-revision/LICENSE-MIT b/vendor/gix-revision/LICENSE-MIT new file mode 100644 index 000000000..b58e818f1 --- /dev/null +++ b/vendor/gix-revision/LICENSE-MIT @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018-2021 Sebastian Thiel, and [contributors](https://github.com/byron/gitoxide/contributors). + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/gix-revision/src/describe.rs b/vendor/gix-revision/src/describe.rs index 55cc3deef..2c1636477 100644 --- a/vendor/gix-revision/src/describe.rs +++ b/vendor/gix-revision/src/describe.rs @@ -94,7 +94,8 @@ impl<'a> Display for Format<'a> { } } -type Flags = u32; +/// A bit-field which keeps track of which commit is reachable by one of 32 candidates names. +pub type Flags = u32; const MAX_CANDIDATES: usize = std::mem::size_of::<Flags>() * 8; /// The options required to call [`describe()`][function::describe()]. @@ -129,14 +130,11 @@ impl<'name> Default for Options<'name> { /// The error returned by the [`describe()`][function::describe()] function. #[derive(Debug, thiserror::Error)] #[allow(missing_docs)] -pub enum Error<E> -where - E: std::error::Error + Send + Sync + 'static, -{ - #[error("Commit {} could not be found during graph traversal", .oid.to_hex())] - Find { +pub enum Error { + #[error("The parents of commit {} could not be added to graph during traversal", oid.to_hex())] + InsertParentsToGraph { #[source] - err: Option<E>, + err: crate::graph::insert_parents::Error, oid: gix_hash::ObjectId, }, #[error("A commit could not be decoded during traversal")] @@ -144,35 +142,32 @@ where } pub(crate) mod function { - use std::{borrow::Cow, cmp::Ordering, collections::VecDeque, iter::FromIterator}; + use std::{borrow::Cow, cmp::Ordering}; use bstr::BStr; use gix_hash::oid; - use gix_hashtable::{hash_map, HashMap}; - use gix_object::CommitRefIter; use super::{Error, Outcome}; - use crate::describe::{Flags, Options, MAX_CANDIDATES}; + use crate::{ + describe::{CommitTime, Flags, Options, MAX_CANDIDATES}, + Graph, PriorityQueue, + }; - /// Given a `commit` id, traverse the commit graph and collect candidate names from the `name_by_oid` mapping to produce + /// Given a `commit` id, traverse the commit `graph` and collect candidate names from the `name_by_oid` mapping to produce /// an `Outcome`, which converted [`into_format()`][Outcome::into_format()] will produce a typical `git describe` string. /// /// Note that the `name_by_oid` map is returned in the [`Outcome`], which can be forcefully returned even if there was no matching /// candidate by setting `fallback_to_oid` to true. - pub fn describe<'name, Find, E>( + pub fn describe<'name>( commit: &oid, - mut find: Find, + graph: &mut Graph<'_, Flags>, Options { name_by_oid, mut max_candidates, fallback_to_oid, first_parent, }: Options<'name>, - ) -> Result<Option<Outcome<'name>>, Error<E>> - where - Find: for<'b> FnMut(&oid, &'b mut Vec<u8>) -> Result<Option<CommitRefIter<'b>>, E>, - E: std::error::Error + Send + Sync + 'static, - { + ) -> Result<Option<Outcome<'name>>, Error> { max_candidates = max_candidates.min(MAX_CANDIDATES); if let Some(name) = name_by_oid.get(commit) { return Ok(Some(Outcome { @@ -198,19 +193,16 @@ pub(crate) mod function { }; } - let mut buf = Vec::new(); - let mut parent_buf = Vec::new(); - - let mut queue = VecDeque::from_iter(Some((commit.to_owned(), u32::MAX))); + let mut queue = PriorityQueue::from_iter(Some((u32::MAX, commit.to_owned()))); let mut candidates = Vec::new(); let mut commits_seen = 0; let mut gave_up_on_commit = None; - let mut seen = HashMap::<gix_hash::ObjectId, Flags>::default(); - seen.insert(commit.to_owned(), 0u32); + graph.clear(); + graph.insert(commit.to_owned(), 0u32); - while let Some((commit, _commit_time)) = queue.pop_front() { + while let Some(commit) = queue.pop_value() { commits_seen += 1; - if let Some(name) = name_by_oid.get(&commit) { + let flags = if let Some(name) = name_by_oid.get(&commit) { if candidates.len() < max_candidates { let identity_bit = 1 << candidates.len(); candidates.push(Candidate { @@ -219,14 +211,17 @@ pub(crate) mod function { identity_bit, order: candidates.len(), }); - *seen.get_mut(&commit).expect("inserted") |= identity_bit; + let flags = graph.get_mut(&commit).expect("inserted"); + *flags |= identity_bit; + *flags } else { gave_up_on_commit = Some(commit); break; } - } + } else { + graph[&commit] + }; - let flags = seen[&commit]; for candidate in candidates .iter_mut() .filter(|c| (flags & c.identity_bit) != c.identity_bit) @@ -257,16 +252,7 @@ pub(crate) mod function { } } - parents_by_date_onto_queue_and_track_names( - &mut find, - &mut buf, - &mut parent_buf, - &mut queue, - &mut seen, - &commit, - flags, - first_parent, - )?; + parents_by_date_onto_queue_and_track_names(graph, &mut queue, commit, flags, first_parent)?; } if candidates.is_empty() { @@ -290,17 +276,14 @@ pub(crate) mod function { }); if let Some(commit_id) = gave_up_on_commit { - queue.push_front((commit_id, u32::MAX)); + queue.insert(u32::MAX, commit_id); commits_seen -= 1; } commits_seen += finish_depth_computation( queue, - find, + graph, candidates.first_mut().expect("at least one candidate"), - seen, - buf, - parent_buf, first_parent, )?; @@ -313,91 +296,41 @@ pub(crate) mod function { })) } - #[allow(clippy::too_many_arguments)] - fn parents_by_date_onto_queue_and_track_names<Find, E>( - find: &mut Find, - buf: &mut Vec<u8>, - parent_buf: &mut Vec<u8>, - queue: &mut VecDeque<(gix_hash::ObjectId, u32)>, - seen: &mut HashMap<gix_hash::ObjectId, Flags>, - commit: &gix_hash::oid, + fn parents_by_date_onto_queue_and_track_names( + graph: &mut Graph<'_, Flags>, + queue: &mut PriorityQueue<CommitTime, gix_hash::ObjectId>, + commit: gix_hash::ObjectId, commit_flags: Flags, first_parent: bool, - ) -> Result<(), Error<E>> - where - Find: for<'b> FnMut(&oid, &'b mut Vec<u8>) -> Result<Option<CommitRefIter<'b>>, E>, - E: std::error::Error + Send + Sync + 'static, - { - let commit_iter = find(commit, buf) - .map_err(|err| Error::Find { - err: Some(err), - oid: commit.to_owned(), - })? - .ok_or_else(|| Error::Find { - err: None, - oid: commit.to_owned(), - })?; - for token in commit_iter { - match token { - Ok(gix_object::commit::ref_iter::Token::Tree { .. }) => continue, - Ok(gix_object::commit::ref_iter::Token::Parent { id: parent_id }) => match seen.entry(parent_id) { - hash_map::Entry::Vacant(entry) => { - let parent = match find(&parent_id, parent_buf).map_err(|err| Error::Find { - err: Some(err), - oid: commit.to_owned(), - })? { - Some(p) => p, - None => continue, // skip missing objects, they don't exist. - }; - - let parent_commit_date = parent - .committer() - .map(|committer| committer.time.seconds_since_unix_epoch) - .unwrap_or_default(); - - entry.insert(commit_flags); - match queue.binary_search_by(|c| c.1.cmp(&parent_commit_date).reverse()) { - Ok(_) => queue.push_back((parent_id, parent_commit_date)), - Err(pos) => queue.insert(pos, (parent_id, parent_commit_date)), - }; - } - hash_map::Entry::Occupied(mut entry) => { - *entry.get_mut() |= commit_flags; - } + ) -> Result<(), Error> { + graph + .insert_parents( + &commit, + |parent_id, parent_commit_date| { + queue.insert(parent_commit_date as u32, parent_id); + commit_flags }, - Ok(_unused_token) => break, - Err(err) => return Err(err.into()), - } - if first_parent { - break; - } - } - + |_parent_id, flags| *flags |= commit_flags, + first_parent, + ) + .map_err(|err| Error::InsertParentsToGraph { err, oid: commit })?; Ok(()) } - #[allow(clippy::too_many_arguments)] - fn finish_depth_computation<'name, Find, E>( - mut queue: VecDeque<(gix_hash::ObjectId, u32)>, - mut find: Find, - best_candidate: &mut Candidate<'name>, - mut seen: HashMap<gix_hash::ObjectId, Flags>, - mut buf: Vec<u8>, - mut parent_buf: Vec<u8>, + fn finish_depth_computation( + mut queue: PriorityQueue<CommitTime, gix_hash::ObjectId>, + graph: &mut Graph<'_, Flags>, + best_candidate: &mut Candidate<'_>, first_parent: bool, - ) -> Result<u32, Error<E>> - where - Find: for<'b> FnMut(&oid, &'b mut Vec<u8>) -> Result<Option<CommitRefIter<'b>>, E>, - E: std::error::Error + Send + Sync + 'static, - { + ) -> Result<u32, Error> { let mut commits_seen = 0; - while let Some((commit, _commit_time)) = queue.pop_front() { + while let Some(commit) = queue.pop_value() { commits_seen += 1; - let flags = seen[&commit]; + let flags = graph[&commit]; if (flags & best_candidate.identity_bit) == best_candidate.identity_bit { if queue - .iter() - .all(|(id, _)| (seen[id] & best_candidate.identity_bit) == best_candidate.identity_bit) + .iter_unordered() + .all(|id| (graph[id] & best_candidate.identity_bit) == best_candidate.identity_bit) { break; } @@ -405,16 +338,7 @@ pub(crate) mod function { best_candidate.commits_in_its_future += 1; } - parents_by_date_onto_queue_and_track_names( - &mut find, - &mut buf, - &mut parent_buf, - &mut queue, - &mut seen, - &commit, - flags, - first_parent, - )?; + parents_by_date_onto_queue_and_track_names(graph, &mut queue, commit, flags, first_parent)?; } Ok(commits_seen) } @@ -429,3 +353,6 @@ pub(crate) mod function { order: usize, } } + +/// The timestamp for the creation date of a commit in seconds since unix epoch. +type CommitTime = u32; diff --git a/vendor/gix-revision/src/lib.rs b/vendor/gix-revision/src/lib.rs index ef273b5ae..31d22768c 100644 --- a/vendor/gix-revision/src/lib.rs +++ b/vendor/gix-revision/src/lib.rs @@ -14,6 +14,6 @@ pub use describe::function::describe; /// pub mod spec; +pub use spec::types::Spec; -mod types; -pub use types::Spec; +pub use gix_revwalk::{graph, Graph, PriorityQueue}; diff --git a/vendor/gix-revision/src/spec/mod.rs b/vendor/gix-revision/src/spec/mod.rs index c2df7bc1e..616ad3a26 100644 --- a/vendor/gix-revision/src/spec/mod.rs +++ b/vendor/gix-revision/src/spec/mod.rs @@ -53,6 +53,57 @@ mod _impls { } } +pub(crate) mod types { + /// A revision specification without any bindings to a repository, useful for serialization or movement over thread boundaries. + /// + /// Note that all [object ids][gix_hash::ObjectId] should be a committish, but don't have to be. + /// Unless the field name contains `_exclusive`, the respective objects are included in the set. + #[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)] + #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] + pub enum Spec { + /// Include commits reachable from this revision, i.e. `a` and its ancestors. + /// + /// The equivalent to [crate::spec::Kind::IncludeReachable], but with data. + Include(gix_hash::ObjectId), + /// Exclude commits reachable from this revision, i.e. `a` and its ancestors. Example: `^a`. + /// + /// The equivalent to [crate::spec::Kind::ExcludeReachable], but with data. + Exclude(gix_hash::ObjectId), + /// Every commit that is reachable from `from` to `to`, but not any ancestors of `from`. Example: `from..to`. + /// + /// The equivalent to [crate::spec::Kind::RangeBetween], but with data. + Range { + /// The starting point of the range, which is included in the set. + from: gix_hash::ObjectId, + /// The end point of the range, which is included in the set. + to: gix_hash::ObjectId, + }, + /// Every commit reachable through either `theirs` or `ours`, but no commit that is reachable by both. Example: `theirs...ours`. + /// + /// The equivalent to [crate::spec::Kind::ReachableToMergeBase], but with data. + Merge { + /// Their side of the merge, which is included in the set. + theirs: gix_hash::ObjectId, + /// Our side of the merge, which is included in the set. + ours: gix_hash::ObjectId, + }, + /// Include every commit of all parents of `a`, but not `a` itself. Example: `a^@`. + /// + /// The equivalent to [crate::spec::Kind::IncludeReachableFromParents], but with data. + IncludeOnlyParents( + /// Include only the parents of this object, but not the object itself. + gix_hash::ObjectId, + ), + /// Exclude every commit of all parents of `a`, but not `a` itself. Example: `a^!`. + /// + /// The equivalent to [crate::spec::Kind::ExcludeReachableFromParents], but with data. + ExcludeParents( + /// Exclude the parents of this object, but not the object itself. + gix_hash::ObjectId, + ), + } +} + /// pub mod parse; pub use parse::function::parse; diff --git a/vendor/gix-revision/src/spec/parse/function.rs b/vendor/gix-revision/src/spec/parse/function.rs index 94fb4ee5d..8a89f8f68 100644 --- a/vendor/gix-revision/src/spec/parse/function.rs +++ b/vendor/gix-revision/src/spec/parse/function.rs @@ -213,7 +213,7 @@ fn long_describe_prefix(name: &BStr) -> Option<(&BStr, delegate::PrefixHint<'_>) .and_then(|generation| { iter.next().map(|token| { let last_token_len = token.len(); - let first_token_ptr = iter.last().map(|token| token.as_ptr()).unwrap_or(token.as_ptr()); + let first_token_ptr = iter.last().map_or(token.as_ptr(), |token| token.as_ptr()); // SAFETY: both pointers are definitely part of the same object #[allow(unsafe_code)] let prior_tokens_len: usize = unsafe { token.as_ptr().offset_from(first_token_ptr) } @@ -413,7 +413,7 @@ where input = { if let Some(b'@') = sep { - let past_sep = input[sep_pos.map(|pos| pos + 1).unwrap_or(input.len())..].as_bstr(); + let past_sep = input[sep_pos.map_or(input.len(), |pos| pos + 1)..].as_bstr(); let (nav, rest, _consumed) = parens(past_sep)?.ok_or_else(|| Error::AtNeedsCurlyBrackets { input: input[sep_pos.unwrap_or(input.len())..].into(), })?; diff --git a/vendor/gix-revision/src/types.rs b/vendor/gix-revision/src/types.rs deleted file mode 100644 index 374d43e20..000000000 --- a/vendor/gix-revision/src/types.rs +++ /dev/null @@ -1,48 +0,0 @@ -/// A revision specification without any bindings to a repository, useful for serialization or movement over thread boundaries. -/// -/// Note that all [object ids][gix_hash::ObjectId] should be a committish, but don't have to be. -/// Unless the field name contains `_exclusive`, the respective objects are included in the set. -#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub enum Spec { - /// Include commits reachable from this revision, i.e. `a` and its ancestors. - /// - /// The equivalent to [crate::spec::Kind::IncludeReachable], but with data. - Include(gix_hash::ObjectId), - /// Exclude commits reachable from this revision, i.e. `a` and its ancestors. Example: `^a`. - /// - /// The equivalent to [crate::spec::Kind::ExcludeReachable], but with data. - Exclude(gix_hash::ObjectId), - /// Every commit that is reachable from `from` to `to`, but not any ancestors of `from`. Example: `from..to`. - /// - /// The equivalent to [crate::spec::Kind::RangeBetween], but with data. - Range { - /// The starting point of the range, which is included in the set. - from: gix_hash::ObjectId, - /// The end point of the range, which is included in the set. - to: gix_hash::ObjectId, - }, - /// Every commit reachable through either `theirs` or `ours`, but no commit that is reachable by both. Example: `theirs...ours`. - /// - /// The equivalent to [crate::spec::Kind::ReachableToMergeBase], but with data. - Merge { - /// Their side of the merge, which is included in the set. - theirs: gix_hash::ObjectId, - /// Our side of the merge, which is included in the set. - ours: gix_hash::ObjectId, - }, - /// Include every commit of all parents of `a`, but not `a` itself. Example: `a^@`. - /// - /// The equivalent to [crate::spec::Kind::IncludeReachableFromParents], but with data. - IncludeOnlyParents( - /// Include only the parents of this object, but not the object itself. - gix_hash::ObjectId, - ), - /// Exclude every commit of all parents of `a`, but not `a` itself. Example: `a^!`. - /// - /// The equivalent to [crate::spec::Kind::ExcludeReachableFromParents], but with data. - ExcludeParents( - /// Exclude the parents of this object, but not the object itself. - gix_hash::ObjectId, - ), -} |