(&self, git_chain: &GitChain, dry_run: bool)
| 335 | } |
| 336 | |
| 337 | pub fn prune(&self, git_chain: &GitChain, dry_run: bool) -> Result<Vec<String>, Error> { |
| 338 | let mut pruned_branches = vec![]; |
| 339 | for branch in self.branches.clone() { |
| 340 | // branch is an ancestor of the root branch if: |
| 341 | // - it is the root branch, or |
| 342 | // - the branch is a commit that occurs before the root branch. |
| 343 | if git_chain.is_ancestor(&branch.branch_name, &self.root_branch)? { |
| 344 | let branch_name = branch.branch_name.clone(); |
| 345 | |
| 346 | if !dry_run { |
| 347 | branch.remove_from_chain(git_chain)?; |
| 348 | } |
| 349 | |
| 350 | pruned_branches.push(branch_name); |
| 351 | } |
| 352 | } |
| 353 | Ok(pruned_branches) |
| 354 | } |
| 355 | |
| 356 | pub fn rename(self, git_chain: &GitChain, new_chain_name: &str) -> Result<(), Error> { |
| 357 | // invariant: new_chain_name chain does not exist |
no test coverage detected