Mercurial HG library for Node.js用于本地存储库
我正在寻找为Node.js编写的库 我将能够使用它从web应用程序进行管理 我在Mercurial HG中创建的本地存储库Mercurial HG library for Node.js用于本地存储库,node.js,mercurial,npm,Node.js,Mercurial,Npm,我正在寻找为Node.js编写的库 我将能够使用它从web应用程序进行管理 我在Mercurial HG中创建的本地存储库 有人实现了这样的功能吗?我从来没有听说过这样的库——它还没有在上一次发布过。Mercurial的稳定API是,所以我建议直接启动hg并解析输出。它的设计很容易进行屏幕刮取,您可以通过使用进一步自定义它。正是出于这个原因,我在npm上创建了一个可用的模块 它是一个围绕的包装器,通过stdin发出命令,并在stdout上解析输出 下面是一个如何工作的示例: var path =
有人实现了这样的功能吗?我从来没有听说过这样的库——它还没有在上一次发布过。Mercurial的稳定API是,所以我建议直接启动
hg
并解析输出。它的设计很容易进行屏幕刮取,您可以通过使用进一步自定义它。正是出于这个原因,我在npm上创建了一个可用的模块
它是一个围绕的包装器,通过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);
});
});
});
});
如果它没有打开,或者它可能不存在(公开),如果您使用command server,您可以避免hg启动开销,但是这需要更多的努力。我考虑过,但作为最终解决方案。谢谢你的回答。如果你觉得答案有帮助(虽然是否定的),那么请记得投票并接受它。