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

Double file entries in repository after merge of changes (moved file) from one branch to another



    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.6.x
    • Fix Version/s: unscheduled
    • Component/s: unknown
    • Labels:


      This issue is created based on mailthread:
      We merged changes (creation and move of a file) from one branch to another. Due
      to our mergeinfo properties we divided the merge in two merge steps/rev-ranges
      (without commit in between). Afterwards we committed the result of both merges.
      Example (Test Script see below):
       - Branch1, Create dir1 with file1 -> commit/Rev1
       - Branch1, Create dir2 in dir1 and mv file1 to dir2 -> commit/Rev2
       - Branch2, svn merge -r....:Rev1 <Branch1> .
       - Branch2, svn merge -rRev1:Rev2 <Branch1> .
       - Branch2, svn ci ...
      Due to status/commit/log output and WC everythings fine (finally only one file
      'file1' in dir2 was shown), but after commit in the repository the file 'file1'
      is located in old and new directory. A new checkout contains file1 at both
      The problem occurcs only if we merge in 2 steps and don't commit between the
      both steps.
      Is this procedure ok or do we have to commit between each merge? I thought 'svn
      merge' also splits rev ranges depending on the mergeinfo properties.
      We tested this behavior in several environments:
      	SVN Client, 1.5.6/1.6.2 (Windows JavaHL, precompiled Tigris.org Apache 2.2)
      	SVN Server, 1.5.5/1.6.2 (Linux-Server, compiled with gcc 4.1.0, Apache 2.2.11
      with mod_dav_svn)
      	Repository format FSFS
      ------ Test-script -------
      SVN=`which svn`
      SVNSERVE=`which svnserve`
      SVNADMIN=`which svnadmin`
      # URL=svn://localhost/repos
      # URL=file:///`pwd`/repos
      ##rm -rf repos wc import-me
      ##${SVNADMIN} create repos
      echo "### Making a Greek Tree for import..."
      mkdir import-me
      mkdir import-me/trunk
      mkdir import-me/tags
      mkdir import-me/branches
      mkdir import-me/trunk/A
      mkdir import-me/trunk/A/B/
      mkdir import-me/trunk/A/C/
      mkdir import-me/trunk/A/D/
      mkdir import-me/trunk/A/B/E/
      mkdir import-me/trunk/A/B/F/
      mkdir import-me/trunk/A/D/G/
      mkdir import-me/trunk/A/D/H/
      echo "This is the file 'iota'."        > import-me/trunk/iota
      echo "This is the file 'A/mu'."        > import-me/trunk/A/mu
      echo "This is the file 'A/B/lambda'."  > import-me/trunk/A/B/lambda echo "This
      is the file 'A/B/E/alpha'." > import-me/trunk/A/B/E/alpha echo "This is the file
      'A/B/E/beta'."  > import-me/trunk/A/B/E/beta
      echo "This is the file 'A/D/gamma'."   > import-me/trunk/A/D/gamma
      echo "This is the file 'A/D/G/pi'."    > import-me/trunk/A/D/G/pi
      echo "This is the file 'A/D/G/rho'."   > import-me/trunk/A/D/G/rho
      echo "This is the file 'A/D/G/tau'."   > import-me/trunk/A/D/G/tau
      echo "This is the file 'A/D/H/chi'."   > import-me/trunk/A/D/H/chi
      echo "This is the file 'A/D/H/omega'." > import-me/trunk/A/D/H/omega
      echo "This is the file 'A/D/H/psi'."   > import-me/trunk/A/D/H/psi
      echo "### Done."
      echo ""
      echo "### Importing it..."
      (cd import-me; ${SVN} import -q -m "Initial import." ${URL}) echo "### Done."
      echo ""
      # test case
      # create two branches
      ${SVN} mkdir -m "new Branch A" ${URL}/branches/A ${SVN} mkdir -m "new Branch B"
      # Create changes in Branch A
      ${SVN} co -q ${URL}/branches/A wcA
      cd wcA
      svn mkdir dir1
      cd dir1
      touch file1
      svn add file1
      cd ..
      svn ci -m "Commit new dir1/file1 Branch A" .
      cd dir1
      svn mkdir dir2
      svn mv file1 dir2
      cd ..
      svn ci -m"relocated file1 to dir2 in BranchA" .
      # Merge changes from Branch A to Branch B cd ..
      ${SVN} co -q ${URL}/branches/B wcB
      cd wcB
      endRev=`svn info | grep Revision: | awk -F ' ' '{print  $2}'` midRev=`expr
      $endRev - 1` startRev=`expr $endRev - 2`
      svn merge --force -r${startRev}:${midRev} ${URL}/branches/A .
      svn merge --force -r${midRev}:${endRev} ${URL}/branches/A .
      echo ""
      echo "Status:"
      svn status
      svn ci -m "Commit merge results to Branch B" .
      echo ""
      echo "Log, should only have one entry for file1"
      svn log -rHEAD -vq
      #List Merge Results
      echo ""
      echo "old location dir1, there should be no file1"
      svn list ${URL}/branches/B/dir1
      echo "new location dir1/dir2, there should be a file1"
      svn list ${URL}/branches/B/dir1/dir2

      Original issue reported by hhermanns


        1. 1_issue-3431.sh
          3 kB
          Stefan Sperling



            • Assignee:
              subversion-importer Subversion Importer
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: