Reputation: 2599
I was wondering if it was in any way possible to merge tag_1
into tag_2
such that any conflicts result in tag_1
's files overwriting tag_2
's files by default. Also, if there are files/dirs in tag_1
that don't exist in tag_2
will exist after the merge.
For example, if I was to execute:
svn merge http://host/svn/tags/tag_1 http://host/svn/tags/tag_2
this would force overwrite and commit all changes and then if I checked out tag_2
, all of tag_1
's additional/altered files would be in the working copy.
Currently, I use a method that runs a diff and then runs svn rm
on any files of the same name and path in tag_2
and then svn cp
the new files in, but it is becoming quite inefficient as releases grow in the number of changed files.
Upvotes: 0
Views: 5551
Reputation: 97282
svn help merge
carefully for command optionsIf you want merge to tag2, you have:
svn merge http://host/svn/tags/tag_1 --accept 'mine-conflict'
do the trick (parts without conflicts will be merged, for conflicted chunks "mine" - i.e tag_2 version - will be selected automatically)Edit: Test-run in reply to comment
Initial state (use trunk and branch)
svn log -q -v file:///Z:/Repo/
------------------------------------------------------------------------
r3 | Badger | 2013-01-17 10:07:55 +0600 (Чт, 17 янв 2013)
Changed paths:
A /branches/MyFixes (from /trunk:2)
------------------------------------------------------------------------
r2 | Badger | 2013-01-17 10:03:32 +0600 (Чт, 17 янв 2013)
Changed paths:
A /trunk/Data
A /trunk/Data/b.txt
A /trunk/Data/c.txt
A /trunk/a.txt
------------------------------------------------------------------------
r1 | Badger | 2013-01-17 09:57:52 +0600 (Чт, 17 янв 2013)
Changed paths:
A /branches
A /tags
A /trunk
------------------------------------------------------------------------
svn ls -R file:///Z:/Repo/trunk
Data/
Data/b.txt
Data/c.txt
a.txt
svn ls -R file:///Z:/Repo/branches/MyFixes
Data/
Data/b.txt
Data/c.txt
a.txt
Change branch (edit files, add new objects)
svn log -q -v file:///Z:/Repo/ -l 1
------------------------------------------------------------------------
r4 | Badger | 2013-01-17 10:26:40 +0600 (Чт, 17 янв 2013)
Changed paths:
M /branches/MyFixes/Data/b.txt
M /branches/MyFixes/Data/c.txt
A /branches/MyFixes/Data/d.txt
A /branches/MyFixes/NewData
A /branches/MyFixes/NewData/e.txt
A /branches/MyFixes/NewData/f.txt
M /branches/MyFixes/a.txt
------------------------------------------------------------------------
Control diffs for "M"-files
svn diff file:///Z:/Repo/trunk/a.txt file:///Z:/Repo/branches/MyFixes/a.txt
Index: a.txt
===================================================================
--- a.txt (.../trunk/a.txt) (revision 4)
+++ a.txt (.../branches/MyFixes/a.txt) (revision 4)
@@ -1,2 +1,2 @@
-String 1
-String 2
+A String 1
+A String 2
svn diff file:///Z:/Repo/trunk/Data/b.txt file:///Z:/Repo/branches/MyFixes/Data/b.txt
Index: b.txt
===================================================================
--- b.txt (.../trunk/Data/b.txt) (revision 4)
+++ b.txt (.../branches/MyFixes/Data/b.txt) (revision 4)
@@ -1,2 +1,3 @@
-Data String 1
-Data String 2
+The Data String One
+The Data String Two
+The Data String Three
svn diff file:///Z:/Repo/trunk/Data/c.txt file:///Z:/Repo/branches/MyFixes/Data/c.txt
Index: c.txt
===================================================================
--- c.txt (.../trunk/Data/c.txt) (revision 4)
+++ c.txt (.../branches/MyFixes/Data/c.txt) (revision 4)
@@ -1,2 +1,3 @@
-String 1 data
-String 2 data
+1 Los datos de cadena
+Cadena 2 Datos
+Cadena 3 Datos
Try to merge
z:\Trunk>svn merge file:///Z:/Repo/branches/MyFixes --accept "mine-conflict" --dry-run
--- Merging r3 through r4 into '.':
A NewData
A NewData\e.txt
A NewData\f.txt
U Data\b.txt
U Data\c.txt
A Data\d.txt
U a.txt
Impression - none conflicts (as expected), none tree-conflicts (as expected by me), diverged files merged, new from branch - added
Real merging
z:\Trunk>svn merge file:///Z:/Repo/branches/MyFixes --accept "mine-conflict"
--- Merging r3 through r4 into '.':
U Data\b.txt
U Data\c.txt
A Data\d.txt
U a.txt
A NewData
A NewData\e.txt
A NewData\f.txt
--- Recording mergeinfo for merge of r3 through r4 into '.':
U .
Commit merge
svn log -q -v file:///Z:/Repo/ -l 1
------------------------------------------------------------------------
r5 | Badger | 2013-01-17 10:50:35 +0600 (Чт, 17 янв 2013)
Changed paths:
M /trunk
M /trunk/Data/b.txt
M /trunk/Data/c.txt
A /trunk/Data/d.txt (from /branches/MyFixes/Data/d.txt:4)
A /trunk/NewData (from /branches/MyFixes/NewData:4)
M /trunk/a.txt
------------------------------------------------------------------------
Maybe I edited files erroneously in branch (a/b/c), but for some strange reasons --accept "mine-conflict"
was ignored and files after merge are equal to their branch's parents.
Addition: OK, I forgot edit also a/b/c in trunk before merging. Mea culpa, must work as expected totally after adding this point
Upvotes: 2