- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我试图让 mercurial 在我的 C# wpf 应用程序的 shell 中运行。我的目的是将输出检索到一个字符串中,以便我可以对其进行解析。
对我来说不幸的是,hg.exe(来自 tortoiseHg)似乎没有通过下面的代码返回任何内容。其他 .exe 似乎可以工作,如下面的评论所示;
我的代码在下面;
`
string workingDir = "";
string filename = "";
string param = "";
//This works
workingDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
filename = "unrar.exe";
param = "";
//this works
workingDir = "c:\\program files\\WinRar";
filename = "unrar.exe";
param = "";
//this works
workingDir = "C:\\Program Files (x86)\\TortoiseHg";
filename = "docdiff.exe";
param = "";
//this does not work. I get a null returned. Why?
workingDir = "C:\\Program Files (x86)\\TortoiseHg";
filename = "hg.exe";
param = "";
//this does not work. I get a null returned. Why?
workingDir = "C:\\Program Files (x86)\\TortoiseHg";
filename = "hg.exe";
param = "help";
string retVal = "";
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.WorkingDirectory = workingDir;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.FileName = filename;
proc.StartInfo.Arguments = param;
proc.Start();
System.IO.StreamReader reader = proc.StandardOutput;
retVal = reader.ReadToEnd();
System.Windows.MessageBox.Show(retVal);`
如果有人可以建议为什么这段代码不起作用,或者另一种检索 mercurial 命令行输出的方法,我将不胜感激。
谢谢
最佳答案
你的代码对我有用(使用 TortoiseHg 2.0.2 测试),前提是我将完整路径传递给可执行文件:
proc.StartInfo.FileName = "C:\\Program Files (x86)\\TortoiseHg\\hg.exe";
关于c# - 为什么此 C# 代码不起作用?我正在尝试将 shell 的输出读取到 TortoiseHG (Mercurial),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4139040/
使用 TortoiseHG 超过 3 年,我以前从未在控制台中看到过这种情况,但在过去的几天里,我在更新或推送时多次看到这种相同的模式输出到控制台(不确定是哪个) .有谁知道这是怎么回事? 最佳答案
我使用的是 TortoiseHG 2.5.1 版 我是一个开源项目的一部分,在该项目中我们使用不同的分支(主要是当前的 ABI、API 和默认分支),这些分支通常需要合并。在这些情况下,我使用 Tor
有时,我会向存储库提交一些代码,添加注释/摘要,然后读回摘要并意识到我犯了一个错误,或者应该包含更多信息。在 TortoiseHg 中提交后可以编辑摘要吗?我使用的是1.1版本 最佳答案 使用 Mer
我只是安装了 TortoiseHg,作为 Mercurial 客户端工具。 但是,在我的 Vista 中,每当我启动时,我的通知栏上都会出现一个 TortoiseHg Overlay Icon Ser
我想在使用 TortoiseHg 更新存储库时合并两个 MS Excel .xls 文件,但出现以下错误: tool tortoisemerge can't handle binary tool kd
我找不到任何文档 - 有可能吗? 最佳答案 您在 TortoiseHg 配置对话框 ( thg userconfig ) 中找到的字段的帮助是: 发出正则表达式字段: Defines the rege
在 TortoiseHG 2.2 Workbench 中,我可以右键单击“存储库注册表” Pane 中的“默认”存储库,然后单击“新建组”命令。 这个新组命令有什么作用? 看起来它只是一种将您的存储库
我想知道 TortoiseHG 修订图中的小星星是什么意思?我查看了文档,但找不到它的 key 。 最佳答案 我不知道它是否在文档中,但您已经在评论中回答了您的问题: 当您拉取或提交然后刷新 Repo
我试图从书架中删除单个文件,结果发现删除按钮会删除书架中的所有文件。除了进入 .hg/Trashcan 并尝试记住哪些文件被删除之外,还有其他方法可以恢复这些文件吗? 最佳答案 正如您所提到的,执行此
当我想从未提交的更改创建补丁时,我真的必须首先提交吗? TortoiseHg 是否不允许在不执行提交的情况下创建补丁? 最佳答案 TortoiseHg 2.0.2:在工作台中,您可以右键单击工作目录行
我最后一次重新设置分支的操作完全搞砸了。我看到输出消息说“saved backup bundle to xxx.hg”。有没有办法从那个包中恢复整个存储库?谢谢。 最佳答案 您可以使用 hg pu
我检查了我的 TortoiseHG 设置,它被设置为显示显示文件状态的文件夹图标,但我没有看到它们。我正在运行 Windows 7,有人知道可能是什么问题吗? 最佳答案 安装 TortoiseHg 后
有没有人有与 TortoiseHg 的 Repository Explorer 中使用的图标相对应的状态列表? 最佳答案 TortoiseHg 使用与 TortoiseSVN 相同的 Tortoise
我对 TortoiseHg 的几乎所有操作都遇到以下错误 - 提交、推送、更新。很多人似乎得到了代码 255,但我在代码 0(或者代码 -1)上没有发现太多内容。有人知道解决办法吗?命令行工作正常,S
如果 TortoiseHg 不再有反应,我该怎么办? 我试图还原更改的文件 => 没有任何 react ,应用程序卡住,没有消息 我打开搁置并尝试将更改的文件放入新的搁架/垃圾桶 创建一个新的书架有效
我有一个关于 TortoiseHg 的问题。 我的组织正在从 SVN 过渡到 Mercurial。绝大多数用户使用 Tortoise 来管理他们的存储库而不是命令行。在 TortoiseSVN 中,我
我一直在一个分支上工作并做出了一些提交。现在有什么方法可以在 TortoiseHg 中查看这些提交是否已推送或者它们仍然只是本地的? 最佳答案 您可以使用 hg Outgoing 查看推送后将发送的内
这些线条和更改点颜色的逻辑是什么? TortoiseHg 是否会自动为每个命名分支分配颜色?在同一个命名分支中,线条的颜色与变更集点的颜色不同(例如紫色点和蓝色线),为什么? 最佳答案 我发现为什么点
我最近在 Linux 系统(Ubuntu 10.4 服务器)上使用了带有 Mercurial 的 Perfarce 扩展,并对其代码进行了一些修改以满足我的需求。 现在,我想在 Windows 7x6
是否可以将 THG 安装在共享驱动器上并让用户从那里运行它,而不必在每个本地安装它用户的机器? 我愿意接受一些轻微的功能损失,例如没有在资源管理器中覆盖图标或菜单。也许人们只能用工作台界面... 如果
我是一名优秀的程序员,十分优秀!