Skip to content

Commit 4a80e86

Browse files
committed
adapt to changes in gix-actor
1 parent d288e3a commit 4a80e86

File tree

25 files changed

+56
-35
lines changed

25 files changed

+56
-35
lines changed

Cargo.lock

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cargo-smart-release/src/commit/history.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub struct Segment<'a> {
1010
pub struct Item {
1111
pub id: gix::ObjectId,
1212
pub message: Message,
13-
pub commit_time: gix::actor::Time,
13+
pub commit_time: gix::date::Time,
1414
pub tree_id: gix::ObjectId,
1515
pub parent_tree_id: Option<gix::ObjectId>,
1616
}

cargo-smart-release/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ mod tests {
299299
}
300300
}
301301

302-
pub fn time_to_offset_date_time(time: gix::actor::Time) -> OffsetDateTime {
302+
pub fn time_to_offset_date_time(time: gix::date::Time) -> OffsetDateTime {
303303
time::OffsetDateTime::from_unix_timestamp(time.seconds as i64)
304304
.expect("always valid unix time")
305305
.replace_offset(time::UtcOffset::from_whole_seconds(time.offset).expect("valid offset"))

gix-mailmap/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ serde= ["dep:serde", "bstr/serde", "gix-actor/serde"]
1717

1818
[dependencies]
1919
gix-actor = { version = "^0.21.0", path = "../gix-actor" }
20+
gix-date = { version = "^0.5.1", path = "../gix-date" }
2021
bstr = { version = "1.3.0", default-features = false, features = ["std", "unicode"]}
2122
thiserror = "1.0.38"
2223
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}

gix-mailmap/src/snapshot/signature.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub struct Signature<'a> {
1111
/// The possibly mapped email.
1212
pub email: Cow<'a, BStr>,
1313
/// The time stamp at which the signature is performed.
14-
pub time: gix_actor::Time,
14+
pub time: gix_date::Time,
1515
}
1616

