Sep.Git.Tfs.Commands.Init.Run C# (CSharp) Method

Run() public method

public Run ( string tfsUrl, string tfsRepositoryPath ) : int
tfsUrl string
tfsRepositoryPath string
return int
        public int Run(string tfsUrl, string tfsRepositoryPath)
        {
            tfsRepositoryPath.AssertValidTfsPathOrRoot();
            DoGitInitDb();
            CommitTheGitIgnoreFile(_initOptions.GitIgnorePath);
            GitTfsInit(tfsUrl, tfsRepositoryPath);
            return 0;
        }

Same methods

Init::Run ( string tfsUrl, string tfsRepositoryPath, string gitRepositoryPath ) : int

Usage Example

Esempio n. 1
0
        public int Run(string tfsUrl, string tfsRepositoryPath, string gitRepositoryPath)
        {
            var currentDir           = Environment.CurrentDirectory;
            var repositoryDirCreated = InitGitDir(gitRepositoryPath);

            // TFS string representations of repository paths do not end in trailing slashes
            tfsRepositoryPath = (tfsRepositoryPath ?? string.Empty).TrimEnd('/');

            try
            {
                var retVal = init.Run(tfsUrl, tfsRepositoryPath, gitRepositoryPath);

                VerifyTfsPathToClone(tfsRepositoryPath);

                if (retVal == 0)
                {
                    retVal = fetch.Run();
                }
                if (retVal == 0)
                {
                    globals.Repository.CommandNoisy("merge", globals.Repository.ReadTfsRemote(globals.RemoteId).RemoteRef);
                }
                if (retVal == 0 && withBranches && initBranch != null)
                {
                    initBranch.CloneAllBranches = true;
                    retVal = initBranch.Run();
                }
                return(retVal);
            }
            catch
            {
                try
                {
                    // if we appeared to be inside repository dir when exception was thrown - we won't be able to delete it
                    Environment.CurrentDirectory = currentDir;
                    if (repositoryDirCreated)
                    {
                        Directory.Delete(gitRepositoryPath, recursive: true);
                    }
                    else
                    {
                        CleanDirectory(gitRepositoryPath);
                    }
                }
                catch (IOException e)
                {
                    // swallow IOException. Smth went wrong before this and we're much more interested in that error
                    string msg = String.Format("Something went wrong, can't cleanup files because of IOException:\n{0}\n", e.IndentExceptionMessage());
                    Trace.WriteLine(msg);
                }
                catch (UnauthorizedAccessException e)
                {
                    // swallow it also
                    string msg = String.Format("Something went wrong, can't cleanup files because of UnauthorizedAccessException:\n{0}\n", e.IndentExceptionMessage());
                    Trace.WriteLine(msg);
                }

                throw;
            }
        }
All Usage Examples Of Sep.Git.Tfs.Commands.Init::Run