{"thread":{"id":"25560","subject":"svn repository URL and git","startedAt":"2010-10-27T15:05:51Z","lastAt":"2010-10-29T03:07:36Z","messageCount":8,"participants":["H Krishnan","Mathias Lafeldt","Ulrich Spörlein"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"154538","messageId":"loom.20101027T170254-268@post.gmane.org","threadId":"25560","inReplyTo":null,"subject":"svn repository URL and git","fromName":"H Krishnan","fromEmail":"hetchkay@gmail.com","sentAt":"2010-10-27T15:05:51Z","receivedAt":"2010-10-27T15:05:51Z","isPatch":false,"sender":{"key":"hetchkay@gmail.com","avatar":null},"body":"Hi, \nWe have started using git and git-svn. \nI was thrilled to see that two people cloning using \"git svn clone\" \nfrom the same repository got the same sha1 IDs for the commits which \nmeant that each of us could sync with svn independently while still \nbeing able to share code among ourselves. \nBut my excitement was shortlived as the sha1 IDs were different if we \nrefer to the svn server using an alias. For example, using \nhttp://mysvnserver.mydomain.com/repos/myproject/trunk gave different \nsha1 IDs from using http://mysvnserver/repos/myproject/trunk even \nthough both refer to the same repository. This also disallowed using \nmirrors of the repository for cloning. \nApparently the sha1 ID is generated from the full path of the URL. \nInstead of this, could git-svn init be made to accept an optional \n\"prefix\" argument as well which is filtered out of the URL before \nbuilding the sha1 ID. This will allow easy support for the oft \nrequested support for \"svn switch --relocate\". How much of an effort \nis this? I don't know perl or git internals well enough for me to take \na stab at it but I am willing to learn if someone can give me some \npointers. \nKrishnan\n"},{"id":"154545","messageId":"4CC845EE.5040602@debugon.org","threadId":"25560","inReplyTo":"loom.20101027T170254-268@post.gmane.org","subject":"Re: svn repository URL and git","fromName":"Mathias Lafeldt","fromEmail":"misfire@debugon.org","sentAt":"2010-10-27T15:31:58Z","receivedAt":"2010-10-27T15:31:58Z","isPatch":false,"sender":{"key":"misfire@debugon.org","avatar":"https://avatars.githubusercontent.com/u/158074?v=4"},"body":"H Krishnan wrote:\n> Hi, \n> We have started using git and git-svn. \n> I was thrilled to see that two people cloning using \"git svn clone\" \n> from the same repository got the same sha1 IDs for the commits which \n> meant that each of us could sync with svn independently while still \n> being able to share code among ourselves. \n> But my excitement was shortlived as the sha1 IDs were different if we \n> refer to the svn server using an alias. For example, using \n> http://mysvnserver.mydomain.com/repos/myproject/trunk gave different \n> sha1 IDs from using http://mysvnserver/repos/myproject/trunk even \n> though both refer to the same repository. This also disallowed using \n> mirrors of the repository for cloning. \n> Apparently the sha1 ID is generated from the full path of the URL. \n> Instead of this, could git-svn init be made to accept an optional \n> \"prefix\" argument as well which is filtered out of the URL before \n> building the sha1 ID. This will allow easy support for the oft \n> requested support for \"svn switch --relocate\". How much of an effort \n> is this? I don't know perl or git internals well enough for me to take \n> a stab at it but I am willing to learn if someone can give me some \n> pointers. \n> Krishnan\n\nThe problem is the \"git-svn-id\" which is automatically appended to each\ncommit done with git-svn. This ID consists of the URL and the UUID of\nthe corresponding SVN repository. A different git-svn-id value results\nin a different commit SHA1 (i.e. a different commit to git).\n\nI guess git-svn's --rewrite-root option might help here. Also, you have\nto make sure that your SVN repos have the same UUID (with svnadmin\nsetuuid), of course.\n\n-Mathias\n"},{"id":"154549","messageId":"loom.20101027T180316-38@post.gmane.org","threadId":"25560","inReplyTo":"4CC845EE.5040602@debugon.org","subject":"Re: svn repository URL and git","fromName":"H Krishnan","fromEmail":"hetchkay@gmail.com","sentAt":"2010-10-27T16:15:22Z","receivedAt":"2010-10-27T16:15:22Z","isPatch":false,"sender":{"key":"hetchkay@gmail.com","avatar":null},"body":"\n> \n> H Krishnan wrote:\n> > Hi, \n> > We have started using git and git-svn. \n> > I was thrilled to see that two people cloning using \"git svn clone\" \n> > from the same repository got the same sha1 IDs for the commits which \n> > meant that each of us could sync with svn independently while still \n> > being able to share code among ourselves. \n> > But my excitement was shortlived as the sha1 IDs were different if we \n> > refer to the svn server using an alias. For example, using \n> > http://mysvnserver.mydomain.com/repos/myproject/trunk gave different \n> > sha1 IDs from using http://mysvnserver/repos/myproject/trunk even \n> > though both refer to the same repository. This also disallowed using \n> > mirrors of the repository for cloning. \n> > Apparently the sha1 ID is generated from the full path of the URL. \n> > Instead of this, could git-svn init be made to accept an optional \n> > \"prefix\" argument as well which is filtered out of the URL before \n> > building the sha1 ID. This will allow easy support for the oft \n> > requested support for \"svn switch --relocate\". How much of an effort \n> > is this? I don't know perl or git internals well enough for me to take \n> > a stab at it but I am willing to learn if someone can give me some \n> > pointers. \n> > Krishnan\n> \n> The problem is the \"git-svn-id\" which is automatically appended to each\n> commit done with git-svn. This ID consists of the URL and the UUID of\n> the corresponding SVN repository. A different git-svn-id value results\n> in a different commit SHA1 (i.e. a different commit to git).\n> \n> I guess git-svn's --rewrite-root option might help here. Also, you have\n> to make sure that your SVN repos have the same UUID (with svnadmin\n> setuuid), of course.\n> \n> -Mathias\n> \n\nThanks for your quick reply.\n\nCould the git-svn-id also be based on only the suffix part of the URL? The \nprefix needs to be used only when connecting to the svn server and not \notherwise. By default, the prefix is empty thereby getting back the current \nbehavior.\n\nI did try --rewrite-root but from what I understood of it, git-svn rebase will \nhappen with the root I supply here and not from the local mirrors. We would like \nsomething like the following:\n\n  users in place A  <--git-svn--> SVN mirror in place A\n        ^                                 ^\n        |                                 |\n     git fetch/merge              some sort of rsync\n        |                                 |\n        v                                 v\n  users in place B  <--git-svn--> SVN mirror in place B\n\nOur corporate setup will not easily move to git but some sub-teams would like to \nuse it for their work.\n\nRegards,\nKrishnan\n"},{"id":"154640","messageId":"loom.20101028T184823-831@post.gmane.org","threadId":"25560","inReplyTo":"loom.20101027T180316-38@post.gmane.org","subject":"Re: svn repository URL and git","fromName":"H Krishnan","fromEmail":"hetchkay@gmail.com","sentAt":"2010-10-28T16:58:28Z","receivedAt":"2010-10-28T16:58:28Z","isPatch":false,"sender":{"key":"hetchkay@gmail.com","avatar":null},"body":"\nHi,\nI think I resolved this problem by using --rewrite-root as suggested. I used a \ndummy root during the git-svn clone:\n\ngit-svn clone --rewrite-root http://git.is.great <myrepo>\n\nAll my commit messages now have http://git.is.great but I am able to change the \nrepository URL and continue.\n\nCould this approach be used as an insurance against svn url changes? When \ninitializing the repository, we could use --rewrite-root. Subsequently, if the \nsvn repository relocates, we need to edit only .git/config. \n\nThanks for your help.\n\nKrishnan\n"},{"id":"154663","messageId":"20101028190227.GC46314@acme.spoerlein.net","threadId":"25560","inReplyTo":"loom.20101028T184823-831@post.gmane.org","subject":"Re: svn repository URL and git","fromName":"Ulrich Spörlein","fromEmail":"uqs@spoerlein.net","sentAt":"2010-10-28T19:02:27Z","receivedAt":"2010-10-28T19:02:27Z","isPatch":false,"sender":{"key":"uqs@spoerlein.net","avatar":null},"body":"On Thu, 28.10.2010 at 16:58:28 +0000, H Krishnan wrote:\n> \n> Hi,\n> I think I resolved this problem by using --rewrite-root as suggested. I used a \n> dummy root during the git-svn clone:\n> \n> git-svn clone --rewrite-root http://git.is.great <myrepo>\n> \n> All my commit messages now have http://git.is.great but I am able to change the \n> repository URL and continue.\n> \n> Could this approach be used as an insurance against svn url changes? When \n> initializing the repository, we could use --rewrite-root. Subsequently, if the \n> svn repository relocates, we need to edit only .git/config. \n\nYes, that's exactly what the rewrite-url was introduced for, you can\neven clone from a local svnsync mirror (iff the UUID matches, you have\nto setup the mirror in a special way ...).\n\nSo, every developer must use:\n\n$ git svn clone --rewrite-root CANONICAL-URL-NEVER-TO-CHANGE <whatever-url-is-convenient>\n\nOh, and all devs must use the same authormap (or no authormap at all).\n\nhth,\nUli\n"},{"id":"154665","messageId":"4CC9CF86.7040307@debugon.org","threadId":"25560","inReplyTo":"20101028190227.GC46314@acme.spoerlein.net","subject":"Re: svn repository URL and git","fromName":"Mathias Lafeldt","fromEmail":"misfire@debugon.org","sentAt":"2010-10-28T19:31:18Z","receivedAt":"2010-10-28T19:31:18Z","isPatch":false,"sender":{"key":"misfire@debugon.org","avatar":"https://avatars.githubusercontent.com/u/158074?v=4"},"body":"On 10/28/2010 09:02 PM, Ulrich Spörlein wrote:\n> On Thu, 28.10.2010 at 16:58:28 +0000, H Krishnan wrote:\n>>\n>> Hi,\n>> I think I resolved this problem by using --rewrite-root as suggested. I used a \n>> dummy root during the git-svn clone:\n>>\n>> git-svn clone --rewrite-root http://git.is.great <myrepo>\n>>\n>> All my commit messages now have http://git.is.great but I am able to change the \n>> repository URL and continue.\n>>\n>> Could this approach be used as an insurance against svn url changes? When \n>> initializing the repository, we could use --rewrite-root. Subsequently, if the \n>> svn repository relocates, we need to edit only .git/config. \n> \n> Yes, that's exactly what the rewrite-url was introduced for, you can\n> even clone from a local svnsync mirror (iff the UUID matches, you have\n> to setup the mirror in a special way ...).\n> \n> So, every developer must use:\n> \n> $ git svn clone --rewrite-root CANONICAL-URL-NEVER-TO-CHANGE <whatever-url-is-convenient>\n> \n> Oh, and all devs must use the same authormap (or no authormap at all).\n> \n> hth,\n> Uli\n\nFYI, I just learned [1] that git-svn even has a --rewrite-uuid option.\n\n[1] http://www.kernel.org/pub/software/scm/git/docs/git-svn.html\n\n-Mathias\n"},{"id":"154666","messageId":"20101028193729.GD46314@acme.spoerlein.net","threadId":"25560","inReplyTo":"4CC9CF86.7040307@debugon.org","subject":"Re: svn repository URL and git","fromName":"Ulrich Spörlein","fromEmail":"uqs@spoerlein.net","sentAt":"2010-10-28T19:37:29Z","receivedAt":"2010-10-28T19:37:29Z","isPatch":false,"sender":{"key":"uqs@spoerlein.net","avatar":null},"body":"On Thu, 28.10.2010 at 21:31:18 +0200, Mathias Lafeldt wrote:\n> On 10/28/2010 09:02 PM, Ulrich Spörlein wrote:\n> > On Thu, 28.10.2010 at 16:58:28 +0000, H Krishnan wrote:\n> >>\n> >> Hi,\n> >> I think I resolved this problem by using --rewrite-root as suggested. I used a \n> >> dummy root during the git-svn clone:\n> >>\n> >> git-svn clone --rewrite-root http://git.is.great <myrepo>\n> >>\n> >> All my commit messages now have http://git.is.great but I am able to change the \n> >> repository URL and continue.\n> >>\n> >> Could this approach be used as an insurance against svn url changes? When \n> >> initializing the repository, we could use --rewrite-root. Subsequently, if the \n> >> svn repository relocates, we need to edit only .git/config. \n> > \n> > Yes, that's exactly what the rewrite-url was introduced for, you can\n> > even clone from a local svnsync mirror (iff the UUID matches, you have\n> > to setup the mirror in a special way ...).\n> > \n> > So, every developer must use:\n> > \n> > $ git svn clone --rewrite-root CANONICAL-URL-NEVER-TO-CHANGE <whatever-url-is-convenient>\n> > \n> > Oh, and all devs must use the same authormap (or no authormap at all).\n> > \n> > hth,\n> > Uli\n> \n> FYI, I just learned [1] that git-svn even has a --rewrite-uuid option.\n> \n> [1] http://www.kernel.org/pub/software/scm/git/docs/git-svn.html\n\nTry using them both at the same time! :]\n\n(No, I have no idea, why that is not supported ... OTOH having the same\nUUID on the mirror is a kinda no-brainer)\n\nUli\n"},{"id":"154715","messageId":"loom.20101029T045420-973@post.gmane.org","threadId":"25560","inReplyTo":"4CC9CF86.7040307@debugon.org","subject":"Re: svn repository URL and git","fromName":"H Krishnan","fromEmail":"hetchkay@gmail.com","sentAt":"2010-10-29T03:07:36Z","receivedAt":"2010-10-29T03:07:36Z","isPatch":false,"sender":{"key":"hetchkay@gmail.com","avatar":null},"body":"Hi,\nWould the following approach for svn switch --relocate \n(even for current git clones):\n\n1)If svn-remote.svn.rewriteRoot does not exist in config file:\n    git config svn-remote.svn.rewriteRoot <currentRepository>\n\n2)If svn-remote.svn.rewriteUUID does not exist in config file:\n    git config svn-remote.svn.rewriteUUID <currentRepositoryUUID>\n \n  currentRepositoryUUID can be obtained from .git/svn/metadata\n\n3) git config svn-remote.svn.url <newRepository>\n\nIf the above works, it would be much simpler than other solutions \nthat have been proposed for svn repo relocations.\n\nKrishnan\n"}]}