]> sipb.mit.edu Git - ikiwiki.git/blob - doc/patchqueue/merge_patch.mdwn
2dcd9914e36ec268f6c084a0644d71625493e54c
[ikiwiki.git] / doc / patchqueue / merge_patch.mdwn
1 svn's merge command has three twisty little syntaxes, none 
2 very DWIM-ish. For merging one file, apparently it is helpful
3 to specify that file itself. [This patch][] does that.
4
5 [This patch]: http://ikidev.betacantrips.com/patches/merge.patch
6
7 The bug that this fixes is hard to demonstrate without 
8 generating a lot of noise, but you can get the idea by 
9 finding a file that was committed in a subdirectory and
10 merging a change with it.
11
12     [apu]$ emacs one/test.mdwn
13     [apu]$ svn add one/test.mdwn
14     A         one/test.mdwn
15     [apu]$ svn commit -m "Another test case for merging."
16     Adding         one/test.mdwn
17     Transmitting file data .
18     Committed revision 42.
19     [apu]$ emacs one/test.mdwn
20     [apu]$ svn commit -m "Change."
21     Sending        one/test.mdwn
22     Transmitting file data .
23     Committed revision 43.
24     svn merge -r38:39 ~/ikidevwc/patches/merge.patch
25     [apu]$ svn merge -r42:43 one/test.mdwn
26     svn: Cannot replace a directory from within
27     [apu]$ svn merge -r42:43 ~/ikidevwc/one/test.mdwn
28     svn: Cannot replace a directory from within`
29
30 CGI.pm does a command much like the last one. However:
31
32     [apu]$ svn merge -r43:42 ~/ikidevwc/one/test.mdwn
33     svn: Cannot replace a directory from within
34     [apu]$ svn merge -r43:42 ~/ikidevwc/one/test.mdwn ~/ikidevwc/one/test.mdwn
35     U    /home/glasserc/ikidevwc/one/test.mdwn
36
37 In other words, merging works only when you specify 
38 the file, or, alternately:
39
40     [apu]$ cd one
41     [apu]$ svn merge -r42:43 ~/ikidevwc/one/test.mdwn
42     G    test.mdwn
43
44 ... if you're in the same directory as the file. Note that if 
45 a file called "test.mdwn" happens to be where you are, it'll get
46 changed! I think this is what is meant in `svn help merge` when
47 it says:
48
49     If WCPATH is omitted, a default value of '.' is assumed, unless
50     the sources have identical basenames that match a file within '.':
51     in which case, the differences will be applied to that file.
52
53 So, to conclude: when merging two revisions of a file, either specify
54 the file, or be in the same directory as a file with the same name.
55 This patch makes the former always happen, whereas previously the 
56 second would sometimes not happen. It also obviates the call to chdir.
57
58 Source: [this message][] on the svn-user list.
59
60 [this message]: http://svn.haxx.se/users/archive-2005-03/0926.shtml
61
62 --Ethan