revisions_nbr
This commit is contained in:
parent
4134982739
commit
f71e8ff1b3
|
@ -78,4 +78,14 @@ impl GitRepo {
|
|||
return Ok(res);
|
||||
}
|
||||
|
||||
pub fn get_revisions_nbr(&self) -> u32 {
|
||||
let mut res = 0;
|
||||
let mut revwalk = self.git2.revwalk().expect("revisions walk is not defined");
|
||||
revwalk.push_head(); // todo : voir ce qu'il faut réellement pousser si on veux avoir TOUS les commits (genre par exemple si le HEAD n'est pas fils de tous les commits)
|
||||
for _ in revwalk{
|
||||
res = res + 1;
|
||||
}
|
||||
res
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -46,6 +46,10 @@ where for <'a> &'a TS : IntoIterator<Item = &'a Entry>,
|
|||
browse : TS,
|
||||
root : ROOT,
|
||||
user_opt : Option<User>,
|
||||
revisions_nbr : u32,
|
||||
branches_nbr : u32,
|
||||
tags_nbr : u32,
|
||||
size : String,
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,5 +113,16 @@ pub async fn git_main<T : AuthValidator>(
|
|||
}
|
||||
}
|
||||
}
|
||||
Ok(GitMainTemplate { repo, browse : entries, root : path, user_opt : user})
|
||||
Ok(GitMainTemplate {
|
||||
repo,
|
||||
browse : entries,
|
||||
root : path,
|
||||
user_opt : user,
|
||||
revisions_nbr : gitrepo.get_revisions_nbr(),
|
||||
branches_nbr : 7,
|
||||
tags_nbr : 88,
|
||||
size : "16 KiB".to_string(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,16 +26,16 @@
|
|||
|
||||
<div class="w3-panel w3-border w3-cell-row">
|
||||
<div class="w3-center w3-cell">
|
||||
<i class="fa fa-history"></i> 112 revisions
|
||||
<i class="fa fa-history"></i> {{ revisions_nbr }} revisions
|
||||
</div>
|
||||
<div class="w3-center w3-cell">
|
||||
<i class="fa fa-code-branch"></i> 10 branches
|
||||
<i class="fa fa-code-branch"></i> {{ branches_nbr }} branches
|
||||
</div>
|
||||
<div class="w3-center w3-cell">
|
||||
<i class="fa fa-tag"></i> 5 tags
|
||||
<i class="fa fa-tag"></i> {{ tags_nbr }} tags
|
||||
</div>
|
||||
<div class="w3-center w3-cell">
|
||||
<i class="fa fa-database"></i> 10 KiB
|
||||
<i class="fa fa-database"></i> {{ size }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue