@@ -31,7 +31,6 @@ use std::collections::BTreeMap;
31
31
use std:: io:: Write ;
32
32
33
33
use anyhow:: { anyhow, Result } ;
34
- use git2:: { Commit , Oid } ;
35
34
use indexmap:: IndexSet ;
36
35
use termcolor:: WriteColor ;
37
36
@@ -85,9 +84,9 @@ pub(crate) struct StackTransaction<'repo> {
85
84
applied : Vec < PatchName > ,
86
85
unapplied : Vec < PatchName > ,
87
86
hidden : Vec < PatchName > ,
88
- updated_head : Option < Commit < ' repo > > ,
89
- updated_base : Option < Commit < ' repo > > ,
90
- current_tree_id : Oid ,
87
+ updated_head : Option < git2 :: Commit < ' repo > > ,
88
+ updated_base : Option < git2 :: Commit < ' repo > > ,
89
+ current_tree_id : git2 :: Oid ,
91
90
error : Option < anyhow:: Error > ,
92
91
printed_top : bool ,
93
92
}
@@ -419,7 +418,7 @@ impl<'repo> ExecuteContext<'repo> {
419
418
}
420
419
421
420
impl < ' repo > StackTransaction < ' repo > {
422
- fn checkout ( & mut self , commit : & Commit < ' _ > ) -> Result < ( ) > {
421
+ fn checkout ( & mut self , commit : & git2 :: Commit < ' _ > ) -> Result < ( ) > {
423
422
let repo = self . stack . repo ;
424
423
if !self . options . allow_bad_head {
425
424
self . stack . check_head_top_mismatch ( ) ?;
@@ -571,7 +570,11 @@ impl<'repo> StackTransaction<'repo> {
571
570
///
572
571
/// Any notes associated with the patch's previous commit are copied to the new
573
572
/// commit.
574
- pub ( crate ) fn update_patch ( & mut self , patchname : & PatchName , commit_id : Oid ) -> Result < ( ) > {
573
+ pub ( crate ) fn update_patch (
574
+ & mut self ,
575
+ patchname : & PatchName ,
576
+ commit_id : git2:: Oid ,
577
+ ) -> Result < ( ) > {
575
578
let commit = self . stack . repo . find_commit ( commit_id) ?;
576
579
let old_commit = self . get_patch_commit ( patchname) ;
577
580
// Failure to copy is okay. The old commit may not have a note to copy.
@@ -590,7 +593,7 @@ impl<'repo> StackTransaction<'repo> {
590
593
///
591
594
/// The commit for the new patch must be parented by the former top commit of the
592
595
/// stack.
593
- pub ( crate ) fn new_applied ( & mut self , patchname : & PatchName , oid : Oid ) -> Result < ( ) > {
596
+ pub ( crate ) fn new_applied ( & mut self , patchname : & PatchName , oid : git2 :: Oid ) -> Result < ( ) > {
594
597
let commit = self . stack . repo . find_commit ( oid) ?;
595
598
assert_eq ! ( commit. parent_id( 0 ) . unwrap( ) , self . top( ) . id( ) ) ;
596
599
self . applied . push ( patchname. clone ( ) ) ;
@@ -606,7 +609,7 @@ impl<'repo> StackTransaction<'repo> {
606
609
pub ( crate ) fn new_unapplied (
607
610
& mut self ,
608
611
patchname : & PatchName ,
609
- commit_id : Oid ,
612
+ commit_id : git2 :: Oid ,
610
613
insert_pos : usize ,
611
614
) -> Result < ( ) > {
612
615
let commit = self . stack . repo . find_commit ( commit_id) ?;
@@ -1470,23 +1473,23 @@ impl<'repo> StackStateAccess<'repo> for StackTransaction<'repo> {
1470
1473
}
1471
1474
}
1472
1475
1473
- fn top ( & self ) -> & Commit < ' repo > {
1476
+ fn top ( & self ) -> & git2 :: Commit < ' repo > {
1474
1477
if let Some ( patchname) = self . applied . last ( ) {
1475
1478
self . get_patch_commit ( patchname)
1476
1479
} else {
1477
1480
self . base ( )
1478
1481
}
1479
1482
}
1480
1483
1481
- fn head ( & self ) -> & Commit < ' repo > {
1484
+ fn head ( & self ) -> & git2 :: Commit < ' repo > {
1482
1485
if let Some ( commit) = self . updated_head . as_ref ( ) {
1483
1486
commit
1484
1487
} else {
1485
1488
self . top ( )
1486
1489
}
1487
1490
}
1488
1491
1489
- fn base ( & self ) -> & Commit < ' repo > {
1492
+ fn base ( & self ) -> & git2 :: Commit < ' repo > {
1490
1493
if let Some ( commit) = self . updated_base . as_ref ( ) {
1491
1494
commit
1492
1495
} else {
0 commit comments