0

ユーザーのリポジトリのクローンを作成し、そこにいくつかのファイルを追加して、リモート リポジトリにプッシュできるサンプル アプリケーションを作成したいと考えています。Mercurial.NET C# API を使用して、このアプリケーションを作成しました。

       string repoUrl = "https://bitbucket.org/USERNAME/REPONAME";

        var repoPath = @"THE LOCAL PATH";
        if (Directory.Exists(repoPath))
            Directory.Delete(repoPath, true);
        Directory.CreateDirectory(repoPath);
        var repo = new Mercurial.Repository(repoPath);

        repo.Clone(repoUrl, new CloneCommand().WithObserver(new DebugObserver()).WithUpdate(false));

        Random rand = new Random();

        string filename = "data" + rand.Next(0, 1000).ToString() + ".txt";

        using (StreamWriter _testData = new StreamWriter(@"E:\Lombiq\TestRepos\testrepo3\" + filename))
        {
            _testData.WriteLine("some text"); // Write the file.
        }
        repo.AddRemove(new AddRemoveCommand()
.WithIncludePattern("data*.txt"));

        repo.Commit("test commit");

        repo.Push(repoUrl); //How to add credentials?

CSharp.Bitbucket ( https://github.com/scottksmith95/CSharp.Bitbucket ) を使用してユーザーの認証に成功したので、トークン値とトークン シークレットを取得しました。

これらの値を使用して、ローカル リポジトリのコンテンツを新しいファイルを含むリモート リポジトリにプッシュ バックするにはどうすればよいですか? また、トークン値とトークン シークレットを使用してこの操作を実行するにはどうすればよいですか?

どうもありがとうございました!

4

0 に答える 0