{"thread":{"id":"14497","subject":"git-svn: Trouble after project has moved in svn","startedAt":"2008-07-16T22:12:00Z","lastAt":"2008-07-18T18:27:48Z","messageCount":3,"participants":["Jukka Zitting","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"83606","messageId":"510143ac0807161512w44a612bcndc53713639b0b70a@mail.gmail.com","threadId":"14497","inReplyTo":null,"subject":"git-svn: Trouble after project has moved in svn","fromName":"Jukka Zitting","fromEmail":"jukka.zitting@gmail.com","sentAt":"2008-07-16T22:12:00Z","receivedAt":"2008-07-16T22:12:00Z","isPatch":false,"sender":{"key":"jukka.zitting@gmail.com","avatar":null},"body":"Hi,\n\nSomewhat related to the recent thread about Apache Synapse, I'm having\ntrouble making a git-svn clone of a project that has been moved around\nin a Subversion repository.\n\nSee the script at the end of this message for a simple test case that\ndoes the following svn commits:\n\n    PREPARE: creates projectA with the standard trunk,branches,tags structure\n    VERSION1: first version of README.txt in projectA/trunk\n    TAG1: tags projectA/trunk to projectA/tags/v1\n    MOVE: moves projectA to projectB\n    VERSION2: second version of README.txt in projectB/trunk\n    TAG2: tags projectB/trunk to projectB/tags/v2\n\nThe resulting repository structure is:\n\n    /projectB/\n        trunk/\n            README.txt # version 2\n        branches/\n        tags/\n            v1/\n                README.txt # version 1\n            v2/\n                README.txt # version 2\n\nHere's the git commit graph created by the test case:\n\n    * TAG2 <- refs/remotes/tags/v2\n    | * VERSION2 <- refs/remotes/trunk\n    |/\n    * MOVE\n    * VERSION1 <- refs/remotes/trunk@3\n    | * MOVE <- refs/remotes/tags/v1\n    | * TAG1 <- refs/remotes/tags/v1@3\n    |/\n    * PREPARE <- refs/remotes/tags/v1@1\n\nThe most pressing issue is that the refs/remotes/tags/v1 branch starts\ndirectly from the first PREPARE commit instead of VERSION1. Also, the\nbranch point of refs/remotes/tags/v2 seems to be incorrect, it should\nbe based on the VERSION2 commit instead of MOVE.\n\nA more accurate commit graph would be:\n\n    * TAG2 <- refs/remotes/tags/v2\n    * VERSION2 <- refs/remotes/trunk\n    * MOVE\n    | * MOVE <- refs/remotes/tags/v1\n    | * TAG1\n    |/\n    * VERSION1\n    * PREPARE\n\nOr even (but I guess git-svn needs to map each svn commit to at least\none git commit, so this probably wouldn't work):\n\n    * VERSION2 <- refs/remotes/trunk, refs/remotes/tags/v2\n    * VERSION1 <- refs/remotes/tags/v1\n    * PREPARE\n\nI tried working my way through git-svn.perl to figure out how to\nimprove the way git-svn tracks svn moves, but so far I couldn't figure\nout how to do that. Any ideas or hints?\n\nBR,\n\nJukka Zitting\n\n=====\n#!/bin/sh\n\nREPO=`pwd`/repo\nsvnadmin create $REPO\n\nsvn checkout file://$REPO checkout\ncd checkout\n\nsvn mkdir projectA\nsvn mkdir projectA/trunk\nsvn mkdir projectA/branches\nsvn mkdir projectA/tags\nsvn commit -m PREPARE\n\necho VERSION1 > projectA/trunk/README.txt\nsvn add projectA/trunk/README.txt\nsvn commit -m VERSION1\n\nsvn copy projectA/trunk projectA/tags/v1\nsvn commit -m TAG1\nsvn update\n\nsvn move projectA projectB\nsvn commit -m MOVE\n\necho VERSION2 > projectB/trunk/README.txt\nsvn commit -m VERSION2\n\nsvn copy projectB/trunk projectB/tags/v2\nsvn commit -m TAG2\nsvn update\n\nmkdir ../git\ncd ../git\n\ngit svn init -s file://$REPO/projectB\ngit svn fetch\n"},{"id":"83655","messageId":"487F090B.3080800@fastmail.fm","threadId":"14497","inReplyTo":"510143ac0807161512w44a612bcndc53713639b0b70a@mail.gmail.com","subject":"Re: git-svn: Trouble after project has moved in svn","fromName":"Michael J Gruber","fromEmail":"michaeljgruber+gmane@fastmail.fm","sentAt":"2008-07-17T08:55:39Z","receivedAt":"2008-07-17T08:55:39Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Jukka Zitting venit, vidit, dixit 17.07.2008 00:12:\n> Hi,\n> \n> Somewhat related to the recent thread about Apache Synapse, I'm having\n> trouble making a git-svn clone of a project that has been moved around\n> in a Subversion repository.\n> \n> See the script at the end of this message for a simple test case that\n> does the following svn commits:\n> \n>     PREPARE: creates projectA with the standard trunk,branches,tags structure\n>     VERSION1: first version of README.txt in projectA/trunk\n>     TAG1: tags projectA/trunk to projectA/tags/v1\n>     MOVE: moves projectA to projectB\n>     VERSION2: second version of README.txt in projectB/trunk\n>     TAG2: tags projectB/trunk to projectB/tags/v2\n> \n> The resulting repository structure is:\n> \n>     /projectB/\n>         trunk/\n>             README.txt # version 2\n>         branches/\n>         tags/\n>             v1/\n>                 README.txt # version 1\n>             v2/\n>                 README.txt # version 2\n> \n> Here's the git commit graph created by the test case:\n> \n>     * TAG2 <- refs/remotes/tags/v2\n>     | * VERSION2 <- refs/remotes/trunk\n>     |/\n>     * MOVE\n>     * VERSION1 <- refs/remotes/trunk@3\n>     | * MOVE <- refs/remotes/tags/v1\n>     | * TAG1 <- refs/remotes/tags/v1@3\n>     |/\n>     * PREPARE <- refs/remotes/tags/v1@1\n> \n> The most pressing issue is that the refs/remotes/tags/v1 branch starts\n> directly from the first PREPARE commit instead of VERSION1. Also, the\n> branch point of refs/remotes/tags/v2 seems to be incorrect, it should\n> be based on the VERSION2 commit instead of MOVE.\n\nIn the script below, you use copies inside your svn working copy for \ntagging, which is generally a bad idea: it stores the exact state of \nyour wc as a \"tag\". Use this for creating \"mixed states\", but not for \nordinary tagging (or make sure you svn up). See the detailed comments below.\n\nIf you want to create an svn tag (as far as svn has tags at all) use \nrepo urls, or make sure your wc is up to date.\n\n> =====\n> #!/bin/sh\n> \n> REPO=`pwd`/repo\n> svnadmin create $REPO\n> \n> svn checkout file://$REPO checkout\n> cd checkout\n> \n> svn mkdir projectA\n> svn mkdir projectA/trunk\n> svn mkdir projectA/branches\n> svn mkdir projectA/tags\n> svn commit -m PREPARE\n> \n> echo VERSION1 > projectA/trunk/README.txt\n> svn add projectA/trunk/README.txt\n> svn commit -m VERSION1\n\nNow, README.txt is at r2, but trunk is still at r1.\nUse \"svn update\" here to get trunk to r2!\n\n> svn copy projectA/trunk projectA/tags/v1\n\nThis copies r1 of trunk to the tags dir (unless you've inserted svn up \nabove)!\n\n> svn commit -m TAG1\n> svn update\n> \n> svn move projectA projectB\n> svn commit -m MOVE\n> \n> echo VERSION2 > projectB/trunk/README.txt\n> svn commit -m VERSION2\n\nNow, README.txt is at r5, but trunk is at r4.\n\"svn update\"!\n\n> svn copy projectB/trunk projectB/tags/v2\n\nThis tags (copies to tags/) r4 of trunk\n\n> svn commit -m TAG2\n> svn update\n\nThis produces r6: the tagging.\n\n> \n> mkdir ../git\n> cd ../git\n> \n> git svn init -s file://$REPO/projectB\n> git svn fetch\n\nThe results perfectly as expected. Compare \"svn log -v\" with git-svn's \nresults, and you'll see that git (tag) branches fork off exactly at the \nrevisions which you tagged in svn. Because the last commit occurs on \ntags/v2, git-svn checks out that branch as master, the supposedly \n\"active\" branch.\n\nIf you insert the two missing \"svn update\" commands which bring your wc \nup to date before tagging your git-svn results will be what you expected.\n\nCheers,\nMichael\n"},{"id":"83905","messageId":"510143ac0807181127y62b16ef1jf62e00bfc6c854ea@mail.gmail.com","threadId":"14497","inReplyTo":"510143ac0807161512w44a612bcndc53713639b0b70a@mail.gmail.com","subject":"Re: git-svn: Trouble after project has moved in svn","fromName":"Jukka Zitting","fromEmail":"jukka.zitting@gmail.com","sentAt":"2008-07-18T18:27:48Z","receivedAt":"2008-07-18T18:27:48Z","isPatch":false,"sender":{"key":"jukka.zitting@gmail.com","avatar":null},"body":"Hi,\n\nOn Thu, Jul 17, 2008 at 1:12 AM, Jukka Zitting <jukka.zitting@gmail.com> wrote:\n> Somewhat related to the recent thread about Apache Synapse, I'm having\n> trouble making a git-svn clone of a project that has been moved around\n> in a Subversion repository.\n\nAh, silly me, my test script was broken. Thanks to Michael J. Gruber\nfor pointing out that I should have used created the tags using svn\nURLs instead of working copy path or at least done an \"svn update\"\nbefore tagging. After fixing my test script the git-svn result was\nexactly as I was hoping to see.\n\nI think that covers my last barrier for creating experimental git\nmirrors of various Apache codebases. Check out\nhttp://mail-archives.apache.org/mod_mbox/www-infrastructure-dev/ for\nmore on git experiments at Apache.\n\nBR,\n\nJukka Zitting\n"}]}