src/RocketFilterApp.cs
/// <summary>
/// This method Validates the parameters.
/// </summary>
/// <exception cref="GitRocketFilter.RocketException">
/// No valid git repository path found at [{0}]
/// or
/// Branch name is required and cannot be null
/// or
/// The branch [{0}] already exist. Cannot overwrite without force option
/// or
/// Invalid revspec [{0}]. Reason: {1}
/// </exception>
This method Validates the parameters.
This method Validates the parameters .
private void ValidateParameters()
        {
            if (!Repository.IsValid(RepositoryPath))
            {
                throw new RocketException("No valid git repository path found at [{0}]", RepositoryPath);
            }
            repo = new Repository(RepositoryPath);
            if (string.IsNullOrWhiteSpace(BranchName))
            {
                throw new RocketException("Branch name is required and cannot be null");
            }
            branchRef = "refs/heads/" + BranchName;
            if (repo.Refs[branchRef] != null && !BranchOverwrite)
            {
                throw new RocketException("The branch [{0}] already exist. Cannot overwrite without force option", BranchName);
            }
            if (!string.IsNullOrWhiteSpace(RevisionRange))
            {
                string errorMessage = null;
                try
                {
                    revisionSpec = RevSpec.Parse(repo, RevisionRange);
                    if (revisionSpec.Type == RevSpecType.MergeBase)
                    {
                        errorMessage = "Merge base revspec are not supported";
                    }
                }
                catch (LibGit2SharpException libGitException)
                {
                    errorMessage = libGitException.Message;
                }
                if (errorMessage != null)
                {
                    throw new RocketException("Invalid revspec [{0}]. Reason: {1}", RevisionRange, errorMessage);
                }
            }
        }
private void ValidateParameters ( ) { if ( ! Repository . IsValid ( RepositoryPath ) ) { throw new RocketException ( " " , RepositoryPath ) ; } repo = new Repository ( RepositoryPath ) ; if ( string . IsNullOrWhiteSpace ( BranchName ) ) { throw new RocketException ( " " ) ; } branchRef = " " + BranchName ; if ( repo . Refs [ branchRef ] != null && ! BranchOverwrite ) { throw new RocketException ( " " , BranchName ) ; } if ( ! string . IsNullOrWhiteSpace ( RevisionRange ) ) { string errorMessage = null ; try { revisionSpec = RevSpec . Parse ( repo , RevisionRange ) ; if ( revisionSpec . Type == RevSpecType . MergeBase ) { errorMessage = " " ; } } catch ( LibGit2SharpException libGitException ) { errorMessage = libGitException . Message ; } if ( errorMessage != null ) { throw new RocketException ( " " , RevisionRange , errorMessage ) ; } } }
This method Validates the parameters.
This method Validates the parameters .
// Validate the revision range
No valid git repository path found at [{0}]
or
Branch name is required and cannot be null
or
The branch [{0}] already exist. Cannot overwrite without force option
or
Invalid revspec [{0}].
No valid git repository path found at [ { 0 } ] or Branch name is required and cannot be null or The branch [ { 0 } ] already exist . Cannot overwrite without force option or Invalid revspec [ { 0 } ] .