1717
impl<'a> From<Signature<'a>> for gix_actor::Signature {

gix-mailmap/tests/snapshot/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ fn signature(name: &str, email: &str) -> gix_actor::Signature {
117117
gix_actor::Signature {
118118
name: name.into(),
119119
email: email.into(),
120-
time: gix_actor::Time {
120+
time: gix_date::Time {
121121
// marker
122122
seconds: 42,
123123
offset: 53,
124-
sign: gix_actor::Sign::Minus,
124+
sign: gix_date::time::Sign::Minus,
125125
},
126126
}
127127
}

gix-object/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ gix-features = { version = "^0.30.0", path = "../gix-features", features = ["rus
2626
gix-hash = { version = "^0.11.2", path = "../gix-hash" }
2727
gix-validate = { version = "^0.7.5", path = "../gix-validate" }
2828
gix-actor = { version = "^0.21.0", path = "../gix-actor" }
29+
gix-date = { version = "^0.5.1", path = "../gix-date" }
2930

3031
btoi = "0.4.2"
3132
itoa = "1.0.1"

gix-object/src/commit/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<'a> CommitRef<'a> {
6868
}
6969

7070
/// Returns the time at which this commit was created.
71-
pub fn time(&self) -> gix_actor::Time {
71+
pub fn time(&self) -> gix_date::Time {
7272
self.committer.time
7373
}
7474
}

gix-object/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ use std::borrow::Cow;
1414
/// For convenience to allow using `bstr` without adding it to own cargo manifest.
1515
pub use bstr;
1616
use bstr::{BStr, BString, ByteSlice};
17+
/// For convenience to allow using `gix-date` without adding it to own cargo manifest.
18+
pub use gix_date as date;
1719
use smallvec::SmallVec;
1820

1921
///

gix-object/tests/commit/from_bytes.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
use gix_actor::{Sign, SignatureRef, Time};
1+
use gix_actor::SignatureRef;
2+
use gix_date::time::Sign;
3+
use gix_date::Time;
24
use gix_object::{bstr::ByteSlice, commit::message::body::TrailerRef, CommitRef};
35
use smallvec::SmallVec;
46

gix-object/tests/commit/message.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,9 @@ mod body {
223223
mod summary {
224224
use std::borrow::Cow;
225225

226-
use gix_actor::{Sign, SignatureRef, Time};
226+
use gix_actor::SignatureRef;
227+
use gix_date::time::Sign;
228+
use gix_date::Time;
227229
use gix_object::{
228230
bstr::{BStr, ByteSlice},
229231
commit::MessageRef,

gix-object/tests/object.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ fn hex_to_id(hex: &str) -> ObjectId {
6161
ObjectId::from_hex(hex.as_bytes()).expect("40 bytes hex")
6262
}
6363

64-
use gix_actor::{Sign, Time};
64+
use gix_date::{time::Sign, SecondsSinceUnixEpoch, Time};
6565

66-
fn signature(seconds: u32) -> gix_actor::SignatureRef<'static> {
66+
fn signature(seconds: SecondsSinceUnixEpoch) -> gix_actor::SignatureRef<'static> {
6767
use gix_object::bstr::ByteSlice;
6868
gix_actor::SignatureRef {
6969
name: b"Sebastian Thiel".as_bstr(),
@@ -76,13 +76,13 @@ fn signature(seconds: u32) -> gix_actor::SignatureRef<'static> {
7676
}
7777
}
7878

79-
fn linus_signature(time: u32) -> gix_actor::SignatureRef<'static> {
79+
fn linus_signature(seconds: SecondsSinceUnixEpoch) -> gix_actor::SignatureRef<'static> {
8080
use gix_object::bstr::ByteSlice;
8181
gix_actor::SignatureRef {
8282
name: b"Linus Torvalds".as_bstr(),
8383
email: b"torvalds@linux-foundation.org".as_bstr(),
8484
time: Time {
85-
seconds: time,
85+
seconds,
8686
offset: -25200,
8787
sign: Sign::Minus,
8888
},

gix-object/tests/tag/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use gix_date::time::Sign;
12
use gix_object::{bstr::ByteSlice, Kind, TagRef};
23

34
mod method {
@@ -238,10 +239,10 @@ cjHJZXWmV4CcRfmLsXzU8s2cR9A0DBvOxhPD1TlKC2JhBFXigjuL9U4Rbq9tdegB
238239
tagger: Some(gix_actor::SignatureRef {
239240
name: b"Sebastian Thiel".as_bstr(),
240241
email: b"byronimo@gmail.com".as_bstr(),
241-
time: gix_actor::Time {
242+
time: gix_date::Time {
242243
seconds: 1528473343,
243-
offset: offset,
244-
sign: gix_actor::Sign::Plus,
244+
offset,
245+
sign: Sign::Plus,
245246
},
246247
}),
247248
}

gix-odb/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ required-features = []
3030
[dependencies]
3131
gix-features = { version = "^0.30.0", path = "../gix-features", features = ["rustsha1", "walkdir", "zlib", "crc32" ] }
3232
gix-hash = { version = "^0.11.2", path = "../gix-hash" }
33+
gix-date = { version = "^0.5.1", path = "../gix-date" }
3334
gix-path = { version = "^0.8.1", path = "../gix-path" }
3435
gix-quote = { version = "^0.4.4", path = "../gix-quote" }
3536
gix-object = { version = "^0.30.0", path = "../gix-object" }

gix-odb/tests/odb/store/loose.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::sync::atomic::AtomicBool;
22

3-
use gix_actor::{Sign, Time};
3+
use gix_date::{time::Sign, SecondsSinceUnixEpoch, Time};
44
use gix_features::progress;
55
use gix_object::bstr::ByteSlice;
66
use gix_odb::loose::Store;
@@ -425,12 +425,12 @@ cjHJZXWmV4CcRfmLsXzU8s2cR9A0DBvOxhPD1TlKC2JhBFXigjuL9U4Rbq9tdegB
425425
}
426426
}
427427

428-
fn signature(time: u32) -> gix_actor::SignatureRef<'static> {
428+
fn signature(seconds: SecondsSinceUnixEpoch) -> gix_actor::SignatureRef<'static> {
429429
gix_actor::SignatureRef {
430430
name: b"Sebastian Thiel".as_bstr(),
431431
email: b"byronimo@gmail.com".as_bstr(),
432432
time: Time {
433-
seconds: time,
433+
seconds,
434434
offset: 7200,
435435
sign: Sign::Plus,
436436
},

gix-ref/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ gix-features = { version = "^0.30.0", path = "../gix-features", features = ["wal
2323
gix-fs = { version = "^0.2.0", path = "../gix-fs" }
2424
gix-path = { version = "^0.8.1", path = "../gix-path" }
2525
gix-hash = { version = "^0.11.2", path = "../gix-hash" }
26+
gix-date = { version = "^0.5.1", path = "../gix-date" }
2627
gix-object = { version = "^0.30.0", path = "../gix-object" }
2728
gix-validate = { version = "^0.7.5", path = "../gix-validate" }
2829
gix-actor = { version = "^0.21.0", path = "../gix-actor" }

gix-ref/src/store/file/log/line.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ pub mod decode {
168168

169169
#[cfg(test)]
170170
mod test {
171-
use gix_actor::{Sign, Time};
171+
use gix_date::{time::Sign, Time};
172172
use gix_object::bstr::ByteSlice;
173173

174174
use super::*;

gix-ref/src/store/file/loose/reflog/create_or_update/tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::{convert::TryInto, path::Path};
22

3-
use gix_actor::{Sign, Signature, Time};
3+
use gix_actor::Signature;
4+
use gix_date::{time::Sign, Time};
45
use gix_object::bstr::ByteSlice;
56
use tempfile::TempDir;
67

gix-ref/tests/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ gix-discover = { path = "../../gix-discover" }
3434
gix-worktree = { path = "../../gix-worktree" }
3535
gix-odb = { path = "../../gix-odb" }
3636
gix-actor = { path = "../../gix-actor" }
37+
gix-date = { path = "../../gix-date" }
3738
gix-hash = { path = "../../gix-hash" }
3839
gix-validate = { path = "../../gix-validate" }
3940
gix-lock = { path = "../../gix-lock" }

gix-ref/tests/file/transaction/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pub(crate) mod prepare_and_commit {
22
use std::convert::TryInto;
33

4-
use gix_actor::{Sign, Time};
4+
use gix_date::{time::Sign, Time};
55
use gix_hash::ObjectId;
66
use gix_object::bstr::BString;
77
use gix_ref::{

gix-traverse/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ doctest = false
1616
[dependencies]
1717
gix-hash = { version = "^0.11.2", path = "../gix-hash" }
1818
gix-object = { version = "^0.30.0", path = "../gix-object" }
19+
gix-date = { version = "^0.5.1", path = "../gix-date" }
1920
gix-hashtable = { version = "^0.2.1", path = "../gix-hashtable" }
2021
gix-revwalk = { version = "^0.1.0", path = "../gix-revwalk" }
2122
gix-commitgraph = { version = "^0.16.0", path = "../gix-commitgraph" }

gix-traverse/src/commit.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub enum Sorting {
6464
/// In the *sample history* and a cut-off date of 4, the returned list of commits would be `8, 7, 6, 4`
6565
ByCommitTimeNewestFirstCutoffOlderThan {
6666
/// The amount of seconds since unix epoch, the same value obtained by any `gix_date::Time` structure and the way git counts time.
67-
time_in_seconds_since_epoch: u32,
67+
time_in_seconds_since_epoch: gix_date::SecondsSinceUnixEpoch,
6868
},
6969
}
7070

@@ -87,6 +87,7 @@ pub struct Info {
8787

8888
///
8989
pub mod ancestors {
90+
use gix_date::SecondsSinceUnixEpoch;
9091
use smallvec::SmallVec;
9192
use std::{
9293
borrow::{Borrow, BorrowMut},
@@ -112,13 +113,11 @@ pub mod ancestors {
112113
ObjectDecode(#[from] gix_object::decode::Error),
113114
}
114115

115-
type TimeInSeconds = u32;
116-
117116
/// The state used and potentially shared by multiple graph traversals.
118117
#[derive(Clone)]
119118
pub struct State {
120119
next: VecDeque<ObjectId>,
121-
queue: gix_revwalk::PriorityQueue<TimeInSeconds, ObjectId>,
120+
queue: gix_revwalk::PriorityQueue<SecondsSinceUnixEpoch, ObjectId>,
122121
buf: Vec<u8>,
123122
seen: HashSet<ObjectId>,
124123
parents_buf: Vec<u8>,
@@ -326,7 +325,7 @@ pub mod ancestors {
326325

327326
impl Sorting {
328327
/// If not topo sort, provide the cutoff date if present.
329-
fn cutoff_time(&self) -> Option<u32> {
328+
fn cutoff_time(&self) -> Option<gix_date::SecondsSinceUnixEpoch> {
330329
match self {
331330
Sorting::ByCommitTimeNewestFirstCutoffOlderThan {
332331
time_in_seconds_since_epoch,
@@ -344,7 +343,10 @@ pub mod ancestors {
344343
StateMut: BorrowMut<State>,
345344
E: std::error::Error + Send + Sync + 'static,
346345
{
347-
fn next_by_commit_date(&mut self, cutoff_older_than: Option<TimeInSeconds>) -> Option<Result<Info, Error>> {
346+
fn next_by_commit_date(
347+
&mut self,
348+
cutoff_older_than: Option<SecondsSinceUnixEpoch>,
349+
) -> Option<Result<Info, Error>> {
348350
let state = self.state.borrow_mut();
349351

350352
let (commit_time, oid) = state.queue.pop()?;
@@ -356,14 +358,13 @@ pub mod ancestors {
356358
self.cache = None;
357359
return self.next_by_commit_date(cutoff_older_than);
358360
}
359-
for (id, commit_time) in state.parent_ids.drain(..) {
361+
for (id, parent_commit_time) in state.parent_ids.drain(..) {
360362
parents.push(id);
361363
let was_inserted = state.seen.insert(id);
362364
if !(was_inserted && (self.predicate)(&id)) {
363365
continue;
364366
}
365367

366-
let parent_commit_time = commit_time as u32; // TODO: fix this once we have 64 bit date support
367368
match cutoff_older_than {
368369
Some(cutoff_older_than) if parent_commit_time < cutoff_older_than => continue,
369370
Some(_) | None => state.queue.insert(parent_commit_time, id),

gix/src/object/commit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl<'repo> Commit<'repo> {
6565
/// Decode the commit and obtain the time at which the commit was created.
6666
///
6767
/// For the time at which it was authored, refer to `.decode()?.author.time`.
68-
pub fn time(&self) -> Result<gix_actor::Time, Error> {
68+
pub fn time(&self) -> Result<gix_date::Time, Error> {
6969
Ok(self.committer()?.time)
7070
}
7171

gix/src/repository/identity.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ impl crate::Repository {
7373
}
7474

7575
fn extract_time_or_default(
76-
time: Option<&Result<gix_actor::Time, gix_date::parse::Error>>,
76+
time: Option<&Result<gix_date::Time, gix_date::parse::Error>>,
7777
config_key: &'static keys::Time,
78-
) -> Result<gix_actor::Time, config::time::Error> {
78+
) -> Result<gix_date::Time, config::time::Error> {
7979
match time {
8080
Some(Ok(t)) => Ok(*t),
8181
None => Ok(gix_date::Time::now_local_or_utc()),
@@ -88,7 +88,7 @@ pub(crate) struct Entity {
8888
pub name: Option<BString>,
8989
pub email: Option<BString>,
9090
/// A time parsed from an environment variable, handling potential errors is delayed.
91-
pub time: Option<Result<gix_actor::Time, gix_date::parse::Error>>,
91+
pub time: Option<Result<gix_date::Time, gix_date::parse::Error>>,
9292
}
9393

9494
#[derive(Debug, Clone)]

gix/tests/repository/object.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,12 @@ mod commit_as {
214214
let committer = gix::actor::Signature {
215215
name: "c".into(),
216216
email: "c@example.com".into(),
217-
time: gix::actor::Time::new(1, 1800),
217+
time: gix::date::Time::new(1, 1800),
218218
};
219219
let author = gix::actor::Signature {
220220
name: "a".into(),
221221
email: "a@example.com".into(),
222-
time: gix::actor::Time::new(3, 3600),
222+
time: gix::date::Time::new(3, 3600),
223223
};
224224

225225
let commit_id = repo.commit_as(

0 commit comments

Comments
 (0)