如何在从 Firefox 扩展执行 HG 命令之前更改目录?
我正在尝试对特定文件执行 hgtk log 命令。但只有进入存储库目录后才能执行此操作。
像这样的东西...
process.initwithpath("cmd.exe");
args = ["CD","c:\\MY_REPO"];
process.run(true,args,args.length);
process.initwithpath("hg.exe");
args= ["hgtk","my_file.txt"];
process.run(true,args,args.length);
但问题是第二个过程不会跟踪第一个过程...
任何建议将受到高度赞赏...
I am trying to execute hgtk log command for a particular file. But you cannot do it until you are in the repository directory.
something like this...
process.initwithpath("cmd.exe");
args = ["CD","c:\\MY_REPO"];
process.run(true,args,args.length);
process.initwithpath("hg.exe");
args= ["hgtk","my_file.txt"];
process.run(true,args,args.length);
But the problem is second process will not keep track of first one....
Any suggestions will be highly appreciated....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅
--repository
命令行选项(缩写为-R
)。它会在执行 log、annotate 等之前更改hgtk
的当前工作目录。如果您在命令行上提供文件名,那么您应该注意它们是相对于的参数来理解的-R
。所以这是有效的:因为
README
文件是相对于~/src/mercurial
找到的。这也有效,因为我们提供了 README 文件的完整路径。从这个意义上说,它的工作方式类似于 Mercurial 的
--cwd
选项。 Mercurial 还有一个-R
选项,但这不会更改当前工作目录。See the
--repository
command line option (short from is-R
). It will change the current working directory ofhgtk
before executing log, annotate, etc. If you provide a filename on the command line, then you should beware that they are understood relative to the argument of-R
. So this works:because the
README
file is found relative to~/src/mercurial
. This also workssince we give the full path to the
README
file. In this sense it works like Mercurial's--cwd
option. Mercurial also has a-R
option, but this does not change the current working directory.