如何放弃汞合并? [英] How to abandon a hg merge?

查看:89
本文介绍了如何放弃汞合并?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是与Mercurial合作的新手.我的情况:

I'm new to collaborating with Mercurial. My situation:

  • 另一位程序员更改了文件的修订版1,以将2位缩进替换为4位缩进. (即,更改每行.)调用那个版本2,将其推送到远程仓库中.
  • 我已经对本地工作区中的各种代码进行了实质性的修订,修订版1.叫那个版本3.
  • hg pull ed和hg merge d不清楚发生的事情.
  • 冲突是无数的,不是真正的冲突.
  • Another programmer changed rev 1 of a file to replace 4-space indents with 2-space indent. (I.e. changed every line.) Call that rev 2, pushed to the remote repo.
  • I've committed substantive changes rev 1 with various code changes in my local workspace. Call that rev 3.
  • I've hg pulled and hg merged without a clear idea of what was going on.
  • The conflicts are myriad and not really substantive.

因此,我真的希望在合并之前将本地存储库更改为2空间缩进.那么合并将是微不足道的(我想).但我似乎无法备份.我想我需要hg update -r 3,但是它说abort: outstanding uncommitted merges.

So I really wish I'd changed my local repo to 2-space indents before merging; then the merge will be trivial (i'm supposing). But I can't seem to back up. I think I need to hg update -r 3 but it says abort: outstanding uncommitted merges.

如何撤消合并,更改本地仓库中的间距并重新合并?

How can I undo the merge, changes spacing in my local repo, and remerge?

推荐答案

您可以使用-C(或--clean)标志放弃未提交的更改:

You can discard uncommitted changes with the -C (or --clean) flag:

hg update -C -r 3

当心:所有未提交的东西都将消失!

BEWARE: Everything that was not committed will be gone!

在那之后,您可能应该使用某种代码格式化工具来执行整个操作,或者至少使用某种查找和替换正则表达式.只需将匹配^____的内容(使用4个空格而不是下划线)替换为__(2个空格),再重复几次(除非您疯狂地拥有一些嵌套代码)就可以了.

After that you should probably use some kind of code formatter tool to do the entire operation, or at least some find and replace with regular expressions. Something as simple as replacing what matches ^____ (use 4 spaces instead of underscores) with __ (2 spaces), repeated a few times (unless you have insanely some nested code) should work.

这篇关于如何放弃汞合并?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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