我正在寻找为node.js编写的库,我将能够从我的本地存储库中使用Mercurial HG创建的Web应用程序来管理。

有人实施了这样的事情吗?

有帮助吗?

解决方案

我从未听说过这样的图书馆 - 尚未宣布 我们的邮件列表. 。 Mercurial的稳定API是 命令行, ,所以我建议刚启动 hg 直接并解析输出。它旨在易于屏幕上的丝绸,您可以通过使用 模板.

其他提示

我在NPM上创建了一个可用的模块 节点-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