svn 合并后恢复 [英] svn revert after merge
问题描述
我已经在两个分支之间进行了 svn 合并——没有签入——现在我想取消合并"我的工作副本中的一些文件.类似于以下内容:
I've done an svn merge between two branches -- not checked in -- and now I want to "un-merge" some of the files in my working copy. Something like the following:
svn co svn://myserver/repo/branches/foo@1000 foo
cd foo
svn merge svn://myserver/repo/branches/foo@1000 \
svn://myserver/repo/branches/bar@1000
(注意:我想使用 svn merge
,而不仅仅是从 bar
的工作副本中复制文件,因为(1)有一些合法的合并,即在 foo
和 bar
上对相同文件进行了不相关的更改,并且(2)当我检查时,bar
和我中的某些文件已被删除我也想从 foo
中删除它们.)
(Note: I want to use svn merge
, and not just copy the files from a working copy of bar
, because (1) there are some legit merges, i.e. unrelated changes made on foo
and bar
to the same files, and (2) some files have been deleted in bar
and I when I check in I want to delete them from foo
as well.)
我想检入大部分合并文件,但其中一些,我想从 bar
分支中抛出更改并保留 foo
中的现有文件分支.所以我尝试:
I want to check in most of the merged files, but some of them, I want to throw out the changes from bar
branch and keep the existing file from foo
branch. So I try:
svn revert baz/qux.quux
这没有任何作用.qux.quux
仍然有来自 bar
分支的变化.我试试 svn status
;它是空白的.我尝试从 foo
分支的原始副本复制过来:文件现在具有正确的内容,但是 svn diff
现在显示 bar <foo
差异.svn revert
再次:现在我们已经恢复了 bar
的变化.让我们试试svn info
:
This does nothing. qux.quux
still has the changes from bar
branch. I try svn status
; it's blank. I try copying over from a prestine copy of foo
branch: the file now has the right content, but svn diff
now shows the bar < foo
diffs. svn revert
again: now we've got the bar
changes back. Let's try svn info
:
Path: baz/qux.quux
Name: qux.quux
Working copy root path: /home/mydir/foo
URL: svn://myserver/repo/branches/foo/baz/qux.quux
Repository root: svn://myserver/repo
Repository UUID: [whatever]
Revision: 1000
Node Kind: file
Schedule: normal
Last Changed Author: [author of last change on bar, not foo]
Last Changed Rev: [rev of last change on bar, not foo]
Last Changed Date: [date of last change on bar, not foo]
那么我如何回到foo
的qux.quux
版本?以及如何清除工作副本中的坏"状态信息?
So how do I get back to foo
's version of qux.quux
? And how do I clear up the "bad" state information in my working copy?
我感觉我从根本上误解了 svn merge
不知何故.
I have the feeling I'm fundamentally misunderstanding svn merge
somehow.
推荐答案
David,使用 PEG 修订版是否明智且必要的决定?我只是尝试使合并尽可能简单,并要求您使用新的干净工作副本从头开始重新合并,并在此处显示所有完整的真实命令和输出(UUID 不是私有数据,用于测试的 repo 的 URL 可以是 file:///).
David, was using PEG-revision sensible and necessary decision? I just try to make merge as easy as possible, and ask you re-done merge from scratch with new clean Working Copy and show here all, full real commands and output (UUID isn't private data, URL of repo for test can be file:///).
我的测试结果(合并头和还原单个文件)显示预期结果(您可以在我的测试用例中重新检查它 - 存储库已打开)
Results of my test (merging heads and reverting single file) show expected results (you can re-check it on my test-case - repository is open)
- 具有一些历史的存储库 Hello:http://mayorat.ursinecorner.ru:8088/svn/你好/
- 目标分支 Leichtbau-Deutsch:http://mayorat.ursinecorner.ru:8088/svn/Hello/branches/Leichtbau-Deutsch/
- 源分支 branche-francaise:http://mayorat.ursinecorner.ru:8088/svn/Hello/branches/branche-francaise/
步骤和操作
>svn co http://mayorat.ursinecorner.ru:8088/svn/Hello/branches/Leichtbau-Deutsch/
A Leichtbau-Deutsch\Hello.en.txt
A Leichtbau-Deutsch\Hello.fr.txt
A Leichtbau-Deutsch\Hello.de.txt
U Leichtbau-Deutsch
Checked out revision 37.
>cd Leichtbau-Deutsch
>svn merge http://mayorat.ursinecorner.ru:8088/svn/Hello/branches/branche-francaise/
--- Merging r26 through r37 into '.':
U Hello.fr.txt
Conflict discovered in 'Z:/Leichtbau-Deutsch/Hello.de.txt'.
Select: (p) postpone, (df) diff-full, (e) edit,
(mc) mine-conflict, (tc) theirs-conflict,
(s) show all options: tc
U Hello.de.txt
--- Recording mergeinfo for merge of r26 through r37 into '.':
U .
>svn status
M .
M Hello.de.txt
M Hello.fr.txt
>svn revert Hello.fr.txt
Reverted 'Hello.fr.txt'
>svn st
M .
M Hello.de.txt
和预期结果
PS:如果您愿意,我可以使用 PEG 修订版重复此测试.但是 - 我更喜欢使用来自相应分支的真实修订并且(与合并恢复无关)我必须执行(如果我没记错的话)svn up
(并盲目合并)到分支 HEAD在能够提交合并集之前,因为您的 svn co svn://myserver/repo/branches/foo@1000
checkout not-HEAD 修订和 SVN 中的修订历史必须是线性的
PS: I can repeat this test with PEG-revisions, if you want. But - I'll prefer use real revisions from corresponding branches and (unrelated to merge-revert) I'll have to perform (if memory serves me well) svn up
(and blindly merge) to branch HEAD before be able to commit merge-set, because your svn co svn://myserver/repo/branches/foo@1000
checkout not-HEAD revision and revision history in SVN must be linear
这篇关于svn 合并后恢复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!