質問

Node.js用に書かれたライブラリを探しています。これは、WebアプリケーションからMercurial HGで作成されたローカルリポジトリを管理するために使用できます。

誰かがそのようなものを実装しましたか?

役に立ちましたか?

解決

私はそのようなライブラリを聞いたことがありません - それは発表されていません メーリングリスト. 。 Mercurialの安定したAPIはです コマンドライン, 、だから私はただ発売することをお勧めします hg 出力の直接的かつ解析します。スクリーンスクレープが簡単になるように設計されており、使用してさらにカスタマイズできます テンプレート.

他のヒント

NPMで利用可能なモジュールを作成しました node-hg まさにこの理由で。

それは周りのラッパーです コマンドサーバー その問題は介してコマンドを行います stdin およびパージング出力 stdout.

これがそれがどのように機能するかの例です:

var path = require("path");

var hg = require("hg");

// Clone into "../example-node-hg"
var destPath = path.resolve(path.join(process.cwd(), "..", "my-node-hg"));

hg.clone("http://bitbucket.org/jgable/node-hg", destPath, function(err, output) {
    if(err) {
        throw err;
    }

    output.forEach(function(line) {
        console.log(line.body);
    });

    // Add some files to the repo with fs.writeFile, omitted for brevity

    hg.add(destPath, ["someFile1.txt", "someFile2.txt"], function(err, output) {
        if(err) {
            throw err;
        }

        output.forEach(function(line) {
            console.log(line.body);
        });

        var commitOpts = {
            "-m": "Doing the needful"
        };

        // Commit our new files
        hg.commit(destPath, commitOpts, function(err, output) {
            if(err) {
                throw err;
            }

            output.forEach(function(line) {
                console.log(line.body);
            });
        });
    });
});
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top