Skip to content

Cherry Pick merges in svn are shown a git merges in git #147

Open
@PeterGrandcourt

Description

@PeterGrandcourt

update: added missing merge step in the SVN operations.

Hello,
I have an issue where svn merged of specific revisions to branches, are interpreted by the conversion as full merges.
The equivalent of an svn merge of specific revisions is a cherry pick in git.

Is there a way of overriding this behaviour?

Take the following example

SVN operations

Set up the repo

Revision: 1
Message:
adding standard structure
----
Added : /branches
Added : /tags
Added : /trunk

add file_1.txt to trunk

Revision: 2
Message:
adding file 1
----
Added : /trunk/file_1.txt

add file_2.txt to trunk

Revision: 3
Message:
adding file 2
----
Added : /trunk/file_2.txt

Branch v_1 from trunk on revision 2

Revision: 5
Message:
creating version 1 from revision 2
contains file 1
----
Added : /branches/v_1 (Copy from path: /trunk, Revision, 2)

Merge revision 3 that added file_2.txt to v_1)

r6 
Changed paths:
   M /branches/v_1
   A /branches/v_1/file_2.txt (from /trunk/file_2.txt:3)

merging file_2.txt from trunk

Convert svn to git

rules

create repository test
end repository

match /trunk/
  repository test
  branch trunk
end match

match /branches/([^/]+)/
  repository test
  branch \1
end match


match /
end match

convert
docker run --rm -it -v pwd/workdir:/workdir -v /u02/svnroot/test:/tmp/svn -v pwd/conf:/tmp/conf svn2git /usr/local/svn2git/svn-all-fast-export --identity-map /tmp/conf/authors-transform.txt --rules /tmp/conf/rules --add-metadata --svn-branches --debug-rules --svn-ignore --empty-dirs /tmp/svn/

check the results

clone and check out v_1

git clone --branch v_1 ./workdir/test/ ./workdir/test_gitwc
cd workdir/test_wc

** look at the history of the v_1 branch **

commit 34b16b76dd4984332662500f118220c58a8447c8 (HEAD -> v_1, origin/v_1)
Merge: 9dfb79f 21bdd65
Author: peter.grandcourt <peter.grandcourt@iongroup.com>
Date:   Fri Sep 2 08:24:08 2022 +0000

    merging file_2.txt from trunk

    svn path=/branches/v_1/; revision=6

commit 9dfb79fec5ee9f5dd02d9de78fdd8457c175c273
Author: peter.grandcourt <peter.grandcourt@iongroup.com>
Date:   Fri Sep 2 08:17:58 2022 +0000

    creating version 1 from revision 2
    contains file 1

    svn path=/branches/v_1/; revision=5

commit 21bdd65a736d2f8f55eb6d7b1bd4d9d8c6b7cb62
Author: peter.grandcourt <peter.grandcourt@iongroup.com>
Date:   Fri Sep 2 08:13:44 2022 +0000

    adding file 2

    svn path=/trunk/; revision=3

commit cd3ecc5a43ce0127471236dbdad2af932a57b66e
Author: peter.grandcourt <peter.grandcourt@iongroup.com>
Date:   Fri Sep 2 08:10:22 2022 +0000

    adding file 1

    svn path=/trunk/; revision=2

expected

svn revision 3 adding file_2 to the trunk should not be visible in branch v_1 in git
this is a revision from the trunk and we didn't merged this revision in svn.

actual

svn revision 3 adding file_2 to the trunk is visible in branch v_1 in git
does svn-all-fast-export interpret all merges as full instead of performing a cherry-pick?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions