public void HandleDeleteBranchResult(DeleteBranchParameters parameters, GitOutput output) { Assert.IsNotNull(parameters); Assert.IsNotNull(output); if(output.ExitCode != 0) { if(IsBranchNotFoundError(output.Error, parameters.Remote, parameters.BranchName)) { throw new BranchNotFoundException(parameters.BranchName); } if(!parameters.Force) { if(IsBranchNotFullyMergedError(output.Error, parameters.BranchName)) { throw new BranchIsNotFullyMergedException(parameters.BranchName); } } output.Throw(); } }
public Command GetDeleteBranchCommand(DeleteBranchParameters parameters) { Assert.IsNotNull(parameters); if(parameters.Remote) { return new BranchCommand( parameters.Force ? BranchCommand.DeleteForce() : BranchCommand.Delete(), BranchCommand.Remote(), new CommandParameter(parameters.BranchName)); } else { return new BranchCommand( parameters.Force ? BranchCommand.DeleteForce() : BranchCommand.Delete(), new CommandParameter(parameters.BranchName)); } }