{"thread":{"id":"8396","subject":"How to use git-svn to clone from a mirror?","startedAt":"2007-06-02T12:54:40Z","lastAt":"2007-06-05T10:41:01Z","messageCount":6,"participants":["David Kastrup","Raja R Harinath","Jan Hudec","Johannes Schindelin","Eric Wong"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"43802","messageId":"86hcpq8qjz.fsf@lola.quinscape.zz","threadId":"8396","inReplyTo":null,"subject":"How to use git-svn to clone from a mirror?","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-06-02T12:54:40Z","receivedAt":"2007-06-02T12:54:40Z","isPatch":false,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"\nHi, I seem to be too stupid to get this right.\n\nI have used something like\n\ngit-svn clone -T trunk -b branches -t tags file:///tmp/rsync-mirror\n\nto clone an rsync mirror of an SVN repository.  Now I want to have\nfetch revert to pulling from the upstream repository in future.\nHowever, if I change the respective line in .git/config to\nsvn://the.svn.link/whatever, git-rebase will fetch the right updates,\nbut then says that it can't work with the objects in the git\nrepository.\n\nChanging the config back will make git-rebase -l work.\n\nSo what would be the right procedure to shift the SVN source from an\nrsync mirror to the original, without git-svn breaking?\n\n-- \nDavid Kastrup\n"},{"id":"43980","messageId":"85myzfsqji.fsf@blr-RHarinath.blr.novell.com","threadId":"8396","inReplyTo":"86hcpq8qjz.fsf@lola.quinscape.zz","subject":"Re: How to use git-svn to clone from a mirror?","fromName":"Raja R Harinath","fromEmail":"rharinath@novell.com","sentAt":"2007-06-04T15:11:29Z","receivedAt":"2007-06-04T15:11:29Z","isPatch":false,"sender":{"key":"rharinath@novell.com","avatar":null},"body":"Hi,\n\nDavid Kastrup <dak@gnu.org> writes:\n\n> Hi, I seem to be too stupid to get this right.\n>\n> I have used something like\n>\n> git-svn clone -T trunk -b branches -t tags file:///tmp/rsync-mirror\n>\n> to clone an rsync mirror of an SVN repository.  Now I want to have\n> fetch revert to pulling from the upstream repository in future.\n> However, if I change the respective line in .git/config to\n> svn://the.svn.link/whatever, git-rebase will fetch the right updates,\n> but then says that it can't work with the objects in the git\n> repository.\n>\n> Changing the config back will make git-rebase -l work.\n>\n> So what would be the right procedure to shift the SVN source from an\n> rsync mirror to the original, without git-svn breaking?\n\nI think you'll have to\n\n-------------8<------------\n  # remove stored revision db, since we're going to change all the commit ids\n  rm .git/svn/git-svn/.rev_db.*\n\n  # rewrite git-svn-id: lines\n  cg-admin-rewritehist \\\n\t--msg-filter \\\n\t'sed \"s,file:///tmp/rsync-mirror,svn://the.svn.link/whatever,\"'\n\n  # recreate new revision db, and fetch updates, if any\n  git-svn rebase\n-------------8<------------\n\n- Hari\n"},{"id":"43991","messageId":"20070604165554.GC3299@efreet.light.src","threadId":"8396","inReplyTo":"85myzfsqji.fsf@blr-RHarinath.blr.novell.com","subject":"Does git-svn-id need repository path? (Re: How to use git-svn to clone from a mirror?)","fromName":"Jan Hudec","fromEmail":"bulb@ucw.cz","sentAt":"2007-06-04T16:55:54Z","receivedAt":"2007-06-04T16:55:54Z","isPatch":false,"sender":{"key":"bulb@ucw.cz","avatar":null},"body":"On Mon, Jun 04, 2007 at 20:41:29 +0530, Raja R Harinath wrote:\n> -------------8<------------\n>   # remove stored revision db, since we're going to change all the commit ids\n>   rm .git/svn/git-svn/.rev_db.*\n> \n>   # rewrite git-svn-id: lines\n>   cg-admin-rewritehist \\\n> \t--msg-filter \\\n> \t'sed \"s,file:///tmp/rsync-mirror,svn://the.svn.link/whatever,\"'\n> \n>   # recreate new revision db, and fetch updates, if any\n>   git-svn rebase\n> -------------8<------------\n\nWhich leads me to a question. Should the url really be part of the\ngit-svn-id? A subversion repository is uniquely identified by it's uuid, so\nthe uuid + revno is a good identifier. Is it possible to change that now, or\nis it necessary to keep the format now for backward compatibility?\n\n-- \n\t\t\t\t\t\t Jan 'Bulb' Hudec <bulb@ucw.cz>\n"},{"id":"43998","messageId":"Pine.LNX.4.64.0706041906570.4046@racer.site","threadId":"8396","inReplyTo":"85myzfsqji.fsf@blr-RHarinath.blr.novell.com","subject":"Re: How to use git-svn to clone from a mirror?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-06-04T18:08:00Z","receivedAt":"2007-06-04T18:08:00Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 4 Jun 2007, Raja R Harinath wrote:\n\n> David Kastrup <dak@gnu.org> writes:\n> \n> > I have used something like\n> >\n> > git-svn clone -T trunk -b branches -t tags file:///tmp/rsync-mirror\n> >\n> > to clone an rsync mirror of an SVN repository.  Now I want to have \n> > fetch revert to pulling from the upstream repository in future. \n> > However, if I change the respective line in .git/config to \n> > svn://the.svn.link/whatever, git-rebase will fetch the right updates, \n> > but then says that it can't work with the objects in the git \n> > repository.\n> >\n> > Changing the config back will make git-rebase -l work.\n> >\n> > So what would be the right procedure to shift the SVN source from an\n> > rsync mirror to the original, without git-svn breaking?\n> \n> I think you'll have to\n> \n> -------------8<------------\n>   # remove stored revision db, since we're going to change all the commit ids\n>   rm .git/svn/git-svn/.rev_db.*\n> \n>   # rewrite git-svn-id: lines\n>   cg-admin-rewritehist \\\n> \t--msg-filter \\\n> \t'sed \"s,file:///tmp/rsync-mirror,svn://the.svn.link/whatever,\"'\n> \n>   # recreate new revision db, and fetch updates, if any\n>   git-svn rebase\n> -------------8<------------\n\n<shameless plug>\n\tOr you use the just-rewritten version of it, git-filter-branch.\n</shameless>\n\nCiao,\nDscho\n"},{"id":"44039","messageId":"86r6oqoqdd.fsf@lola.quinscape.zz","threadId":"8396","inReplyTo":"Pine.LNX.4.64.0706041906570.4046@racer.site","subject":"Re: How to use git-svn to clone from a mirror?","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-06-05T06:41:02Z","receivedAt":"2007-06-05T06:41:02Z","isPatch":false,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> On Mon, 4 Jun 2007, Raja R Harinath wrote:\n>\n>> David Kastrup <dak@gnu.org> writes:\n>> \n>> > I have used something like\n>> >\n>> > git-svn clone -T trunk -b branches -t tags file:///tmp/rsync-mirror\n>> >\n>> > to clone an rsync mirror of an SVN repository.  Now I want to have \n>> > fetch revert to pulling from the upstream repository in future. \n>> > However, if I change the respective line in .git/config to \n>> > svn://the.svn.link/whatever, git-rebase will fetch the right updates, \n>> > but then says that it can't work with the objects in the git \n>> > repository.\n>> >\n>> > Changing the config back will make git-rebase -l work.\n>> >\n>> > So what would be the right procedure to shift the SVN source from an\n>> > rsync mirror to the original, without git-svn breaking?\n>> \n>> I think you'll have to\n>> \n>> -------------8<------------\n>>   # remove stored revision db, since we're going to change all the commit ids\n>>   rm .git/svn/git-svn/.rev_db.*\n>> \n>>   # rewrite git-svn-id: lines\n>>   cg-admin-rewritehist \\\n>> \t--msg-filter \\\n>> \t'sed \"s,file:///tmp/rsync-mirror,svn://the.svn.link/whatever,\"'\n>> \n>>   # recreate new revision db, and fetch updates, if any\n>>   git-svn rebase\n>> -------------8<------------\n>\n> <shameless plug>\n> \tOr you use the just-rewritten version of it, git-filter-branch.\n> </shameless>\n\nWell, part of the reason I worked from an rsynced copy was to be able\nto repeat the experiment by just wasting a few hours of time each\ntime, without wasting more bandwidth.\n\nWhat I arrived at was to use\ngit-svn init -T trunk -t tags -b branches\n  --rewrite-root svn://tug.org/texlive file:///mirror/texlive\ngit-svn fetch --all\n[edit .git/config and replace the url and rewrite-root lines with a\n single url line pointing to the root]\ngit-reset --hard   [don't ask me why]\nand afterwards fetches worked online.\n\nI liked the commit messages when using --no-metadata better than with\n--rewrite-root, but I found no way to get the resulting archive\noperative for git-svn rebase afterwards.\n\nCould someone explain to me why git needs to know the upstream URL\nhistory, whether by --rewrite-root or rewrite-hist or\ngit-filter-branch?\n\nI find this rather hard to understand, so I would like to get an idea\nwhere this fits naturally into the overall design of git, and how it\nmakes sense.\n\nThanks,\n\n-- \nDavid Kastrup\n"},{"id":"44065","messageId":"20070605104101.GC12948@muzzle","threadId":"8396","inReplyTo":"86r6oqoqdd.fsf@lola.quinscape.zz","subject":"Re: How to use git-svn to clone from a mirror?","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-06-05T10:41:01Z","receivedAt":"2007-06-05T10:41:01Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"David Kastrup <dak@gnu.org> wrote:\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > On Mon, 4 Jun 2007, Raja R Harinath wrote:\n> >\n> >> David Kastrup <dak@gnu.org> writes:\n> >> \n> >> > I have used something like\n> >> >\n> >> > git-svn clone -T trunk -b branches -t tags file:///tmp/rsync-mirror\n> >> >\n> >> > to clone an rsync mirror of an SVN repository.  Now I want to have \n> >> > fetch revert to pulling from the upstream repository in future. \n> >> > However, if I change the respective line in .git/config to \n> >> > svn://the.svn.link/whatever, git-rebase will fetch the right updates, \n> >> > but then says that it can't work with the objects in the git \n> >> > repository.\n> >> >\n> >> > Changing the config back will make git-rebase -l work.\n> >> >\n> >> > So what would be the right procedure to shift the SVN source from an\n> >> > rsync mirror to the original, without git-svn breaking?\n> >> \n> >> I think you'll have to\n> >> \n> >> -------------8<------------\n> >>   # remove stored revision db, since we're going to change all the commit ids\n> >>   rm .git/svn/git-svn/.rev_db.*\n> >> \n> >>   # rewrite git-svn-id: lines\n> >>   cg-admin-rewritehist \\\n> >> \t--msg-filter \\\n> >> \t'sed \"s,file:///tmp/rsync-mirror,svn://the.svn.link/whatever,\"'\n> >> \n> >>   # recreate new revision db, and fetch updates, if any\n> >>   git-svn rebase\n> >> -------------8<------------\n> >\n> > <shameless plug>\n> > \tOr you use the just-rewritten version of it, git-filter-branch.\n> > </shameless>\n> \n> Well, part of the reason I worked from an rsynced copy was to be able\n> to repeat the experiment by just wasting a few hours of time each\n> time, without wasting more bandwidth.\n> \n> What I arrived at was to use\n> git-svn init -T trunk -t tags -b branches\n>   --rewrite-root svn://tug.org/texlive file:///mirror/texlive\n> git-svn fetch --all\n> [edit .git/config and replace the url and rewrite-root lines with a\n>  single url line pointing to the root]\n> git-reset --hard   [don't ask me why]\n> and afterwards fetches worked online.\n\nYes, sorry for the late response, but --rewrite-root was written\nwith this purpose in mind.\n\n> I liked the commit messages when using --no-metadata better than with\n> --rewrite-root, but I found no way to get the resulting archive\n> operative for git-svn rebase afterwards.\n\nYou should be able to use git-svn fetch and then plain git-rebase <remote>\n\n> Could someone explain to me why git needs to know the upstream URL\n> history, whether by --rewrite-root or rewrite-hist or\n> git-filter-branch?\n> \n> I find this rather hard to understand, so I would like to get an idea\n> where this fits naturally into the overall design of git, and how it\n> makes sense.\n\nHaving the git-svn-id: lines in commits allows commits to be made to the\nupstream SVN repository more easily and without user interaction or\nconfiguraton.  I put git-svn-id: in the commit objects themselves\nbecause they're immutable and robust.\n\nThe URL portion of git-svn-id: is useful when I'm using many throwaway\nbranches and I've forgotten which upstream (SVN) branch I need to\ndcommit against, and git-svn can easily figure it out for me\nwithout needing to remember to use git-checkout --track on my part\nor memorization.\n\nIt's possible to clone the refs and objects over to a new repository\nover the native git:// protocol and have it fully usable from git-svn\nwithout needing additional setup or having to copy the .git/config or\n.git/svn (neither of which are transferred over the git protocol).\nCloning the refs is a bit of a pain these days because of the \"remotes/\"\nconvention in the name, but still possible.\n\nThe .rev_db files in .git/svn can get corrupted or deleted, and since\nthey're not managed by git, they're next to impossible to recover\nif the git-svn-id: lines didn't exist.\n\nI'll be the first to admit that the git-svn-id: lines are ugly, but\nthat's why I wrote \"git svn log\" :)\n\n-- \nEric Wong\n"}]}