Issue #280 resolved

Merge history is lost after importing an SVN repository

Sascha Frinken
created an issue

Executing [1] on an existing svn repository returns nothing as everything has been merged from trunk to stable branch before. After importing the repsitory into scm manager the same command returns a long list of revisions.

[1] svn mergeinfo --show-revs eligible https://example.com/svn/original-repo/trunk https://example.com/svn/original-repo/branches/stable

Comments (10)

  1. Sebastian Sdorra repo owner
    • changed status to open

    Note the import does not change the repository. So could you please test the mergeinfo command directly with the repository (svn mergeinfo ... file:///... file:///...)?

    Could you provide steps to reproduce this issue (create repository, merge, import, mergeinfo)?

  2. Sascha Frinken reporter

    (Reply via s...@safri.net):

    OK meanwhile I found out that the mergeinfo is there when I use the local repository access (file:///) but it doesn't seem to be there when I check against http. Please fin all steps to reproduce below. My svn client version is 1.6.15 and in the scm manager repository settings I checked "Pre 1.7 Compatible".

    delete test repo if exists

    MYID=java -jar scm-cli.jar list-repositories | grep -B 1 test | grep ID | awk '{ print $2 }' [ -n "$MYID" ] && java -jar scm-cli.jar delete-repository "$MYID"

    create test repo

    java -jar scm-cli.jar create-repository --name test --type svn MYID=java -jar scm-cli.jar list-repositories | grep -B 1 test | grep ID | awk '{ print $2 }'

    add permissions

    java -jar scm-cli.jar add-permission "$MYID" --name sf -t WRITE

    create the test repo structure

    svn mkdir file:///var/repositories/svn/test/trunk -m "creating trunk dir"

    create the test repo structure

    svn mkdir file:///var/repositories/svn/test/branches -m "creating branches dir"

    creating initial stable branch from trunk

    svn cp file:///var/repositories/svn/test/trunk file:///var/repositories/svn/test/branches/stable -m "creating initial stable branch from trunk"

    check if the local working copy exists and delete it if necessary

    [ -d "/tmp/test" ] && rm -rf /tmp/test

    checkout the repo to a local repository

    svn co file:///var/repositories/svn/test /tmp/test

    just to avoid permission problems

    chmod -R 777 /tmp/test

    create a test file in trunk in working copy

    echo "mergetest" > /tmp/test/trunk/test.txt

    add the test file

    svn add /tmp/test/trunk/test.txt

    commit the test file

    svn ci /tmp/test/trunk/test.txt -m "creating a test file in trunk"

    merge the changes to the stable branch working copy

    svn merge file:///var/repositories/svn/test/trunk /tmp/test/branches/stable/

    commit the changes to the repository

    svn ci /tmp/test/branches/stable/ -m "merging rev 4 from trunk"

    check for revisions that have not yet been merged from trunk to stable branch - returns nothing as expected

    svn mergeinfo --show-revs eligible file:///var/repositories/svn/test/trunk file:///var/repositories/svn/test/branches/stable

    delete the svn dump if exists

    [ -d "/tmp/test.dump" ] && rm -rf /tmp/test.dump

    dump the test repository

    svnadmin dump /var/repositories/svn/test/ > /tmp/test.dump

    delete the repository

    java -jar scm-cli.jar delete-repository "$MYID"

    create a new empty test repository

    java -jar scm-cli.jar create-repository --name test --type svn MYID=java -jar scm-cli.jar list-repositories | grep -B 1 test | grep ID | awk '{ print $2 }'

    add permissions

    java -jar scm-cli.jar add-permission "$MYID" --name sf -t WRITE

    import the dump to the test repository

    svnadmin load/tmp/test.dump > /var/repositories/svn/test

    check if mergeinfo is there using the local repository - nothing returned everything is fine

    svn mergeinfo --show-revs eligible file:///var/repositories/svn/test/trunk file:///var/repositories/svn/test/branches/stable

    check if mergeinfo is there using the http repository - r4 is returned what is wrong

    svn mergeinfo --show-revs eligible http://localhost:8080/scm/svn/test/trunk http://localhost:8080/scm/svn/test/branches/stable

  3. Sebastian Sdorra repo owner

    I've done some tests and i think i find the cause of the problem. The svn client send a request like the following:

    REPORT /scm/svn/issue-280/!svn/bc/5/branches/stable HTTP/1.1.
    
    <S:mergeinfo-report xmlns:S="svn:">
      <S:revision>5</S:revision>
      <S:inherit>inherited</S:inherit>
      <S:path></S:path>
    </S:mergeinfo-report>
    

    The response of scm-manager looks like the following:

    <S:mergeinfo-report xmlns:D="DAV:" xmlns:S="svn:">
      <S:mergeinfo-item>
        <S:mergeinfo-path>/branches/stable</S:mergeinfo-path>
        <S:mergeinfo-info>/trunk:3-4</S:mergeinfo-info>
      </S:mergeinfo-item>
    </S:mergeinfo-report>
    

    But this seems to be wrong. I think the element mergeinfo-path should contain the path from the request (in this case an empty string). So the response should look like this one:

    <S:mergeinfo-report xmlns:D="DAV:" xmlns:S="svn:">
      <S:mergeinfo-item>
        <S:mergeinfo-path></S:mergeinfo-path>
        <S:mergeinfo-info>/trunk:3-4</S:mergeinfo-info>
      </S:mergeinfo-item>
    </S:mergeinfo-report>
    

    I will try to verify this.

  4. Log in to comment