0

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

(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.)

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

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]

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?

I have the feeling I'm fundamentally misunderstanding svn merge somehow.

4

2 に答える 2

0

デビッドは、賢明で必要な決定をしたPEGリビジョンを使用していましたか? 私はマージをできるだけ簡単にしようとしており、新しいクリーンな作業コピーを使用して最初からマージをやり直し、ここにすべての完全な実際のコマンドと出力を表示するように依頼します(UUID はプライベート データではありません。テスト用のリポジトリの URL はファイル:///)。

私のテストの結果(ヘッドのマージと単一ファイルの復元)は、期待される結果を示しています(私のテストケースで再確認できます-リポジトリが開いています)

手順と操作

>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 リビジョンでこのテストを繰り返すことができます。しかし、私は対応するブランチから実際のリビジョンを使用することを好み、(merge-revert とは関係なく) (メモリがうまく機能する場合) svn up(そしてやみくもにマージ) 実行して、マージ セットをコミットできるようにする前に HEAD をブランチする必要があります。svn co svn://myserver/repo/branches/foo@1000チェックアウトの HEAD ではないリビジョンと SVN のリビジョン履歴は線形でなければならないためです。

于 2013-02-05T01:23:51.640 に答える
0

SVN で、せいぜいハックであるチェリーピッキングでマージしたいようです。これをやってのけるには、 svn マージの専門家になる必要があります。他のバージョン管理システム (hg、darcs、bzr) は、この開発方法をサポートbetterしていますが、独自のいぼが付属しています。だから、あなたの毒を選んでそれに慣れてください。

于 2013-02-05T00:53:23.303 に答える