{"thread":{"id":"1656","subject":"SVN import issue","startedAt":"2005-08-26T10:40:44Z","lastAt":"2005-09-10T16:23:13Z","messageCount":3,"participants":["Matthias Urlichs","James Cloos"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"7794","messageId":"pan.2005.08.26.10.40.38.616149@smurf.noris.de","threadId":"1656","inReplyTo":null,"subject":"SVN import issue","fromName":"Matthias Urlichs","fromEmail":"smurf@smurf.noris.de","sentAt":"2005-08-26T10:40:44Z","receivedAt":"2005-08-26T10:40:44Z","isPatch":false,"sender":{"key":"matthias@urlichs.de","avatar":"https://gravatar.com/avatar/2708905af227313eba6f2b2ae0f7d0259b5ac5d71baef58fe5a13c699ce0bbf0?d=mp&s=160"},"body":"Hi,\n\nI'm off to the beach for the next two weeks, so if somebody wants to\nmunge cvs2git into svn2git, here's the basics on how to pull from a\nremote SVN repo:\n\n\n#!/usr/bin/perl\n\nuse strict;\nuse warnings;\nuse SVN::Core;\nuse SVN::Ra;\n\nmy(@new,@del,@mod);\nsub show_log {\n\tmy ($changed_paths, $revision, $author, $date, $message, $pool) = @_;\n\t$author = '<unknown>' unless defined $author;\n\t@new = (); @del = (); @mod = ();\n\n\t(my $pmessage = $message) =~ s/\\n/\\n    /g;\n\tprint \"*** $revision: $author \\@ $date:\\n<<< $pmessage>>>\\n\";\n\tprint \"Files:\\n\";\n\twhile(my($path,$action) = each %$changed_paths) {\n\t\tmy $act = $action->action;\n\t\tmy $oldpath = $action->copyfrom_path;\n\t\tmy $oldrev = $action->copyfrom_rev;\n\t\t$oldrev = undef if defined $oldrev and $oldrev <= 0;\n\t\t$oldpath = undef if defined $oldpath and ($oldpath eq \"\" or $oldpath eq $path);\n\t\tprint \"$act $path\";\n\t\tprint \" <-\" if $oldpath or $oldrev;\n\t\tprint \" $oldpath\" if defined $oldpath;\n\t\tprint \" $oldrev\" if defined $oldrev;\n\t\tprint \"\\n\";\n\t\tif($act eq \"A\") {\n\t\t\tpush(@new,$path);\n\t\t} elsif($act eq \"D\") {\n\t\t\tpush(@del,$path);\n\t\t} else {\n\t\t\tpush(@mod,$path);\n\t\t}\n\t}\n}\n\n\nmy $ra = SVN::Ra->new(\"svn://cvs.gnupg.org/gnupg\");\n\nmy $latest = $ra->get_latest_revnum();\nmy $n = 1;\nwhile($n <= $latest) {\n\t$ra->get_log(\"/\",$n,$n,$n,1,1,\\&show_log,\"\");\n\n\tforeach my $path(@new,@mod) {\n\t\tprint \"Reading $path, $n...\\n\";\n\t\topen(F,\">/tmp/foo\"); # ( OK, so use tempfile() here ;-)\n\t\teval {\n\t\t\t$ra->get_file($path,$n,\\*F);\n\t\t};\n\t\tclose(F);\n\t\tif ($@) {\n\t\t\tprint \"... not a file\\n\";\n\t\t\tnext;\n\t\t}\n\t\tmy $sz = (stat(\"/tmp/foo\"))[7];\n\t\tprint \"... done, $sz bytes\\n.\";\n\t}\n} continue {\n\t$n++;\n}\n\nPaths in SVN are usually prefixed \"/trunk/\" (main branch) or\n\"/branches/foo/\" (branch foo); tagging is done by creating \"/tags/bar\",\nwith the trunk (or branch) revision it is pointing to as its parent. \n\nSo a branch point looks like this:\n\n*** 350: <unknown> @ 1999-09-18T11:04:00.000000Z:\n<<< This commit was manufactured by cvs2svn to create branch\n    'STABLE-BRANCH-1-0'.>>>\nFiles:\nA /branches/STABLE-BRANCH-1-0/cipher/rndw32.c <- /trunk/cipher/rndw32.c 349\nA /branches/STABLE-BRANCH-1-0 <- /trunk 348\n\n(and of *course* it may have changes from other revisions in it,\nanything else would simply be too easy I guess...). Tags look like they\ndo, see tag 1-0-0 in the above repo; that seems to happen because their\nCVS importer couldn't find a sane branchpoint. cvsps reports the same thing.\n\nI haven't yet examined what a SVN merge looks like.\n\nNothing stops a SVN check-in from touching multiple branches at the same\ntime, though in practice that doesn't happen.\n\nThe mapping of SVN revision numbers to git SHA1s could get a bit\nannoying because incremental imports need to work. Personally I'd use a\n.svnmap file which has \"svnid sha1\" lines inside. The last line\nobviously would not have a sha1 because we can't know that before\nchecking in the file...\n\n\nSo, if I find a working SVN importer when I come back I'll be happy  ;-)\n(munging cvs2git shouldn't be particularly difficult), otherwise I'll do\nit myself, in a month or so.\n\n-- \nMatthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de\nDisclaimer: The quote was selected randomly. Really. | http://smurf.noris.de\n - -\nI had been driving my car for 40 years when I fell asleep at the wheel and\nhad an accident.\n"},{"id":"7857","messageId":"m3fysuodbg.fsf@lugabout.cloos.reno.nv.us","threadId":"1656","inReplyTo":"pan.2005.08.26.10.40.38.616149@smurf.noris.de","subject":"Re: SVN import issue","fromName":"James Cloos","fromEmail":"cloos@jhcloos.com","sentAt":"2005-08-28T05:11:47Z","receivedAt":"2005-08-28T05:11:47Z","isPatch":false,"sender":{"key":"cloos@jhcloos.com","avatar":"https://gravatar.com/avatar/ec9a05787d29afe41e243e4b60bd0e2f69d757688e8f0bfe5e78bc185a3e317f?d=mp&s=160"},"body":">>>>> \"Matthias\" == Matthias Urlichs <smurf@smurf.noris.de> writes:\n\nMatthias> Paths in SVN are usually prefixed \"/trunk/\" (main branch) or\nMatthias> \"/branches/foo/\" (branch foo); tagging is done by creating\nMatthias> \"/tags/bar\", with the trunk (or branch) revision it is\nMatthias> pointing to as its parent.\n\nAnyone working on this should note that /usually/ is vital above.\n\nAmong other variations, using branch rather than branches is common.\n\n-JimC\n"},{"id":"8250","messageId":"pan.2005.09.10.16.23.07.865934@smurf.noris.de","threadId":"1656","inReplyTo":"m3fysuodbg.fsf@lugabout.cloos.reno.nv.us","subject":"Re: SVN import issue","fromName":"Matthias Urlichs","fromEmail":"smurf@smurf.noris.de","sentAt":"2005-09-10T16:23:13Z","receivedAt":"2005-09-10T16:23:13Z","isPatch":false,"sender":{"key":"matthias@urlichs.de","avatar":"https://gravatar.com/avatar/2708905af227313eba6f2b2ae0f7d0259b5ac5d71baef58fe5a13c699ce0bbf0?d=mp&s=160"},"body":"Hi, James Cloos wrote:\n\n> Matthias> Paths in SVN are usually prefixed \"/trunk/\" (main branch) or\n> Matthias> \"/branches/foo/\" (branch foo); tagging is done by creating\n> Matthias> \"/tags/bar\", with the trunk (or branch) revision it is\n> Matthias> pointing to as its parent.\n> \n> Anyone working on this should note that /usually/ is vital above.\n\nThanks; I'll keep that in mind. \n\nIs it common (possible?) to have more than one of these?\n\n-- \nMatthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de\nDisclaimer: The quote was selected randomly. Really. | http://smurf.noris.de\n - -\nThere is no distinctly American criminal class except Congress.\n\t-- Mark Twain\n"}]}