Mercurial:还原单个大块 [英] Mercurial: Revert a single hunk

查看:82
本文介绍了Mercurial:还原单个大块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何在Mercurial中还原单个大块,类似于在darcs中完成的方式,即它询问我每个大块并归档我是否要还原它?可以使用TortoiseHg吗?

How do I revert a single hunk in Mercurial, similar to the way it's done in darcs, i.e. it asks me for each hunk and file whether I want to revert it? Is it possible using TortoiseHg?

谢谢

推荐答案

record扩展darcs record启发.它将允许您仅将特定的块添加到下一次提交,即与您想要的相反.但是您可以添加除要还原的块以外的所有块,然后执行hg revert来还原它.有点倒退,我知道...:-)

The record extension is inspired by darcs record. It will allow you to add only specific hunks to the next commit, i.e., the opposite of what you want. But you could add all hunks except the one you want to revert and then do a hg revert to revert it. A little backwards, I know... :-)

您也可以执行hg diff > patch; hg revert,编辑patch删除块,然后执行hg import --no-commit重新应用补丁.这可能会更快,但是需要您手动编辑补丁.我在Emacs diff-mode上取得了巨大的成功,但是由于您询问了TortoiseHg,您可能不想使用Emacs.

You could also do hg diff > patch; hg revert, edit patch to delete the hunk and do hg import --no-commit to reappy the patch. That is likely faster, but requires you to manually edit the patch. I've had great success with the Emacs diff-mode, but since you ask about TortoiseHg you might not want to use Emacs.

这篇关于Mercurial:还原单个大块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