[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Bug in Merge

From: Alexander Iljin <ajsoft_at_yandex.ru>
Date: Sat, 19 Dec 2009 01:32:11 +0600

Hello!

  I was going to argue in favour of the TortoiseSVN, but then I did my
  own investigation, and I hope that serves the community.

sgn> 4.20.7:"Either way, no attempt is made to merge the changes - you
sgn> choose one or the other." So I it have to take the file how is
sgn> listed in theirs in the diff window I show.

  Looks like that either that bit is unclear in the documentation, or
  we do have a misimplementation. What happens in your case is:
  the file gets merged, and all the conflicted parts are taken from
  the "theirs" (repository) version, while you are expecting (and
  documentation suggests) that the entire "theirs" file would be
  taken, and not just the conflicted parts.

  Here I put together a little batch file to reproduce the problem
  (command-line SVN client is required to run):

--8<---
:: BSPath = path to the current folder with backslashes
:: FSPath = path to the current folder with forward slashes
set BSPath=%~dp0
set FSPath=%BSPath:\=/%

:: create repository "repo" with initial content
svnadmin create %BSPath%repo
md wc
cd wc
md trunk
md branches
cd trunk
echo 1 >>file.txt
echo 2 >>file.txt
echo 3 >>file.txt
echo 4 >>file.txt
cd ..\..
svn import wc file:///%FSPath%repo -m "Initial import."
rd /s /q wc

:: create the conflict between "branches/test" and "trunk"
svn copy file:///%FSPath%repo/trunk file:///%FSPath%repo/branches/test -m "Created the test branch."
svn checkout file:///%FSPath%repo wc
cd wc\trunk
del file.txt
echo 1 trunk>>file.txt
echo 2 trunk>>file.txt
echo 3 trunk>>file.txt
echo 4 >>file.txt
echo 5 This line was only added in trunk.>>file.txt
cd ..\branches\test
del file.txt
echo 1 branches\test>>file.txt
echo 2 branches\test>>file.txt
echo 3 branches\test>>file.txt
echo 4 >>file.txt
::echo 5 This line was only added in branches\test.>>file.txt
cd ..\..
svn commit -m "Created the conflict."
::svn merge -c 3 file:///%FSPath%repo/branches/test trunk
cd ..
--8<---

  Save it in an empty folder and run.
  Now you'll have to manually merge rev3 from branches/test to trunk.
  Go to "wc" folder, right-click on trunk, select TortoiseSVN -
  Merge... - Next, fill the path to file:///.../repo/branches/test,
  set revision to merge = 3, Next, Next, Use repository. The conflict
  you'll get is shown on the attached Conflict.png. Now if you look
  into trunk/file.txt you'll see the last line: "5 This line was only
  added in trunk.", which reproduces the bug OP is seeing. That last
  line was never added to the branches/test/file.txt, it was only
  added in trunk, and the OP expects it to be gone when he choses the
  "Use repository" (=branches/test) option.
  
  To get the expected behaviour he currently should choose "Edit
  conflict" to open TortoiseMerge, then right-click on the left
  "Theirs" pane and select the "Use this whole file" item.

  Now if you uncomment the "svn merge" command at the bottom of the
  batch file and select "(s) show all options" when prompted by the
  command-line client, you'll see the following menu:

--8<---
Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved,
        (mc) mine-conflict, (tc) theirs-conflict,
        (s) show all options: s

  (e) edit - change merged file in an editor
  (df) diff-full - show all changes made to merged file
  (r) resolved - accept merged version of file

  (dc) display-conflict - show all conflicts (ignoring merged version)
  (mc) mine-conflict - accept my version for all conflicts (same)
  (tc) theirs-conflict - accept their version for all conflicts (same)

  (mf) mine-full - accept my version of entire file (even non-conflicts)
  (tf) theirs-full - accept their version of entire file (same)

  (p) postpone - mark the conflict to be resolved later
  (l) launch - launch external tool to resolve conflict
  (s) show all - show this list
--8<---

  Apparently, when you click "Use repository" TortoiseSVN performs the
  "(tc) theirs-conflict" command, while the OP expects it to do the
  "(tf) theirs-full". The documentation kind of supports the OP's
  expectations by saying that no merging will be performed whatsoever
  and that you choose either local file or remote file (it reads as if
  it means the entire file, not selected pieces of it). TortoiseSVN
  does not currently provide buttons to select the "mine-full" or
  "theirs-full" commands, except in the context menu of the
  TortoiseMerge (which is kind of hidden, if you ask me).

  So, I think it's either a bug (wrong commands executed by the
  buttons), or a lacking feature (needs two more buttons for the
  missing mf & tf commands), and the documentation may need
  correction.

  PS: It is always hard to create a short and expressive labels for
  the buttons. If I may make a suggestion, "mf" can be labeled
  "Discard repository changes", and "tf" can be "Discard local
  changes". A mouseover hint could further clarify the actions to be
  performed.

---=====---
 Alexander

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2431574

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_tortoisesvn.tigris.org].

Conflict.PNG
Received on 2009-12-18 20:32:42 CET

This is an archived mail posted to the TortoiseSVN Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.