[pLog-svn] How do I merge my code with plog latest code easily.

Jon Daley plogworld at jon.limedaley.com
Sun Jul 10 00:36:43 GMT 2005


On Sun, 10 Jul 2005, nick nizhenyuan wrote:
> I am using SVN now.  But I still don't know how to merge my code with
> the latest plog code, I am really a green hand here:)
>
> For example, I checked out plog 1.0.2 and control it by SVN, then I
> added some of my code to it, so the question is how can I merge my new
> files with the new lyupdated plog1.0.2 got from plogworld?

 	It works best if you have the code somewhere that it doesn't 
matter if the server is down for a bit, but if you do it often, and pay 
attention to what changes are going to affect you, you can do it on a 
production server.
 	'svn status -u' will show what you have modified locally, and what 
files have been modified remotely.
 	If there aren't lines that were modified locally and remotely, 
presumably, there shouldn't be any problems, and you just run 'svn 
update', and all of the code will be merged (and then erase wizard.php 
quick...)
 	The potential for problems occur when you have modified something 
that someone else modified.  subversion will do a decent job of merging 
them together, but if you modified the same line, it will fail, and if you 
modified something really close to another line, it probably won't be able 
to figure out the right thing to do.
 	In that case, during the update, instead of outputting 'G' 
(meaning merGed) it will output 'C' for conflict.  It will then create a 
couple files:
   index.php     <- merged file, with both changes, split by <<< and >>>
                   and you manually edit it.
   index.php.r123   <- latest remote file
   index.php.r122   <- version that your changes were based off of.
   index.php.mine   <- your file

You decide what to do:
   merge the changes manually (just edit index.php)
   accept the new changes and throw away your own (move index.r123 to
      index.php)
   keep your changes (move index.php.mine to index.php)

   When you are happy with everything, run 'svn resolved index.php' and 
subversion will clean up the old files.

 	I usually run a 'svn update -u', and see if there will be any 
conflicts.  If there have been lots of updates, sometimes I will run 'svn 
update class' and then 'svn update templates', and then a root directory 
svn update, because the wizard.php will be updated first, and you don't 
want that hanging around very long.
 	The more often you do the updates, the easier the merging is.





More information about the pLog-svn mailing list