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

Re: A merge question similar to the diff question

From: Ryan Schmidt <subversion-2005_at_ryandesign.com>
Date: 2005-10-22 23:20:00 CEST

Hi Jim. I didn't see this message when I responded to you earlier.
Let's see what we have here.

On Oct 21, 2005, at 21:30, Jim Lynch wrote:

> I'm attempting to merge a file back into the trunk. It doesn't
> seem to sense all of my changes. For a test the following code
> checks out the trunk then checks out a branch with changes. I do a
> diff of one of the files to demonstrate that it is differnt in the
> branch from the trunk then I do a merge --dry-run and all it shows
> me is the added files. It does not show that it would have
> modified the .h file with changes. There are a number of other
> files that have changed also, but for the sake of brevity, I
> haven't documented that.
>

Well, "sense" is an interesting word. Subversion doesn't actually
sense anything. You have to tell it what to do—I'll explain what I
mean below:

> Any suggestions would be appreciated. I'm getting frustrated with
> subversion and need a boost.
>

The book is, of course, excellent and covers much of what you need to
know.

http://svnbook.red-bean.com/

And for the rest, you've come to the right place! There are so many
helpful people here that hopefully we'll have you up and running and
enjoying Subversion in no time.

> [jlynch_at_linux test]$ svn checkout svn+ssh://localhost/home/jlynch/
> svnrep/trunk logger
[snip]
> [jlynch_at_linux test]$ svn checkout svn+ssh://localhost/home/jlynch/
> svnrep/branches/log4
[snip]
> [jlynch@DevI01 test]$ diff log4/loggerbase.h logger/loggerbase.h
> 4d3
> < //#include <windows.h>
> 72,73d70
> < int diagLoopCount;
> < int inputStageActiveCount;
> 138,139d134
> < int openSocket;
> < int closeSocket;
>
> [jlynch@linux test]$ cd log4
>
> [jlynch_at_linux log4]$ svn merge --dry-run svn+ssh://localhost/home/
> jlynch/svnrep/trunk svn+ssh://localhost/home/jlynch/svnrep/
> branches/log4
> A log4cplus.properties
> A errorlog.cpp
> A errorlog.hpp
>
> [jlynch@linux test]$

And the merge command is what's not right. In my previous mail, I
wrote that svn merge takes three locations, and constructs a diff
between the first two, and applies it to the third. If you don't give
a third, it takes the current directory. What you wrote is: make a
diff between trunk and the log4 branch, and apply it to the directory
where I am now (a working copy of the log4 branch). So that's not
what you wanted.

It looks like what you wanted was to take differences between trunk
and log4 and apply them to the trunk. If that's so, then your merge
command was fine, except you needed to perform it in the trunk
working copy, not the log4 branch working copy:

cd trunk
svn merge svn+ssh://localhost/home/jlynch/svnrep/trunk \
svn+ssh://localhost/home/jlynch/svnrep/branches/log4

You wrote above that you wanted to "merge a file back into the
trunk." Now, I know that in CVS, it's normal to think in terms of
files, but in Subversion, you need to think in terms of revisions.
You'll generally make a change to a file, or to several files, and
maybe add some files and delete some others, and you'll commit all of
this together as one revision. Then you can take those same changes
and apply them somewhere else by doing a merge. You often don't want
to merge all changes on a branch back to the trunk; instead, it's
common to want to merge only one particular bugfix. To do this, you
need to keep track of the revision number in which the change was
made (or, if you've forgotten, look it up in the log).

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Oct 22 23:21:50 2005

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

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