简体   繁体   English

更新到旧版本时Subversion中的冲突。 问题似乎是我几天前做的合并。 我应该避免这种合并吗?

[英]Conflicts in Subversion when updating to old revision. The problem seems to be a merge -r I did some days ago. Should I have avoided this merge?

I've been coding on a single branch in Subversion for some days. 我已经在Subversion的一个分支上编写了几天的代码。 Today I've decided to update to an old revision, buried like 30 revisions ago. 今天我决定更新到一个旧版本,埋没了30个版本之前。

Strangely enough, I got conflicts in one of my files. 奇怪的是,我的一个文件中出现了冲突。 The only reason I see for a problem with this branch would be a merge -r I did some days ago to make my (at the time) head go back to what it was on an old revision. 我看到这个分支出现问题的唯一原因就是我几天前做的merge -r - 让我(当时)回到原来的版本。

So, assuming the problem was with the merge -r , I have 2 questions: 所以,假设问题是merge -r ,我有两个问题:

  1. I did the -r merge so that I could come back to an old revision and then commit it, such that I could start working on from that point on (I basically wanted to discard my X last commits at the time). 我做了-r合并,以便我可以回到一个旧版本,然后提交它,这样我就可以从那时开始工作了(我基本上想放弃我当时的X最后一次提交)。 Was doing this -r merge the right approach? 这样做 - 合并正确的方法? Should I just have created another branch instead? 我应该创建另一个分支吗? That's certainly what I'd do with git's logical branches, as that'd be way cleaner, but then again, I don't want to "flood" this subversion repo with branches of mine. 这当然是我用git的逻辑分支做的,因为那样会更清洁,但话说再说一遍,我不想用我的分支“泛滥”这个颠覆回购。 Maybe I could just create a branch with the old revision and delete this one? 也许我可以用旧版本创建一个分支并删除这个?

  2. Let's say I'll now correct the conflicts. 假设我现在要纠正这些冲突。 My initial idea when coming back to this revision was to do a -r merge (again). 回到此修订版时,我最初的想法是再次进行-r合并。 So if in a week I decide I want to come back again, I'll have conflicts again, right? 因此,如果在一周内我决定再次回来,我会再次发生冲突,对吧? How to avoid this cycle? 如何避免这种循环?

This question can, maybe, be formulated in another way. 这个问题也许可以用另一种方式表达出来。 When doing "try and error" coding (with this I mean that I'll have to "come back" many times), how should I organize my Subversion repo? 在进行“尝试和错误”编码时(我的意思是我必须多次“回来”),我应该如何组织我的Subversion回购?

Thanks 谢谢

It looks like you need to do a set of modifications parting from one specific revision, then discard the whole set of revisions, and start all over again, several times. 看起来你需要从一个特定的修订版中进行一组修改,然后丢弃整套修订版,并重新开始几次。 If this is the case then I would recommend creating a new branch for each "attempt" and deleting the whole branch for discarding the modifications, or re-integrate it then delete it when you are happy with the code. 如果是这种情况,那么我建议为每个“尝试”创建一个新分支,并删除整个分支以丢弃修改,或者重新集成它,然后在您对代码感到满意时将其删除。 I think any other approach will give you "merge headaches", but of course I might be wrong. 我认为任何其他方法都会给你“合并头痛”,但当然我可能错了。

Remember that svn's reverse merge isn't a 'rollback and discard' your revisions, it undoes the changes you made to those files to the working copy until the file looks like the desired revision. 请记住,svn的反向合并不是“回滚并丢弃”您的修订版,它会将您对这些文件所做的更改撤消到工作副本,直到文件看起来像所需的修订版。 I've never heard of it producing conflicts (unless you have a local modification in your WC that's not been committed yet?) 我从来没有听说过它会产生冲突(除非你的WC中有一个本地修改但尚未提交?)

The question might be to see what the conflict is, and see if you can tell where and why it appeared. 问题可能是看看冲突是什么,看看你是否可以分辨它出现的地点和原因。

Using merge -r is a valid way to rollback to a previous revision, but making a new branch is just as valid - that only depends on how you organise your repo and how many branches you have. 使用merge -r是回滚到先前版本的有效方法,但创建新分支同样有效 - 这仅取决于您如何组织回购以及拥有多少分支。 If you're trashing 30 revisions, then it might be a bit cleaner to create a new branch and delete the old. 如果您要删除30个修订版,那么创建新分支并删除旧分支可能会更清晰一些。

If you do a lot of try+error coding, a DVCS might be a better option for you - git allows you to checkin locally as many times as you like and push just 1 changeset upstream, discarding all your 'trial' checkins (effectively rolling them up into 1 change), but like I said, we've never had a rollback problem, even with binary files so look into what that conflict is. 如果你做了很多尝试+错误编码,DVCS对你来说可能是一个更好的选择 - git允许你在本地登记多次,并在上游推送1个变更集,放弃所有'试用'签到(有效滚动)它们变成了一个变化),但就像我说的那样,我们从来没有回滚问题,即使是二进制文件也是如此,因此请查看冲突是什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Mercurial和Subversion:更改,提交,从SVN中提取,推送,“抱歉,找不到合并修订的svn父级。” - Mercurial and Subversion: changing, committing, pulling from SVN, pushing, “Sorry, can't find svn parent of a merge revision.” Subversion合并未合并文件 - Subversion merge did not merge a file 合并问题:我应该选择合并哪个修订版? - Merging problems: Which revision should I choose to merge from? 当我应该为一些主要更改(Subversion,TortoiseSVN)创建分支时,我一直在Trunk工作。 - I kept working in Trunk when I should have created a Branch for some major changes (Subversion, TortoiseSVN) 如何在SubVersion中重新合并从主干版本重新创建的分支? - How can I re-merge a branch re-created from a trunk revision in SubVersion? 尝试在同一分支附近合并时,Subversion树冲突 - Subversion tree conflicts when attempting to merge near identical branch 在使用Assembla时,如何从Subversion中的旧版本创建标记? - How do I create a tag from an old revision in Subversion when using Assembla? Subversion合并:始终用新版本替换文件 - Subversion merge: Always replace file with new revision 如何将工作副本合并到Subversion的基本修订中 - How to merge working copy into Base revision in subversion Subversion:如何解决合并-重新整合中的冲突? - Subversion: How to resolve conflicts in merge --reintegrate?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM