Mercurial:如何还原为特定版本? [英] Mercurial: how do I revert to a particular revision?

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

问题描述

我正在使用实时服务器.我已经更新了提示,它引起了问题:我需要恢复到可以正常进行的特定变更集(388).

I'm working on a live server. I've updated to tip and it's caused problems: I need to revert back to a particular changeset (388) where things were OK.

我在服务器上没有任何值的更改,本地更改集根本没有关系.实际上,我实际上是想杀死任何本地的意外更改或合并,以免造成混淆.

I have no changes of any value on the server, the local changeset does not matter at all. In fact I actually want to kill any local accidental changes or merges so as not to confuse things.

如何还原到特定变更集并杀死任何本地变更?与以下内容有关:

How do I revert to a particular changeset and kill any local changes? Is it something to do with:

hg revert 

----更新---

---- UPDATE ---

为了明确起见,我想做的是首先将本地所有内容还原到变更集388,然后确保我的本地存储库处于我执行该操作时的状态

To clarify, what I would like to do is first revert everything locally to changeset 388, and then ensure that my local repo is in such a state that when I do

hg status

我没有输出.否则,我会有一种讨厌的感觉,那就是当我下次拔尖头时,会有冲突要处理-我想避免,因为局部更改没有任何价值.

I get no output. Otherwise I have a nasty feeling that when I next pull the tip, there will be conflicts to deal with - which I want to avoid, because the local changes are of no value.

----更新---

---- UPDATE ---

对于这种情况下的其他人,最终为我解决的问题是:

For anyone else in this situation, what eventually fixed it for me was:

rm -rf <repo_dir>
hg clone http://repository
hg update -r 388

那将杀死您的所有本地更改,因此请谨慎操作(但这是我在这种情况下想要的).

That will kill all your local changes, so proceed with caution (but that's what I wanted in this case).

推荐答案

server:
- ..
- rev 386
- rev 387
- rev 388
- rev 389

clone to production

-- testing stuff, it doesn't work!
-- panic!
-- rev 390 (in panic)
-- rev 391 (in panic)
-- cool down, thinking, need to go back to 388
-- one way: hg update -C -rev 388 (to keep 390, 391)
-- other way: rm -rf dir (to discard 390, 391)
-- hg clone http://server/hg
-- cd dir
-- hg update 388 
-- testing, now works

还有一个很棒的清除扩展名.非常可靠的东西,它会从工作目录中删除所有未跟踪的文件.

There is also a wonderful Purge extension. Very solid stuff, it deletes all untracked files from working directory.

这篇关于Mercurial:如何还原为特定版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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