Uploaded image for project: 'Subversion'
  1. Subversion
  2. SVN-1864

Merging moved files

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • all
    • unscheduled
    • cmdline client
    • None

    Description

      I am trying to execute a suggested example for branches as briefly stated in
      http://svnbook.red-bean.com/svnbook/ch04s02.html
      --------------------------
      Let's say that you've been given the task of performing a radical reorganization
      of the project. It will take a long time to write, and will affect all the files
      in the project. The problem here is that you don't want to interfere with Sally,
      who is in the process of fixing small bugs here and there. She's depending on
      the fact that the latest version of the project (in /calc/trunk) is always
      usable. If you start committing your changes bit-by-bit, you'll surely break
      things for Sally. 
      --------------------------
      
      So I created my branch, and re-organized a whole bunch of stuff, by using svn
      move. In the mean time, work goes on in the trunk. Now I'm finally ready to
      merge the reorg branch into the trunk. An svn update in the branch produces
      nothing. Merging the branch into the trunk seems successful since a whole bunch
      of stuff was added or deleted. Unfortunately, the most recent stuff was deleted
      and the old stuff from the time of branch creation was added! The book says that
      svn move is actually an svn copy and delete. That means we keep the history, but
      the merge doesn't know anything about changes.
      
      
      C:\projects\test\trunk>svn list --recursive -v
           15 smcclena            May 14 10:43 origdir/
           15 smcclena         24 May 14 10:43 origdir/file.txt
      
      
      
      Create the branch
      C:\projects\test>svn copy trunk branches/reorg
      A         branches\reorg
      
      
      
      Modify a file
      C:\projects\test\trunk\origdir>svn status
      M      file.txt
      
      C:\projects\test\trunk\origdir>svn commit
      
      
      
      
      
      Meanwhile, do some re-organization
      C:\projects\test\branches\reorg>svn mkdir newdir
      A         newdir
      
      C:\projects\test\branches\reorg>svn move origdir\file.txt newdir
      A         newdir\file.txt
      D         origdir\file.txt
      
      C:\projects\test\branches\reorg>svn commit
      Adding         reorg\newdir
      Adding         reorg\newdir\file.txt
      Deleting       reorg\origdir\file.txt
      
      Committed revision 17.
      
      
      C:\projects\test\branches\reorg>svn rm origdir
      D         origdir
      
      C:\projects\test\branches\reorg>svn commit
      Deleting       reorg\origdir
      svn: Commit failed (details follow):
      svn:
      Item '/branches/reorg/origdir' is out of date
      
      C:\projects\test\branches\reorg>svn update
      At revision 18.
      
      C:\projects\test\branches\reorg>svn commit
      Deleting       reorg\origdir
      
      Committed revision 19.
      
      C:\projects\test\branches\reorg>svn update
      At revision 19.
      
      C:\projects\test\branches\reorg>svn log --stop-on-copy --verbose
      ------------------------------------------------------------------------
      r19 | smcclena | 2004-05-14 11:17:23 -0500 (Fri, 14 May 2004) | 2 lines
      Changed paths:
         D /branches/reorg/origdir
      
      removed origdir
      
      ------------------------------------------------------------------------
      r17 | smcclena | 2004-05-14 11:06:30 -0500 (Fri, 14 May 2004) | 2 lines
      Changed paths:
         A /branches/reorg/newdir
         A /branches/reorg/newdir/file.txt (from /branches/reorg/origdir/file.txt:16)
         D /branches/reorg/origdir/file.txt
      
      moved file
      
      ------------------------------------------------------------------------
      r16 | smcclena | 2004-05-14 10:50:18 -0500 (Fri, 14 May 2004) | 2 lines
      Changed paths:
         A /branches/reorg (from /trunk:14)
         A /branches/reorg/origdir (from /trunk/origdir:15)
      
      Made reorg branch
      
      ------------------------------------------------------------------------
      
      
      
      
      
      Now we're ready to merge back to the trunk. Note that the output from --dry-run
      does not accurately reflect what actually happens.
      
      
      C:\projects\test\trunk>svn merge --dry-run -r 16:HEAD
      http://bart/svn/test/branches/reorg
      A  newdir
      Skipped missing target: 'newdir\file.txt'
      D  origdir
      
      
      C:\projects\test\trunk>svn merge -r 16:HEAD http://bart/svn/test/branches/reorg
      A  newdir
      A  newdir\file.txt
      D         origdir\file.txt
      D         origdir
      D  origdir
      
      
      
      The issue is that if I commit this, file.txt will be the old version at the time
      of the reorg. Not very useful at all. Unless I'm not understanding something,
      the only way to achieve what I want is to painstakingly go back to the branch
      log and merge each moved directory one at a time. The "major file
      re-organization task" used as an example in the book isn't so easy after all.
      

      Original issue reported by peepsplat

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              subversion-importer Subversion Importer
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: