{"thread":{"id":"30097","subject":"git-svn: cloning an SVN repo with sub-branches and sub-tags","startedAt":"2012-03-29T13:47:13Z","lastAt":"2012-03-30T16:20:11Z","messageCount":9,"participants":["Daniel Pocock","Ramkumar Ramachandra","dag@cray.com","Stephen Bash","Dave Zarzycki"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"188064","messageId":"4F7467E1.3090004@pocock.com.au","threadId":"30097","inReplyTo":null,"subject":"git-svn: cloning an SVN repo with sub-branches and sub-tags","fromName":"Daniel Pocock","fromEmail":"daniel@pocock.com.au","sentAt":"2012-03-29T13:47:13Z","receivedAt":"2012-03-29T13:47:13Z","isPatch":false,"sender":{"key":"daniel@pocock.com.au","avatar":null},"body":"\n\n\nI'm trying to use git-svn to clone a repo that has sub-branches and sub-tags\n\nThe SVN layout is like this:\n\nbranches/user1/workitem1\nbranches/user1/workitem2\nbranches/user2/workitem1\nbranches/user2/workitem2\n\ntags/v1.0\ntags/v1.1\ntags/debian/v1.0-1\ntags/debian/v1.1-1\ntags/debian/v1.1-2\n\nIn git, I would like to have branches with the same names, e.g.\n\nbranches/user1/workitem1\nbranches/user1/workitem2\nbranches/user2/workitem1\nbranches/user2/workitem2\n\nand tags like this:\n\n1.0  (notice I don't want to keep the v1.0, drop the v)\n1.1\ndebian/1.0-1\ndebian/1.1-1\ndebian/1.1-2\n\nHowever, if I run\n\ngit svn clone \\\n   -T trunk \\\n   -t tags \\\n   -b branches \\\n   https://flactag.svn.sourceforge.net/svnroot/flactag \\\n   flactag-git1\n\nI don't get any of the branches or tags, and I get numerous warnings \nlike this:\n\nW: -empty_dir: branches/d_pocock/autotools/HTTPFetch.cc\nW: -empty_dir: branches/d_pocock/autotools/HTTPFetch.h\nW: Cannot find common ancestor between \nf475b655c10b55b36df8376a396c0d9534418617 and \n7e277bfd626a1caa84681e93a7af73e0160eb2eb. Ignoring merge info.\nW: Cannot find common ancestor between \nf475b655c10b55b36df8376a396c0d9534418617 and \na82cd9bd2197a89303558af9aad43fa0c23d1ddb. Ignoring merge info.\n\nI have the impression that git-svn does not like the repository layout, \nand it is not clear from the manual page how to make it work.  Can \nanyone share any advice about this?\n"},{"id":"188071","messageId":"92FA9CF9-7E8E-4DE6-8524-030A0AD33C9E@apple.com","threadId":"30097","inReplyTo":"4F7467E1.3090004@pocock.com.au","subject":"Re: git-svn: cloning an SVN repo with sub-branches and sub-tags","fromName":"Dave Zarzycki","fromEmail":"zarzycki@apple.com","sentAt":"2012-03-29T14:40:22Z","receivedAt":"2012-03-29T14:40:22Z","isPatch":false,"sender":{"key":"zarzycki@apple.com","avatar":"https://avatars.githubusercontent.com/u/1071982?v=4"},"body":"You can make this work, but it is very fragile, doesn't scale well, and it only works on recent versions of git. For example, from the LLVM clang project:\n\nignore-refs = ^refs/remotes/svn/(Apple|ggreif|misc/Apple/williamson-llvm|misc/Apple/Necropolis|tags/Apple|tags/RELEASE_29|tags/RELEASE_30|tags/checker|tags/cremebrulee)\nfetch = cfe/trunk:refs/remotes/svn/trunk\nbranches = cfe/branches/*:refs/remotes/svn/*\nbranches = cfe/branches/Apple/*:refs/remotes/svn/misc/Apple/*\nbranches = cfe/branches/Apple/Necropolis/*:refs/remotes/svn/misc/AppleNecropolis/*\nbranches = cfe/branches/ggreif/*:refs/remotes/svn/misc/ggreif/*\ntags = cfe/tags/*:refs/remotes/svn/tags/*\ntags = cfe/tags/Apple/*:refs/remotes/svn/tags2/Apple/*\ntags = cfe/tags/RELEASE_29/*:refs/remotes/svn/tags2/RELEASE_29/*\ntags = cfe/tags/RELEASE_30/*:refs/remotes/svn/tags2/RELEASE_30/*\ntags = cfe/tags/checker/*:refs/remotes/svn/tags2/checker/*\ntags = cfe/tags/cremebrulee/*:refs/remotes/svn/tags2/cremebrulee/*\n\n\n\nOn Mar 29, 2012, at 6:47 AM, Daniel Pocock <daniel@pocock.com.au> wrote:\n\n> \n> \n> \n> I'm trying to use git-svn to clone a repo that has sub-branches and sub-tags\n> \n> The SVN layout is like this:\n> \n> branches/user1/workitem1\n> branches/user1/workitem2\n> branches/user2/workitem1\n> branches/user2/workitem2\n> \n> tags/v1.0\n> tags/v1.1\n> tags/debian/v1.0-1\n> tags/debian/v1.1-1\n> tags/debian/v1.1-2\n> \n> In git, I would like to have branches with the same names, e.g.\n> \n> branches/user1/workitem1\n> branches/user1/workitem2\n> branches/user2/workitem1\n> branches/user2/workitem2\n> \n> and tags like this:\n> \n> 1.0  (notice I don't want to keep the v1.0, drop the v)\n> 1.1\n> debian/1.0-1\n> debian/1.1-1\n> debian/1.1-2\n> \n> However, if I run\n> \n> git svn clone \\\n>  -T trunk \\\n>  -t tags \\\n>  -b branches \\\n>  https://flactag.svn.sourceforge.net/svnroot/flactag \\\n>  flactag-git1\n> \n> I don't get any of the branches or tags, and I get numerous warnings like this:\n> \n> W: -empty_dir: branches/d_pocock/autotools/HTTPFetch.cc\n> W: -empty_dir: branches/d_pocock/autotools/HTTPFetch.h\n> W: Cannot find common ancestor between f475b655c10b55b36df8376a396c0d9534418617 and 7e277bfd626a1caa84681e93a7af73e0160eb2eb. Ignoring merge info.\n> W: Cannot find common ancestor between f475b655c10b55b36df8376a396c0d9534418617 and a82cd9bd2197a89303558af9aad43fa0c23d1ddb. Ignoring merge info.\n> \n> I have the impression that git-svn does not like the repository layout, and it is not clear from the manual page how to make it work.  Can anyone share any advice about this?\n> \n> \n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"188067","messageId":"CALkWK0mn=vWexhYMNPV5iKf-hX5gTHYjOS4o+E1mFjUtL49hmg@mail.gmail.com","threadId":"30097","inReplyTo":"4F7467E1.3090004@pocock.com.au","subject":"Re: git-svn: cloning an SVN repo with sub-branches and sub-tags","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2012-03-29T15:32:05Z","receivedAt":"2012-03-29T15:32:05Z","isPatch":false,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Daniel,\n\nDaniel Pocock wrote:\n> git svn clone \\\n>  -T trunk \\\n>  -t tags \\\n>  -b branches \\\n>  https://flactag.svn.sourceforge.net/svnroot/flactag \\\n>  flactag-git1\n>\n> I don't get any of the branches or tags, and I get numerous warnings like\n> this:\n>\n> W: -empty_dir: branches/d_pocock/autotools/HTTPFetch.cc\n> W: -empty_dir: branches/d_pocock/autotools/HTTPFetch.h\n> W: Cannot find common ancestor between\n> f475b655c10b55b36df8376a396c0d9534418617 and\n> 7e277bfd626a1caa84681e93a7af73e0160eb2eb. Ignoring merge info.\n> W: Cannot find common ancestor between\n> f475b655c10b55b36df8376a396c0d9534418617 and\n> a82cd9bd2197a89303558af9aad43fa0c23d1ddb. Ignoring merge info.\n\nThese look like genuine warnings; git-svn probably doesn't like your\nrepository (nested branches/ tags, missing mergeinfo etc)\n\n> I have the impression that git-svn does not like the repository layout, and\n> it is not clear from the manual page how to make it work.  Can anyone share\n> any advice about this?\n\nOff the top of my head, you could try doing two things:\n1. Try exporting the branches and tags by hand one-by-one.\n2. You could try using reposurgeon [1] to fix the repository.\n\n[1]: http://esr.ibiblio.org/?p=4071\n\n    Ram\n"},{"id":"188068","messageId":"nngbonfz9hy.fsf@transit.us.cray.com","threadId":"30097","inReplyTo":"4F7467E1.3090004@pocock.com.au","subject":"Re: git-svn: cloning an SVN repo with sub-branches and sub-tags","fromName":"","fromEmail":"dag@cray.com","sentAt":"2012-03-29T15:56:25Z","receivedAt":"2012-03-29T15:56:25Z","isPatch":false,"sender":{"key":"dag@cray.com","avatar":null},"body":"Daniel Pocock <daniel@pocock.com.au> writes:\n\n> branches/user1/workitem1\n> branches/user1/workitem2\n> branches/user2/workitem1\n> branches/user2/workitem2\n> git svn clone \\\n>   -T trunk \\\n>   -t tags \\\n>   -b branches \\\n>   https://flactag.svn.sourceforge.net/svnroot/flactag \\\n>   flactag-git1\n\nI think you need to add --branches=branches/user1/workitem1\n--branches=branches/user1/workitem1, etc.  Ditto for tags.\n\n                               -Dave\n"},{"id":"188069","messageId":"de61c3ca-6678-49da-8803-a78d9f25a3b6@mail","threadId":"30097","inReplyTo":"4F7467E1.3090004@pocock.com.au","subject":"Re: git-svn: cloning an SVN repo with sub-branches and sub-tags","fromName":"Stephen Bash","fromEmail":"bash@genarts.com","sentAt":"2012-03-29T16:03:13Z","receivedAt":"2012-03-29T16:03:13Z","isPatch":false,"sender":{"key":"bash@genarts.com","avatar":null},"body":"\n\n----- Original Message -----\n> From: \"Daniel Pocock\" <daniel@pocock.com.au>\n> To: git@vger.kernel.org\n> Sent: Thursday, March 29, 2012 9:47:13 AM\n> Subject: git-svn: cloning an SVN repo with sub-branches and sub-tags\n> \n> I'm trying to use git-svn to clone a repo that has sub-branches and\n> sub-tags\n> \n> The SVN layout is like this:\n> \n> branches/user1/workitem1\n> branches/user1/workitem2\n> branches/user2/workitem1\n> branches/user2/workitem2\n> \n> tags/v1.0\n> tags/v1.1\n> tags/debian/v1.0-1\n> tags/debian/v1.1-1\n> tags/debian/v1.1-2\n> \n> In git, I would like to have branches with the same names, e.g.\n> \n> branches/user1/workitem1\n> branches/user1/workitem2\n> branches/user2/workitem1\n> branches/user2/workitem2\n> \n> and tags like this:\n> \n> 1.0  (notice I don't want to keep the v1.0, drop the v)\n> 1.1\n> debian/1.0-1\n> debian/1.1-1\n> debian/1.1-2\n> \n> However, if I run\n> \n> git svn clone \\\n>    -T trunk \\\n>    -t tags \\\n>    -b branches \\\n>    https://flactag.svn.sourceforge.net/svnroot/flactag \\\n>    flactag-git1\n> \n> I don't get any of the branches or tags, and I get numerous warnings\n> like this:\n> \n> W: -empty_dir: branches/d_pocock/autotools/HTTPFetch.cc\n> W: -empty_dir: branches/d_pocock/autotools/HTTPFetch.h\n> W: Cannot find common ancestor between\n> f475b655c10b55b36df8376a396c0d9534418617 and\n> 7e277bfd626a1caa84681e93a7af73e0160eb2eb. Ignoring merge info.\n> W: Cannot find common ancestor between\n> f475b655c10b55b36df8376a396c0d9534418617 and\n> a82cd9bd2197a89303558af9aad43fa0c23d1ddb. Ignoring merge info.\n> \n> I have the impression that git-svn does not like the repository\n> layout and it is not clear from the manual page how to make it \n> work.  Can anyone share any advice about this?\n\nComplicated layouts can require a special git-svn configuration.  See the configuration section at the end of the git-svn manpage:\n\n  http://schacon.github.com/git/git-svn.html\n\nMy usual work flow is:\n\n  git svn init /path/to/git/repo\n  cd /path/to/git/repo\n  edit .git/config\n  git svn fetch\n\nIn the [svn-remote] section of Git config you can have multiple fetch, branches, and tag entries as long as each entry maps to a unique Git ref.\n\nHTH,\nStephen\n"},{"id":"188150","messageId":"4F75A413.409@pocock.com.au","threadId":"30097","inReplyTo":"92FA9CF9-7E8E-4DE6-8524-030A0AD33C9E@apple.com","subject":"Re: git-svn: cloning an SVN repo with sub-branches and sub-tags","fromName":"Daniel Pocock","fromEmail":"daniel@pocock.com.au","sentAt":"2012-03-30T12:16:19Z","receivedAt":"2012-03-30T12:16:19Z","isPatch":false,"sender":{"key":"daniel@pocock.com.au","avatar":null},"body":"On 29/03/2012 15:40, Dave Zarzycki wrote:\n> You can make this work, but it is very fragile, doesn't scale well, and it only works on recent versions of git. For example, from the LLVM clang project:\n\n...\n\n> branches = cfe/branches/Apple/*:refs/remotes/svn/misc/Apple/*\n> branches = cfe/branches/Apple/Necropolis/*:refs/remotes/svn/misc/AppleNecropolis/*\n\n\nIn the first line, (Apple/*), can it accidentally think that Necropolis \nis a branch, when it actually appears to be a directory containing branches?\n\nOr does it consider all the lines in the file together?\n"},{"id":"188151","messageId":"4F75A571.2020304@pocock.com.au","threadId":"30097","inReplyTo":"CALkWK0mn=vWexhYMNPV5iKf-hX5gTHYjOS4o+E1mFjUtL49hmg@mail.gmail.com","subject":"Re: git-svn: cloning an SVN repo with sub-branches and sub-tags","fromName":"Daniel Pocock","fromEmail":"daniel@pocock.com.au","sentAt":"2012-03-30T12:22:09Z","receivedAt":"2012-03-30T12:22:09Z","isPatch":false,"sender":{"key":"daniel@pocock.com.au","avatar":null},"body":"On 29/03/2012 16:32, Ramkumar Ramachandra wrote:\n> Hi Daniel,\n>\n> Daniel Pocock wrote:\n>> git svn clone \\\n>>   -T trunk \\\n>>   -t tags \\\n>>   -b branches \\\n>>   https://flactag.svn.sourceforge.net/svnroot/flactag \\\n>>   flactag-git1\n>>\n>> I don't get any of the branches or tags, and I get numerous warnings like\n>> this:\n>>\n>> W: -empty_dir: branches/d_pocock/autotools/HTTPFetch.cc\n>> W: -empty_dir: branches/d_pocock/autotools/HTTPFetch.h\n>> W: Cannot find common ancestor between\n>> f475b655c10b55b36df8376a396c0d9534418617 and\n>> 7e277bfd626a1caa84681e93a7af73e0160eb2eb. Ignoring merge info.\n>> W: Cannot find common ancestor between\n>> f475b655c10b55b36df8376a396c0d9534418617 and\n>> a82cd9bd2197a89303558af9aad43fa0c23d1ddb. Ignoring merge info.\n>\n> These look like genuine warnings; git-svn probably doesn't like your\n> repository (nested branches/ tags, missing mergeinfo etc)\n>\n>> I have the impression that git-svn does not like the repository layout, and\n>> it is not clear from the manual page how to make it work.  Can anyone share\n>> any advice about this?\n>\n> Off the top of my head, you could try doing two things:\n> 1. Try exporting the branches and tags by hand one-by-one.\n> 2. You could try using reposurgeon [1] to fix the repository.\n>\n> [1]: http://esr.ibiblio.org/?p=4071\n\n\nThe flactag project is not something of a commercial nature, so we were \nreally looking at quick solutions\n\nOne other factor I didn't mention in the original email, some of the \nbranches have been renamed/moved within the SVN repo - is that a problem \nfor git-svn?\n\nOne compromise I have thought about would be just extracting trunk, and \nforgetting about the branches, and manually tagging the official \nreleases (as there were very few of them, this is quick)\n\nHowever, based on the errors/warnings, is it possible that there is any \ncorruption in the gitified version of trunk (or the history of trunk)?\n"},{"id":"188152","messageId":"CALkWK0k7eCTuDdjdABpYrecf7G4_ejcsNmeCxPKSN46406U_2g@mail.gmail.com","threadId":"30097","inReplyTo":"4F75A571.2020304@pocock.com.au","subject":"Re: git-svn: cloning an SVN repo with sub-branches and sub-tags","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2012-03-30T12:35:45Z","receivedAt":"2012-03-30T12:35:45Z","isPatch":false,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi again,\n\nDaniel Pocock wrote:\n> One other factor I didn't mention in the original email, some of the\n> branches have been renamed/moved within the SVN repo - is that a problem for\n> git-svn?\n\nYes, I think so.\n\n> One compromise I have thought about would be just extracting trunk, and\n> forgetting about the branches, and manually tagging the official releases\n> (as there were very few of them, this is quick)\n\nJust use contrib/svn-fe in that case: it's really quick and\nlightweight.  You can then filter-branch the history and pull out\nbranches by hand.\n\n> However, based on the errors/warnings, is it possible that there is any\n> corruption in the gitified version of trunk (or the history of trunk)?\n\nNo corruption is possible on the Git side of things- it has\ncryptographic hashes for everything.\n\n    Ram\n"},{"id":"188178","messageId":"A3CEE238-4A0F-4335-BC81-BB90885938BF@apple.com","threadId":"30097","inReplyTo":"4F75A413.409@pocock.com.au","subject":"Re: git-svn: cloning an SVN repo with sub-branches and sub-tags","fromName":"Dave Zarzycki","fromEmail":"zarzycki@apple.com","sentAt":"2012-03-30T16:20:11Z","receivedAt":"2012-03-30T16:20:11Z","isPatch":false,"sender":{"key":"zarzycki@apple.com","avatar":"https://avatars.githubusercontent.com/u/1071982?v=4"},"body":"\nOn Mar 30, 2012, at 5:16 AM, Daniel Pocock <daniel@pocock.com.au> wrote:\n\n> On 29/03/2012 15:40, Dave Zarzycki wrote:\n>> You can make this work, but it is very fragile, doesn't scale well, and it only works on recent versions of git. For example, from the LLVM clang project:\n> \n> ...\n> \n>> branches = cfe/branches/Apple/*:refs/remotes/svn/misc/Apple/*\n>> branches = cfe/branches/Apple/Necropolis/*:refs/remotes/svn/misc/AppleNecropolis/*\n> \n> \n> In the first line, (Apple/*), can it accidentally think that Necropolis is a branch, when it actually appears to be a directory containing branches?\n\nCorrect.\n\n> Or does it consider all the lines in the file together?\n\nIt does not. That is why the \"ignore-refs\" setting is necessary. The \"ignore-refs\" setting tells git that \"Necropolis\" etc are not valid branches (because they are SVN subdirectories). The \"ignore-refs\" setting is useful for working around other SVN user errors too.\n\ndavez\n"}]}