{"thread":{"id":"3355","subject":"[ANNOUNCE] git-svn - bidirection operations between svn and git","startedAt":"2006-02-16T07:38:26Z","lastAt":"2006-02-17T02:13:32Z","messageCount":15,"participants":["Eric Wong","Junio C Hamano","Aneesh Kumar","Petr Baudis","Eduardo Pereira Habkost"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"16251","messageId":"20060216073826.GA12055@hand.yhbt.net","threadId":"3355","inReplyTo":null,"subject":"[ANNOUNCE] git-svn - bidirection operations between svn and git","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-02-16T07:38:26Z","receivedAt":"2006-02-16T07:38:26Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Hello, I've written a simple tool for interoperating between git and\nsvn.  I wrote this so I could use git to work on projects where other\ndevelopers use Subversion.  I really hate using svn, but some projects I\nwork on require it, and svk isn't nearly as fast nor simple as git.\n\ngit-svn does not replace git-svnimport, git-svnimport handles branches\nand tags automatically, but is too inflexible about repository layouts\nto be useful for a good number of projects I follow, and of course\ngit-svnimport can't commit to Subversion repositories :)\n\ngit-svn only cares about a single branch/trunk in SVN[1], but you can\nuse as many branches in git as you want.  This makes it much easier to\nuse and allows it to handle just about any repository layout, not just\nthose recommended in the SVN book/developers.\n\nAlthough importing changesets from SVN is mostly a linear affair,\ncommitting to SVN is the opposite.  You may commit git tree objects in\nany order you want.  It simply clobbers the existing svn tree as\n'git-checkout -f' would, but tags file renames/copies carefully so users\non the SVN side can see them.  You can even do some wacky things with\npatch reordering.\n\nBasic day-to-day usage is pretty simple, and is designed to work with\nand also work like normal git commands:\n\n# Initialize a tree (like git init-db)::\n\tgit-svn init http://svn.foo.org/project/trunk\n\n# Fetch remote revisions::\n\tgit-svn fetch\n\n# Create your own branch to hack on::\n\tgit checkout -b my-branch git-svn-HEAD\n\n# Commit only the git commits you want to SVN::\n\tgit-svn commit <tree-ish> [<tree-ish_2> ...] \n\n# Commit all the git commits from my-branch that don't exist in SVN::\n\tgit rev-list --pretty=oneline git-svn-HEAD..my-branch | git-svn commit\n\n# Something is committed to SVN, pull the latest into your branch::\n\tgit-svn fetch && git pull . git-svn-HEAD\n\n@ Junio: Is there room for this in the git distribution alongside\ngit-svnimport?\n\nThanks for reading,\n\n[1] - there are some a hacks that lets you handle branches and tags, but\nit's not automated in any way, requires a bit of imagination to use to\nits full potential, and is very much a hack.  See the man page :)\n\n-- \nEric Wong\n\n\n#!/usr/bin/env perl\nuse warnings;\nuse strict;\nuse vars qw/\t$AUTHOR $VERSION\n\t\t$SVN_URL $SVN_INFO $SVN_WC\n\t\t$GIT_SVN_INDEX $GIT_SVN\n\t\t$GIT_DIR $REV_DIR/;\n$AUTHOR = 'Eric Wong <normalperson@yhbt.net>';\n$VERSION = '0.9.0';\n$GIT_DIR = $ENV{GIT_DIR} || \"$ENV{PWD}/.git\";\n$GIT_SVN = $ENV{GIT_SVN_ID} || 'git-svn';\n$GIT_SVN_INDEX = \"$GIT_DIR/$GIT_SVN/index\";\n$ENV{GIT_DIR} ||= $GIT_DIR;\n$SVN_URL = undef;\n$REV_DIR = \"$GIT_DIR/$GIT_SVN/revs\";\n$SVN_WC = \"$GIT_DIR/$GIT_SVN/tree\";\n\n# make sure the svn binary gives consistent output between locales and TZs:\n$ENV{TZ} = 'UTC';\n$ENV{LC_ALL} = 'C';\n\n# If SVN:: library support is added, please make the dependencies\n# optional and preserve the capability to use the command-line client.\n# See what I do with XML::Simple to make the dependency optional.\nuse Carp qw/croak/;\nuse IO::File qw//;\nuse File::Basename qw/dirname basename/;\nuse File::Path qw/mkpath/;\nuse Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;\nuse File::Spec qw//;\nmy $sha1 = qr/[a-f\\d]{40}/;\nmy $sha1_short = qr/[a-f\\d]{6,40}/;\nmy ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit);\n\nGetOptions(\t'revision|r=s' => \\$_revision,\n\t\t'no-ignore-externals' => \\$_no_ignore_ext,\n\t\t'stdin|' => \\$_stdin,\n\t\t'edit|e' => \\$_edit,\n\t\t'rmdir' => \\$_rmdir,\n\t\t'help|H|h' => \\$_help,\n\t\t'no-stop-copy' => \\$_no_stop_copy );\nmy %cmd = (\n\tfetch => [ \\&fetch, \"Download new revisions from SVN\" ],\n\tinit => [ \\&init, \"Initialize and fetch (import)\"],\n\tcommit => [ \\&commit, \"Commit git revisions to SVN\" ],\n\trebuild => [ \\&rebuild, \"Rebuild git-svn metadata (after git clone)\" ],\n\thelp => [ \\&usage, \"Show help\" ],\n);\nmy $cmd;\nfor (my $i = 0; $i < @ARGV; $i++) {\n\tif (defined $cmd{$ARGV[$i]}) {\n\t\t$cmd = $ARGV[$i];\n\t\tsplice @ARGV, $i, 1;\n\t\tlast;\n\t}\n};\n\n# we may be called as git-svn-(command), or git-svn(command).\nforeach (keys %cmd) {\n\tif (/git\\-svn\\-?($_)(?:\\.\\w+)?$/) {\n\t\t$cmd = $1;\n\t\tlast;\n\t}\n}\nusage(0) if $_help;\nusage(1) unless (defined $cmd);\nsvn_check_ignore_externals();\n$cmd{$cmd}->[0]->(@ARGV);\nexit 0;\n\n####################### primary functions ######################\nsub usage {\n\tmy $exit = shift || 0;\n\tmy $fd = $exit ? \\*STDERR : \\*STDOUT;\n\tprint $fd <<\"\";\ngit-svn - bidirectional operations between a single Subversion tree and git\nUsage: $0 <command> [options] [arguments]\\n\nAvailable commands:\n\n\tforeach (sort keys %cmd) {\n\t\tprint $fd '  ',pack('A10',$_),$cmd{$_}->[1],\"\\n\";\n\t}\n\tprint $fd <<\"\";\n\\nGIT_SVN_ID may be set in the environment to an arbitrary identifier if\nyou're tracking multiple SVN branches/repositories in one git repository\nand want to keep them separate.\n\n\texit $exit;\n}\n\nsub rebuild {\n\t$SVN_URL = shift or undef;\n\tmy $repo_uuid;\n\tmy $newest_rev = 0;\n\t\n\tmy $pid = open(my $rev_list,'-|');\n\tdefined $pid or croak $!;\n\tif ($pid == 0) {\n\t\texec(\"git-rev-list\",\"$GIT_SVN-HEAD\") or croak $!;\n\t}\n\tmy $first;\n\twhile (<$rev_list>) {\n\t\tchomp;\n\t\tmy $c = $_;\n\t\tcroak \"Non-SHA1: $c\\n\" unless $c =~ /^$sha1$/o;\n\t\tmy @commit = grep(/^git-svn-id: /,`git-cat-file commit $c`);\n\t\tnext if (!@commit); # skip merges\n\t\tmy $id = $commit[$#commit];\n\t\tmy ($url, $rev, $uuid) = ($id =~ /^git-svn-id:\\s(\\S+?)\\@(\\d+)\n\t\t\t\t\t\t\\s([a-f\\d\\-]+)$/x);\n\t\tif (!$rev || !$uuid || !$url) {\n\t\t\t# some of the original repositories I made had\n\t\t\t# indentifiers like this:\n\t\t\t($rev, $uuid) = ($id =~/^git-svn-id:\\s(\\d+)\n\t\t\t\t\t\t\t\\@([a-f\\d\\-]+)/x);\n\t\t\tif (!$rev || !$uuid) {\n\t\t\t\tcroak \"Unable to extract revision or UUID from \",\n\t\t\t\t\t\"$c, $id\\n\";\n\t\t\t}\n\t\t}\n\t\tprint \"r$rev = $c\\n\";\n\t\tunless (defined $first) {\n\t\t\tif (!$SVN_URL && !$url) {\n\t\t\t\tcroak \"SVN repository location required: $url\\n\";\n\t\t\t}\n\t\t\t$SVN_URL ||= $url;\n\t\t\t$repo_uuid = setup_git_svn();\n\t\t\t$first = $rev;\n\t\t}\n\t\tif ($uuid ne $repo_uuid) {\n\t\t\tcroak \"Repository UUIDs do not match!\\ngot: $uuid\\n\",\n\t\t\t\t\t\t\"expected: $repo_uuid\\n\";\n\t\t}\n\t\tassert_revision_eq_or_unknown($rev, $c);\n\t\tsys('git-update-ref',\"$GIT_SVN/revs/$rev\",$c);\n\t\t$newest_rev = $rev if ($rev > $newest_rev);\n\t}\n\tclose $rev_list or croak $?;\n\tif (!chdir $SVN_WC) {\n\t\tmy @svn_co = ('svn','co',\"-r$first\");\n\t\tpush @svn_co, '--ignore-externals' unless $_no_ignore_ext;\n\t\tsys(@svn_co, $SVN_URL, $SVN_WC);\n\t\tchdir $SVN_WC or croak $!;\n\t}\n\t\n\t$pid = fork;\n\tdefined $pid or croak $!;\n\tif ($pid == 0) {\n\t\tmy @svn_up = qw(svn up);\n\t\tpush @svn_up, '--ignore-externals' unless $_no_ignore_ext;\n\t\tsys(@svn_up,\"-r$newest_rev\");\n\t\t$ENV{GIT_INDEX_FILE} = $GIT_SVN_INDEX; \n\t\tgit_addremove();\n\t\texec('git-write-tree');\n\t}\n\twaitpid $pid, 0;\n}\n\nsub init {\n\t$SVN_URL = shift or croak \"SVN repository location required\\n\";\n\tunless (-d $GIT_DIR) {\n\t\tsys('git-init-db');\n\t}\n\tsetup_git_svn();\n}\n\nsub fetch {\n\tmy (@parents) = @_;\n\t$SVN_URL ||= file_to_s(\"$GIT_DIR/$GIT_SVN/info/url\");\n\tmy @log_args = -d $SVN_WC ? ($SVN_WC) : ($SVN_URL);\n\tif (-d $SVN_WC && !$_revision) {\n\t\t$_revision = 'BASE:HEAD';\n\t}\n\tpush @log_args, \"-r$_revision\" if $_revision;\n\tpush @log_args, '--stop-on-copy' unless $_no_stop_copy;\n\n\teval { require XML::Simple or croak $! };\n\tmy $svn_log = $@ ? svn_log_raw(@log_args) : svn_log_xml(@log_args);\n\t\n\tmy $base = shift @$svn_log or croak \"No base revision!\\n\";\n\tmy $last_commit = undef;\n\tunless (-d $SVN_WC) {\n\t\tmy @svn_co = ('svn','co',\"-r$base->{revision}\");\n\t\tpush @svn_co,'--ignore-externals' unless $_no_ignore_ext;\n\t\tsys(@svn_co, $SVN_URL, $SVN_WC);\n\t\tchdir $SVN_WC or croak $!;\n\t\t$last_commit = git_commit($base, @parents);\n\t\tunless (-f \"$GIT_DIR/refs/heads/master\") {\n\t\t\tsys(qw(git-update-ref refs/heads/master),$last_commit);\n\t\t}\n\t\tassert_svn_wc_clean($base->{revision}, $last_commit);\n\t} else {\n\t\tchdir $SVN_WC or croak $!;\n\t\t$last_commit = file_to_s(\"$REV_DIR/$base->{revision}\");\n\t}\n\tmy @svn_up = qw(svn up);\n\tpush @svn_up, '--ignore-externals' unless $_no_ignore_ext;\n\tmy $last_rev = $base->{revision};\n\tforeach my $log_msg (@$svn_log) {\n\t\tassert_svn_wc_clean($last_rev, $last_commit);\n\t\t$last_rev = $log_msg->{revision};\n\t\tsys(@svn_up,\"-r$last_rev\");\n\t\t$last_commit = git_commit($log_msg, $last_commit, @parents);\n\t}\n\tassert_svn_wc_clean($last_rev, $last_commit);\n\treturn pop @$svn_log;\n}\n\nsub commit {\n\tmy (@commits) = @_;\n\tif ($_stdin || !@commits) {\n\t\tprint \"Reading from stdin...\\n\";\n\t\t@commits = ();\n\t\twhile (<STDIN>) {\n\t\t\tif (/^([a-f\\d]{6,40})\\b/) {\n\t\t\t\tunshift @commits, $1;\n\t\t\t}\n\t\t}\n\t}\n\tmy @revs;\n\tforeach (@commits) {\n\t\tpush @revs, (safe_qx('git-rev-parse',$_));\n\t}\n\tchomp @revs;\n\t\n\tfetch();\n\tchdir $SVN_WC or croak $!;\n\tmy $svn_current_rev =  svn_info('.')->{'Last Changed Rev'};\n\tforeach my $c (@revs) {\n\t\tprint \"Committing $c\\n\";\n\t\tsvn_checkout_tree($svn_current_rev, $c);\n\t\t$svn_current_rev = svn_commit_tree($svn_current_rev, $c);\n\t}\n\tprint \"Done committing \",scalar @revs,\" revisions to SVN\\n\";\n\t\t\n}\n\n########################### utility functions #########################\n\nsub setup_git_svn {\n\tdefined $SVN_URL or croak \"SVN repository location required\\n\";\n\tunless (-d $GIT_DIR) {\n\t\tcroak \"GIT_DIR=$GIT_DIR does not exist!\\n\";\n\t}\n\tmkpath([\"$GIT_DIR/$GIT_SVN\"]);\n\tmkpath([\"$GIT_DIR/$GIT_SVN/info\"]);\n\tmkpath([$REV_DIR]);\n\ts_to_file($SVN_URL,\"$GIT_DIR/$GIT_SVN/info/url\");\n\tmy $uuid = svn_info($SVN_URL)->{'Repository UUID'} or\n\t\t\t\t\tcroak \"Repository UUID unreadable\\n\";\n\ts_to_file($uuid,\"$GIT_DIR/$GIT_SVN/info/uuid\");\n\n\topen my $fd, '>>', \"$GIT_DIR/$GIT_SVN/info/exclude\" or croak $!;\n\tprint $fd '.svn',\"\\n\";\n\tclose $fd or croak $!;\n\treturn $uuid;\n}\n\nsub assert_svn_wc_clean {\n\tmy ($svn_rev, $commit) = @_;\n\tcroak \"$svn_rev is not an integer!\\n\" unless ($svn_rev =~ /^\\d+$/);\n\tcroak \"$commit is not a sha1!\\n\" unless ($commit =~ /^$sha1$/o);\n\tmy $svn_info = svn_info('.');\n\tif ($svn_rev != $svn_info->{'Last Changed Rev'}) {\n\t\tcroak \"Expected r$svn_rev, got r\",\n\t\t\t\t$svn_info->{'Last Changed Rev'},\"\\n\";\n\t}\n\tmy @status = grep(!/^Performing status on external/,(`svn status`));\n\t@status = grep(!/^\\s*$/,@status);\n\tif (scalar @status) {\n\t\tprint STDERR \"Tree ($SVN_WC) is not clean:\\n\";\n\t\tprint STDERR $_ foreach @status;\n\t\tcroak;\n\t}\n\tmy ($tree_a) = grep(/^tree $sha1$/o,`git-cat-file commit $commit`);\n\t$tree_a =~ s/^tree //;\n\tchomp $tree_a;\n\tchomp(my $tree_b = `GIT_INDEX_FILE=$GIT_SVN_INDEX git-write-tree`);\n\tif ($tree_a ne $tree_b) {\n\t\tcroak \"$svn_rev != $commit, $tree_a != $tree_b\\n\";\n\t}\n}\n\nsub parse_diff_tree {\n\tmy $diff_fh = shift;\n\tlocal $/ = \"\\0\";\n\tmy $state = 'meta';\n\tmy @mods;\n\twhile (<$diff_fh>) {\n\t\tchomp $_; # this gets rid of the trailing \"\\0\"\n\t\tprint $_,\"\\n\";\n\t\tif ($state eq 'meta' && /^:(\\d{6})\\s(\\d{6})\\s\n\t\t\t\t\t$sha1\\s($sha1)\\s([MTCRAD])\\d*$/xo) {\n\t\t\tpush @mods, {\tmode_a => $1, mode_b => $2,\n\t\t\t\t\tsha1_b => $3, chg => $4 };\n\t\t\tif ($4 =~ /^(?:C|R)$/) {\n\t\t\t\t$state = 'file_a';\n\t\t\t} else {\n\t\t\t\t$state = 'file_b';\n\t\t\t}\n\t\t} elsif ($state eq 'file_a') {\n\t\t\tmy $x = $mods[$#mods] or croak __LINE__,\": Empty array\\n\";\n\t\t\tif ($x->{chg} !~ /^(?:C|R)$/) {\n\t\t\t\tcroak __LINE__,\": Error parsing $_, $x->{chg}\\n\";\n\t\t\t}\n\t\t\t$x->{file_a} = $_;\n\t\t\t$state = 'file_b';\n\t\t} elsif ($state eq 'file_b') {\n\t\t\tmy $x = $mods[$#mods] or croak __LINE__,\": Empty array\\n\";\n\t\t\tif (exists $x->{file_a} && $x->{chg} !~ /^(?:C|R)$/) {\n\t\t\t\tcroak __LINE__,\": Error parsing $_, $x->{chg}\\n\";\n\t\t\t}\n\t\t\tif (!exists $x->{file_a} && $x->{chg} =~ /^(?:C|R)$/) {\n\t\t\t\tcroak __LINE__,\": Error parsing $_, $x->{chg}\\n\";\n\t\t\t}\n\t\t\t$x->{file_b} = $_;\n\t\t\t$state = 'meta';\n\t\t} else {\n\t\t\tcroak __LINE__,\": Error parsing $_\\n\";\n\t\t}\n\t}\n\tclose $diff_fh or croak $!;\n\treturn \\@mods;\n}\n\nsub svn_check_prop_executable {\n\tmy $m = shift;\n\tif ($m->{mode_b} =~ /755$/ && $m->{mode_a} !~ /755$/) {\n\t\tsys(qw(svn propset svn:executable 1), $m->{file_b});\n\t} elsif ($m->{mode_b} !~ /755$/ && $m->{mode_a} =~ /755$/) {\n\t\tsys(qw(svn propdel svn:executable), $m->{file_b});\n\t}\n}\n\nsub svn_ensure_parent_path {\n\tmy $dir_b = dirname(shift);\n\tsvn_ensure_parent_path($dir_b) if ($dir_b ne File::Spec->curdir);\n\tmkpath([$dir_b]) unless (-d $dir_b);\n\tsys(qw(svn add -N), $dir_b) unless (-d \"$dir_b/.svn\");\n}\n\nsub svn_checkout_tree {\n\tmy ($svn_rev, $commit) = @_;\n\tmy $from = file_to_s(\"$REV_DIR/$svn_rev\");\n\tassert_svn_wc_clean($svn_rev,$from);\n\tprint \"diff-tree '$from' '$commit'\\n\";\n\tmy $pid = open my $diff_fh, '-|';\n\tdefined $pid or croak $!;\n\tif ($pid == 0) {\n\t\texec(qw(git-diff-tree -z -r -C), $from, $commit) or croak $!;\n\t}\n\tmy $mods = parse_diff_tree($diff_fh);\n\tunless (@$mods) {\n\t\t# git can do empty commits, SVN doesn't allow it...\n\t\treturn $svn_rev;\n\t}\n\tmy %rm;\n\tforeach my $m (@$mods) {\n\t\tif ($m->{chg} eq 'C') {\n\t\t\tsvn_ensure_parent_path( $m->{file_b} );\n\t\t\tsys(qw(svn cp),\t\t$m->{file_a}, $m->{file_b});\n\t\t\tblob_to_file(\t\t$m->{sha1_b}, $m->{file_b});\n\t\t\tsvn_check_prop_executable($m);\n\t\t} elsif ($m->{chg} eq 'D') {\n\t\t\t$rm{dirname $m->{file_b}}->{basename $m->{file_b}} = 1;\n\t\t\tsys(qw(svn rm --force), $m->{file_b});\n\t\t} elsif ($m->{chg} eq 'R') {\n\t\t\tsvn_ensure_parent_path( $m->{file_b} );\n\t\t\tsys(qw(svn mv --force), $m->{file_a}, $m->{file_b});\n\t\t\tblob_to_file(\t\t$m->{sha1_b}, $m->{file_b});\n\t\t\tsvn_check_prop_executable($m);\n\t\t\t$rm{dirname $m->{file_a}}->{basename $m->{file_a}} = 1;\n\t\t} elsif ($m->{chg} eq 'M') {\n\t\t\tif ($m->{mode_b} =~ /^120/ && $m->{mode_a} =~ /^120/) {\n\t\t\t\tunlink $m->{file_b} or croak $!;\n\t\t\t\tblob_to_symlink($m->{sha1_b}, $m->{file_b});\n\t\t\t} else {\n\t\t\t\tblob_to_file($m->{sha1_b}, $m->{file_b});\n\t\t\t}\n\t\t\tsvn_check_prop_executable($m);\n\t\t} elsif ($m->{chg} eq 'T') {\n\t\t\tsys(qw(svn rm --force),$m->{file_b});\n\t\t\tif ($m->{mode_b} =~ /^120/ && $m->{mode_a} =~ /^100/) {\n\t\t\t\tblob_to_symlink($m->{sha1_b}, $m->{file_b});\n\t\t\t} else {\n\t\t\t\tblob_to_file($m->{sha1_b}, $m->{file_b});\n\t\t\t}\n\t\t\tsvn_check_prop_executable($m);\n\t\t\tsys(qw(svn add --force), $m->{file_b});\n\t\t} elsif ($m->{chg} eq 'A') {\n\t\t\tsvn_ensure_parent_path( $m->{file_b} );\n\t\t\tblob_to_file(\t\t$m->{sha1_b}, $m->{file_b});\n\t\t\tif ($m->{mode_b} =~ /755$/) {\n\t\t\t\tchmod 0755, $m->{file_b};\n\t\t\t}\n\t\t\tsys(qw(svn add --force), $m->{file_b});\n\t\t} else {\n\t\t\tcroak \"Invalid chg: $m->{chg}\\n\";\n\t\t}\n\t}\n\tif ($_rmdir) {\n\t\tmy $old_index = $ENV{GIT_INDEX_FILE};\n\t\t$ENV{GIT_INDEX_FILE} = $GIT_SVN_INDEX;\n\t\tforeach my $dir (keys %rm) {\n\t\t\tmy $files = $rm{$dir};\n\t\t\tmy @files;\n\t\t\tforeach (safe_qx('svn','ls',$dir)) {\n\t\t\t\tchomp;\n\t\t\t\tpush @files, $_ unless $files->{$_};\n\t\t\t}\n\t\t\tsys(qw(svn rm),$dir) unless @files;\n\t\t}\n\t\tif ($old_index) {\n\t\t\t$ENV{GIT_INDEX_FILE} = $old_index;\n\t\t} else {\n\t\t\tdelete $ENV{GIT_INDEX_FILE};\n\t\t}\n\t}\n}\n\nsub svn_commit_tree {\n\tmy ($svn_rev, $commit) = @_;\n\tmy $commit_msg = \"$GIT_DIR/$GIT_SVN/.svn-commit.tmp.$$\";\n\topen my $msg, '>', $commit_msg  or croak $!;\n\t\n\tchomp(my $type = `git-cat-file -t $commit`);\n\tif ($type eq 'commit') {\n\t\tmy $pid = open my $msg_fh, '-|';\n\t\tdefined $pid or croak $!;\n\n\t\tif ($pid == 0) {\n\t\t\texec(qw(git-cat-file commit), $commit) or croak $!;\n\t\t}\n\t\tmy $in_msg = 0;\n\t\twhile (<$msg_fh>) {\n\t\t\tif (!$in_msg) {\n\t\t\t\t$in_msg = 1 if (/^\\s*$/);\n\t\t\t} else {\n\t\t\t\tprint $msg $_ or croak $!;\n\t\t\t}\n\t\t}\n\t\tclose $msg_fh or croak $!;\n\t}\n\tclose $msg or croak $!;\n\n\tif ($_edit || ($type eq 'tree')) {\n\t\tmy $editor = $ENV{VISUAL} || $ENV{EDITOR} || 'vi';\n\t\tsystem($editor, $commit_msg);\n\t}\n\tmy @ci_output = safe_qx(qw(svn commit -F),$commit_msg);\n\tmy ($committed) = grep(/^Committed revision \\d+\\./,@ci_output);\n\tunlink $commit_msg;\n\tdefined $committed or croak\n\t\t\t\"Commit output failed to parse committed revision!\\n\",\n\t\t\tjoin(\"\\n\",@ci_output),\"\\n\";\n\tmy ($rev_committed) = ($committed =~ /^Committed revision (\\d+)\\./);\n\n\t# resync immediately\n\tmy @svn_up = (qw(svn up), \"-r$svn_rev\");\n\tpush @svn_up, '--ignore-externals' unless $_no_ignore_ext;\n\tsys(@svn_up);\n\treturn fetch(\"$rev_committed=$commit\")->{revision};\n}\n\nsub svn_log_xml {\n\tmy (@log_args) = @_;\n\tmy $log_fh = IO::File->new_tmpfile or croak $!;\n\t\n\tmy $pid = fork;\n\tdefined $pid or croak $!;\n\t\n\tif ($pid == 0) {\n\t\topen STDOUT, '>&', $log_fh or croak $!;\n\t\texec (qw(svn log --xml), @log_args) or croak $!\n\t}\n\t\n\twaitpid $pid, 0;\n\tcroak $? if $?;\n\n\tseek $log_fh, 0, 0;\n\tmy @svn_log;\n\tmy $log = XML::Simple::XMLin( $log_fh,\n\t\t\t\tForceArray => ['path','revision','logentry'],\n\t\t\t\tKeepRoot => 0,\n\t\t\t\tKeyAttr => {\tlogentry => '+revision',\n\t\t\t\t\t\tpaths => '+path' },\n\t\t\t)->{logentry};\n\tforeach my $r (sort {$a <=> $b} keys %$log) {\n\t\tmy $log_msg = $log->{$r};\n\t\tmy ($Y,$m,$d,$H,$M,$S) = ($log_msg->{date} =~\n\t\t\t\t\t/(\\d{4})\\-(\\d\\d)\\-(\\d\\d)T\n\t\t\t\t\t (\\d\\d)\\:(\\d\\d)\\:(\\d\\d)\\.\\d+Z$/x)\n\t\t\t\t\t or croak \"Failed to parse date: \",\n\t\t\t\t\t\t $log->{$r}->{date};\n\t\t$log_msg->{date} = \"+0000 $Y-$m-$d $H:$M:$S\";\n\n\t\t# XML::Simple can't handle <msg></msg> as a string:\n\t\tif (ref $log_msg->{msg} eq 'HASH') {\n\t\t\t$log_msg->{msg} = \"\\n\";\n\t\t} else {\n\t\t\t$log_msg->{msg} .= \"\\n\";\n\t\t}\n\t\tpush @svn_log, $log->{$r};\n\t}\n\treturn \\@svn_log;\n}\n\nsub svn_log_raw {\n\tmy (@log_args) = @_;\n\tmy $pid = open my $log_fh,'-|';\n\tdefined $pid or croak $!;\n\t\n\tif ($pid == 0) {\n\t\texec (qw(svn log), @log_args) or croak $!\n\t}\n\t\n\tmy @svn_log;\n\tmy $state;\n\twhile (<$log_fh>) {\n\t\tchomp;\n\t\tif (/^\\-{72}$/) {\n\t\t\t$state = 'rev';\n\t\t\t\n\t\t\t# if we have an empty log message, put something there:\n\t\t\tif (@svn_log) {\n\t\t\t\t$svn_log[0]->{msg} ||= \"\\n\";\n\t\t\t}\n\t\t\tnext;\n\t\t}\n\t\tif ($state eq 'rev' && s/^r(\\d+)\\s*\\|\\s*//) {\n\t\t\tmy $rev = $1;\n\t\t\tmy ($author, $date) = split(/\\s*\\|\\s*/, $_, 2);\n\t\t\tmy ($Y,$m,$d,$H,$M,$S,$tz) = ($date =~\n\t\t\t\t\t/(\\d{4})\\-(\\d\\d)\\-(\\d\\d)\\s\n\t\t\t\t\t (\\d\\d)\\:(\\d\\d)\\:(\\d\\d)\\s([\\-\\+]\\d+)/x)\n\t\t\t\t\t or croak \"Failed to parse date: $date\\n\";\n\t\t\tmy %log_msg = (\trevision => $rev,\n\t\t\t\t\tdate => \"$tz $Y-$m-$d $H:$M:$S\",\n\t\t\t\t\tauthor => $author,\n\t\t\t\t\tmsg => '' );\n\t\t\tunshift @svn_log, \\%log_msg;\n\t\t\t$state = 'msg_start';\n\t\t\tnext;\n\t\t}\n\t\t# skip the first blank line of the message:\n\t\tif ($state eq 'msg_start' && /^$/) {\n\t\t\t$state = 'msg';\n\t\t} elsif ($state eq 'msg') {\n\t\t\t$svn_log[0]->{msg} .= $_.\"\\n\";\n\t\t}\n\t}\n\tclose $log_fh or croak $?;\n\treturn \\@svn_log;\n}\n\nsub svn_info {\n\tmy $url = shift || $SVN_URL;\n\n\tmy $pid = open my $info_fh, '-|';\n\tdefined $pid or croak $!;\n\t\n\tif ($pid == 0) {\n\t\texec(qw(svn info),$url) or croak $!;\n\t}\n\t\n\tmy $ret = {};\n\t# only single-lines seem to exist in svn info output\n\twhile (<$info_fh>) {\n\t\tchomp $_;\n\t\tif (m#^([^:]+)\\s*:\\s*(\\S*)$#) {\n\t\t\t$ret->{$1} = $2;\n\t\t\tpush @{$ret->{-order}}, $1;\n\t\t}\n\t}\n\tclose $info_fh or croak $!;\n\treturn $ret;\n}\n\nsub sys { system(@_) == 0 or croak $? }\n\nsub git_addremove {\n\tsystem(\t\"git-ls-files -z --others \".\n\t\t\t\"'--exclude-from=$GIT_DIR/$GIT_SVN/info/exclude'\".\n\t\t\t\t\"| git-update-index --add -z --stdin; \".\n\t\t\"git-ls-files -z --deleted \".\n\t\t\t\t\"| git-update-index --remove -z --stdin; \".\n\t\t\"git-ls-files -z --modified\".\n\t\t\t\t\"| git-update-index -z --stdin\") == 0 or croak $?\n}\n\nsub s_to_file {\n\tmy ($str, $file, $mode) = @_;\n\topen my $fd,'>',$file or croak $!;\n\tprint $fd $str,\"\\n\" or croak $!;\n\tclose $fd or croak $!;\n\tchmod ($mode &~ umask, $file) if (defined $mode);\n}\n\nsub file_to_s {\n\tmy $file = shift;\n\topen my $fd,'<',$file or croak \"$!: file: $file\\n\";\n\tlocal $/;\n\tmy $ret = <$fd>;\n\tclose $fd or croak $!;\n \t$ret =~ s/\\s*$//s;\n\treturn $ret;\n}\n\nsub assert_revision_unknown {\n\tmy $revno = shift;\n\tif (-f \"$REV_DIR/$revno\") {\n\t\tcroak \"$REV_DIR/$revno already exists! \",\n\t\t\t\t\"Why are we refetching it?\";\n\t}\n}\n\nsub assert_revision_eq_or_unknown {\n\tmy ($revno, $commit) = @_;\n\tif (-f \"$REV_DIR/$revno\") {\n\t\tmy $current = file_to_s(\"$REV_DIR/$revno\");\n\t\tif ($commit ne $current) {\n\t\t\tcroak \"$REV_DIR/$revno already exists!\\n\",\n\t\t\t\t\"current: $current\\nexpected: $commit\\n\";\n\t\t}\n\t\treturn;\n\t}\n}\n\nsub git_commit {\n\tmy ($log_msg, @parents) = @_;\n\tassert_revision_unknown($log_msg->{revision});\n\tmy $out_fh = IO::File->new_tmpfile or croak $!;\n\tmy $info = svn_info('.');\n\tmy $uuid = $info->{'Repository UUID'};\n\tdefined $uuid or croak \"Unable to get Repository UUID\\n\";\n\n\t# commit parents can be conditionally bound to a particular\n\t# svn revision via: \"svn_revno=commit_sha1\", filter them out here:\n\tmy @exec_parents;\n\tforeach my $p (@parents) {\n\t\tnext unless defined $p;\n\t\tif ($p =~ /^(\\d+)=($sha1_short)$/o) {\n\t\t\tif ($1 == $log_msg->{revision}) {\n\t\t\t\tpush @exec_parents, $2;\n\t\t\t}\n\t\t} else {\n\t\t\tpush @exec_parents, $p if $p =~ /$sha1_short/o;\n\t\t}\n\t}\n\n\tmy $pid = fork;\n\tdefined $pid or croak $!;\n\tif ($pid == 0) {\n\t\t$ENV{GIT_INDEX_FILE} = $GIT_SVN_INDEX;\n\t\tgit_addremove();\n\t\tchomp(my $tree = `git-write-tree`);\n\t\tcroak if $?;\n\t\tmy $msg_fh = IO::File->new_tmpfile or croak $!;\n\t\tprint $msg_fh $log_msg->{msg}, \"\\ngit-svn-id: \", \n\t\t\t\t\t\"$SVN_URL\\@$log_msg->{revision}\",\n\t\t\t\t\t\" $uuid\\n\" or croak $!;\n\t\t$msg_fh->flush == 0 or croak $!;\n\t\tseek $msg_fh, 0, 0 or croak $!;\n\n\t\t$ENV{GIT_AUTHOR_NAME} = $ENV{GIT_COMMITTER_NAME} =\n\t\t\t\t\t\t$log_msg->{author};\n\t\t$ENV{GIT_AUTHOR_EMAIL} = $ENV{GIT_COMMITTER_EMAIL} =\n\t\t\t\t\t\t$log_msg->{author}.\"\\@$uuid\";\n\t\t$ENV{GIT_AUTHOR_DATE} = $ENV{GIT_COMMITTER_DATE} =\n\t\t\t\t\t\t$log_msg->{date};\n\t\tmy @exec = ('git-commit-tree',$tree);\n\t\tpush @exec, '-p', $_  foreach @exec_parents;\n\t\topen STDIN, '<&', $msg_fh or croak $!;\n\t\topen STDOUT, '>&', $out_fh or croak $!;\n\t\texec @exec or croak $!;\n\t}\n\twaitpid($pid,0);\n\tcroak if $?;\n\n\t$out_fh->flush == 0 or croak $!;\n\tseek $out_fh, 0, 0 or croak $!;\n\tchomp(my $commit = do { local $/; <$out_fh> });\n\tif ($commit !~ /^$sha1$/o) {\n\t\tcroak \"Failed to commit, invalid sha1: $commit\\n\";\n\t}\n\tmy @update_ref = ('git-update-ref',\"refs/heads/$GIT_SVN-HEAD\",$commit);\n\tif (my $primary_parent = shift @exec_parents) {\n\t\tpush @update_ref, $primary_parent;\n\t}\n\tsys(@update_ref);\n\tsys('git-update-ref',\"$GIT_SVN/revs/$log_msg->{revision}\",$commit);\n\tprint \"r$log_msg->{revision} = $commit\\n\";\n\treturn $commit;\n}\n\nsub blob_to_symlink {\n\tmy ($blob, $link) = @_;\n\tdefined $link or croak \"\\$link not defined!\\n\";\n\tcroak \"Not a sha1: $blob\\n\" unless $blob =~ /^$sha1$/o;\n\tmy $dest = `git-cat-file blob $blob`; # no newline, so no chomp\n\tsymlink $dest, $link or croak $!;\n}\n\nsub blob_to_file {\n\tmy ($blob, $file) = @_;\n\tdefined $file or croak \"\\$file not defined!\\n\";\n\tcroak \"Not a sha1: $blob\\n\" unless $blob =~ /^$sha1$/o;\n\topen my $blob_fh, '>', $file or croak \"$!: $file\\n\";\n\tmy $pid = fork;\n\tdefined $pid or croak $!;\n\n\tif ($pid == 0) {\n\t\topen STDOUT, '>&', $blob_fh or croak $!;\n\t\texec('git-cat-file','blob',$blob);\n\t}\n\twaitpid $pid, 0;\n\tcroak $? if $?;\n\t\n\tclose $blob_fh or croak $!;\n}\n\nsub safe_qx {\n\tmy $pid = open my $child, '-|';\n\tdefined $pid or croak $!;\n\tif ($pid == 0) {\n\t\texec(@_) or croak $?;\n\t}\n\tmy @ret = (<$child>);\n\tclose $child or croak $?;\n\tdie $? if $?; # just in case close didn't error out\n\treturn wantarray ? @ret : join('',@ret);\n}\n\nsub svn_check_ignore_externals {\n\treturn if $_no_ignore_ext;\n\tunless (grep /ignore-externals/,(safe_qx(qw(svn co -h)))) {\n\t\tprint STDERR \"W: Installed svn version does not support \",\n\t\t\t\t\"--ignore-externals\\n\";\n\t\t$_no_ignore_ext = 1;\n\t}\n}\n__END__\n\nData structures:\n\n@svn_log = array of log_msg hashes\n\n$log_msg hash \n{ \n\tmsg => 'whitespace-formatted log entry\n',\t\t\t\t\t\t# trailing newline is preserved\n\trevision => '8',\t\t\t# integer\n\tdate => '2004-02-24T17:01:44.108345Z',\t# commit date\n\tauthor => 'committer name' \n};\n\n\n@mods = array of diff-index line hashes, each element represents one line\n\tof diff-index output\n\ndiff-index line ($m hash)\n{\n\tmode_a => first column of diff-index output, no leading ':',\n\tmode_b => second column of diff-index output,\n\tsha1_b => sha1sum of the final blob,\n\tchg => change type [MCRAD],\n\tfile_a => original file name of a file (iff chg is 'C' or 'R')\n\tfile_b => new/current file name of a file (any chg)\n}\n;\n\n\ngit-svn(1)\n==========\n\nNAME\n----\ngit-svn - bidirectional operation between a single Subversion branch and git\n\nSYNOPSIS\n--------\n'git-svn' <command> [options] [arguments]\n\nDESCRIPTION\n-----------\ngit-svn is a simple conduit for changesets between a single Subversion\nbranch and git.\n\ngit-svn is not to be confused with git-svnimport.  The were designed\nwith very different goals in mind.\n\ngit-svn is designed for an individual developer who wants a\nbidirectional flow of changesets between a single branch in Subversion\nand an arbitrary number of branches in git.  git-svnimport is designed\nfor read-only operation on repositories that match a particular layout\n(albeit the recommended one by SVN developers).\n\nFor importing svn, git-svnimport is potentially more powerful when\noperating on repositories organized under the recommended\ntrunk/branch/tags structure, and should be faster, too.\n\ngit-svn completely ignores the very limited view of branching that\nSubversion has.  This allows git-svn to be much easier to use,\nespecially on repositories that are not organized in a manner that\ngit-svnimport is designed for.\n\nCOMMANDS\n--------\ninit::\n\tCreates an empty git repository with additional metadata\n\tdirectories for git-svn.  The SVN_URL must be specified\n\tat this point.\n\nfetch::\n\tFetch unfetched revisions from the SVN_URL we are tracking.\n\trefs/heads/git-svn-HEAD will be updated to the latest revision.\n\t\ncommit::\n\tCommit specified commit or tree objects to SVN.  This relies on\n\tyour imported fetch data being up-to-date.  This makes\n\tabsolutely no attempts to do patching when committing to SVN, it\n\tsimply overwrites files with those specified in the tree or\n\tcommit.  All merging is assumed to have taken place\n\tindependently of git-svn functions.\n\nrebuild::\n\tNot a part of daily usage, but this is a useful command if\n\tyou've just cloned a repository (using git-clone) that was\n\ttracked with git-svn.  Unfortunately, git-clone does not clone\n\tgit-svn metadata and the svn working tree that git-svn uses for\n\tits operations.  This rebuilds the metadata so git-svn can\n\tresume fetch operations.  SVN_URL may be optionally specified if\n\tthe directory/repository you're tracking has moved or changed\n\tprotocols.\n\nOPTIONS\n-------\n-r <ARG>::\n--revision <ARG>::\n\tOnly used with the 'fetch' command.\n\n\tTakes any valid -r<argument> svn would accept and passes it\n\tdirectly to svn. -r<ARG1>:<ARG2> ranges and \"{\" DATE \"}\" syntax\n\tis also supported.  This is passed directly to svn, see svn\n\tdocumentation for more details.\n\n\tThis can allow you to make partial mirrors when running fetch.\n\n-::\n--stdin::\n\tOnly used with the 'commit' command.\n\t\n\tRead a list of commits from stdin and commit them in reverse\n\torder.  Only the leading sha1 is read from each line, so\n\tgit-rev-list --pretty=oneline output can be used.\n\n--rmdir::\n\tOnly used with the 'commit' command.\n\n\tRemove directories from the SVN tree if there are no files left\n\tbehind.  SVN can version empty directories, and they are not\n\tremoved by default if there are no files left in them.  git\n\tcannot version empty directories.  Enabling this flag will make\n\tthe commit to SVN act like git.\n\n-e::\n--edit::\n\tOnly used with the 'commit' command.\n\t\n\tEdit the commit message before committing to SVN.  This is off by\n\tdefault for objects that are commits, and forced on when committing\n\ttree objects.\n\nCOMPATIBILITY OPTIONS\n---------------------\n--no-ignore-externals::\n\tOnly used with the 'fetch' and 'rebuild' command.\n\n\tBy default, git-svn passes --ignore-externals to svn to avoid\n\tfetching svn:external trees into git.  Pass this flag to enable\n\texternals tracking directly via git.\n\n\tVersions of svn that do not support --ignore-externals are\n\tautomatically detected and this flag will be automatically\n\tenabled for them.\n\n\tOtherwise, do not enable this flag unless you know what you're\n\tdoing.\n\n--no-stop-on-copy::\n\tOnly used with the 'fetch' command.\n\n\tBy default, git-svn passes --stop-on-copy to avoid dealing with\n\tthe copied/renamed branch directory problem entirely.  A\n\tcopied/renamed branch is the result of a <SVN_URL> being created\n\tin the past from a different source.  These are problematic to\n\tdeal with even when working purely with svn if you work inside\n\tsubdirectories.\n\n\tDo not use this flag unless you know exactly what you're getting\n\tyourself into.  You have been warned.\n\nExamples\n~~~~~~~~\n\nTracking and contributing to an Subversion managed-project:\n\n# Initialize a tree (like git init-db)::\n\tgit-svn init http://svn.foo.org/project/trunk\n# Fetch remote revisions::\n\tgit-svn fetch\n# Create your own branch to hack on::\n\tgit checkout -b my-branch git-svn-HEAD\n# Commit only the git commits you want to SVN::\n\tgit-svn commit <tree-ish> [<tree-ish_2> ...] \n# Commit all the git commits from my-branch that don't exist in SVN::\n\tgit rev-list --pretty=oneline git-svn-HEAD..my-branch | git-svn commit\n# Something is committed to SVN, pull the latest into your branch::\n\tgit-svn fetch && git pull . git-svn-HEAD\n\nDESIGN PHILOSOPHY\n-----------------\nMerge tracking in Subversion is lacking and doing branched development\nwith Subversion is cumbersome as a result.  git-svn completely forgoes\nany automated merge/branch tracking on the Subversion side and leaves it\nentirely up to the user on the git side.  It's simply not worth it to do\na useful translation when the the original signal is weak.\n\nTRACKING MULTIPLE REPOSITORIES OR BRANCHES\n------------------------------------------\nThis is for advanced users, most users should ignore this section.\n\nBecause git-svn does not care about relationships between different\nbranches or directories in a Subversion repository, git-svn has a simple\nhack to allow it to track an arbitrary number of related _or_ unrelated\nSVN repositories via one git repository.  Simply set the GIT_SVN_ID\nenvironment variable to a name other other than \"git-svn\" (the default)\nand git-svn will ignore the contents of the $GIT_DIR/git-svn directory\nand instead do all of its work in $GIT_DIR/$GIT_SVN_ID for that\ninvocation.\n\nADDITIONAL FETCH ARGUMENTS\n--------------------------\nThis is for advanced users, most users should ignore this section.\n\nUnfetched SVN revisions may be imported as children of existing commits\nby specifying additional arguments to 'fetch'.  Additional parents may\noptionally be specified in the form of sha1 hex sums at the\ncommand-line.  Unfetched SVN revisions may also be tied to particular\ngit commits with the following syntax:\n\t\t\n\tsvn_revision_number=git_commit_sha1\n\nThis allows you to tie unfetched SVN revision 375 to your current HEAD::\n\n\tgit-svn fetch 375=$(git-rev-parse HEAD)\n\nBUGS\n----\nIf somebody commits a conflicting changeset to SVN at a bad moment\n(right before you commit) causing a conflict and your commit to fail,\nyour svn working tree ($GIT_DIR/git-svn/tree) may be dirtied.  The\neasiest thing to do is probably just to rm -rf $GIT_DIR/git-svn/tree and\nrun 'rebuild'.\n\nWe ignore all SVN properties except svn:executable.  Too difficult to\nmap them since we rely heavily on git write-tree being _exactly_ the\nsame on both the SVN and git working trees and I prefer not to clutter\nworking trees with metadata files.\n\nsvn:keywords can't be ignored in Subversion (at least I don't know of\na way to ignore them).\n\nAuthor\n------\nWritten by Eric Wong <normalperson@yhbt.net>.\n\nDocumentation\n-------------\nWritten by Eric Wong <normalperson@yhbt.net>.\n"},{"id":"16254","messageId":"7v4q2zg2an.fsf@assigned-by-dhcp.cox.net","threadId":"3355","inReplyTo":"20060216073826.GA12055@hand.yhbt.net","subject":"Re: [ANNOUNCE] git-svn - bidirection operations between svn and git","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-16T08:01:36Z","receivedAt":"2006-02-16T08:01:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n> @ Junio: Is there room for this in the git distribution alongside\n> git-svnimport?\n\nSurely.  Things that superficially do similar things are not\nnecessarily mutually exclusive, if that is what you are worried\nabout.  There is not much incumbent advantage for tools that\nsupport a narrowly defined specific task (e.g. interfacing with\nforeign SCM X) on the periphery, while I would perhaps feel more\nhesitant to support 47 different variants of git-commit ;-).\n\nEspecially, from your description (I haven't looked at the\ncode), its point is to give a better support for an alternative\nworkflow from svnimport supports.\n\nI was privately advised (by somebody I respect and trust) that I\nshould not be too hesitant to expand the scope of the project.\nAlso there are some interesting developments such as Martin's\ngit-backed fake CVS server and Aneesh's gitview that I have been\ninterested in, among other things.\n\nEven having some experimental tools that are only starting to do\nuseful things might be useful, if we had it in the git.git\nrepository.  For one thing, it would give more exposure to them\nand help improve things.\n\nHow about first adding a contrib/ directory and see how it goes?\n"},{"id":"16255","messageId":"cc723f590602160008v5fcc0e35h6d9296bd0572fac2@mail.gmail.com","threadId":"3355","inReplyTo":"7v4q2zg2an.fsf@assigned-by-dhcp.cox.net","subject":"Re: [ANNOUNCE] git-svn - bidirection operations between svn and git","fromName":"Aneesh Kumar","fromEmail":"aneesh.kumar@gmail.com","sentAt":"2006-02-16T08:08:56Z","receivedAt":"2006-02-16T08:08:56Z","isPatch":false,"sender":{"key":"aneesh.kumar@gmail.com","avatar":"https://gravatar.com/avatar/0621fc0b2f14ead1e9024382f16053a808c148596da30c1b92572fa075621f68?d=mp&s=160"},"body":"On 2/16/06, Junio C Hamano <junkio@cox.net> wrote:\n>\n>\n> should not be too hesitant to expand the scope of the project.\n> Also there are some interesting developments such as Martin's\n> git-backed fake CVS server and Aneesh's gitview that I have been\n> interested in, among other things.\n>\n> Even having some experimental tools that are only starting to do\n> useful things might be useful, if we had it in the git.git\n> repository.  For one thing, it would give more exposure to them\n> and help improve things.\n>\n> How about first adding a contrib/ directory and see how it goes?\n>\n\n\nI am all for it. Attaching the latest gitview. This include branch and\ntag display support and also the  option to save diffs in file.\n\nFor the screenshot\nhttp://kvaneesh.livejournal.com\n\n-aneesh\n"},{"id":"16256","messageId":"7vr763emwx.fsf@assigned-by-dhcp.cox.net","threadId":"3355","inReplyTo":"cc723f590602160008v5fcc0e35h6d9296bd0572fac2@mail.gmail.com","subject":"Re: [ANNOUNCE] git-svn - bidirection operations between svn and git","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-16T08:19:10Z","receivedAt":"2006-02-16T08:19:10Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Aneesh Kumar <aneesh.kumar@gmail.com> writes:\n\n> On 2/16/06, Junio C Hamano <junkio@cox.net> wrote:\n>>\n>> How about first adding a contrib/ directory and see how it goes?\n>\n> I am all for it. Attaching the latest gitview. This include branch and\n> tag display support and also the  option to save diffs in file.\n\nNow how do you want to proceed?  I could just dump the thing in\nsay contrib/gitview subdirectory, and then afterwards you could\neither keep feeding me patches or sending me pull requests.\n\nThere are two downsides doing things that way:\n\n (1) you would lose the development history so far;\n\n (2) if gitview script is the only thing you care about, I\n     suspect you would want to have that at the project\n     toplevel, like the \"coolest merge ever\" gitk merge did, but\n     that is not what you will be getting.\n\nIdeally, if we had a proper \"subproject\" support, I would merge\nyour project with full development history so far as a\nsubproject, with your toplevel grafted at contrib/gitview\nsubdirectory.  That would not have neither of the above two\ndownsides.  But that hasn't happened yet (and that was one of\nthe reasons that I was reluctant initially -- I was hoping that\nsubproject stuff would materialize sooner).\n\nFor now, I'd do the easy approach (easy for me, that is) with\nboth of the two downsides.  If we end up doing \"subproject\"\nthing, we could rectify things later, if this is OK with you.\n"},{"id":"16257","messageId":"cc723f590602160030n498b18edla328f7c64d44c04a@mail.gmail.com","threadId":"3355","inReplyTo":"7vr763emwx.fsf@assigned-by-dhcp.cox.net","subject":"Re: [ANNOUNCE] git-svn - bidirection operations between svn and git","fromName":"Aneesh Kumar","fromEmail":"aneesh.kumar@gmail.com","sentAt":"2006-02-16T08:30:20Z","receivedAt":"2006-02-16T08:30:20Z","isPatch":false,"sender":{"key":"aneesh.kumar@gmail.com","avatar":"https://gravatar.com/avatar/0621fc0b2f14ead1e9024382f16053a808c148596da30c1b92572fa075621f68?d=mp&s=160"},"body":"On 2/16/06, Junio C Hamano <junkio@cox.net> wrote:\n> Aneesh Kumar <aneesh.kumar@gmail.com> writes:\n>\n> > On 2/16/06, Junio C Hamano <junkio@cox.net> wrote:\n> >>\n> >> How about first adding a contrib/ directory and see how it goes?\n> >\n> > I am all for it. Attaching the latest gitview. This include branch and\n> > tag display support and also the  option to save diffs in file.\n>\n> Now how do you want to proceed?  I could just dump the thing in\n> say contrib/gitview subdirectory, and then afterwards you could\n> either keep feeding me patches or sending me pull requests.\n>\n> There are two downsides doing things that way:\n>\n>  (1) you would lose the development history so far;\n>\n>  (2) if gitview script is the only thing you care about, I\n>      suspect you would want to have that at the project\n>      toplevel, like the \"coolest merge ever\" gitk merge did, but\n>      that is not what you will be getting.\n>\n> Ideally, if we had a proper \"subproject\" support, I would merge\n> your project with full development history so far as a\n> subproject, with your toplevel grafted at contrib/gitview\n> subdirectory.  That would not have neither of the above two\n> downsides.  But that hasn't happened yet (and that was one of\n> the reasons that I was reluctant initially -- I was hoping that\n> subproject stuff would materialize sooner).\n>\n> For now, I'd do the easy approach (easy for me, that is) with\n> both of the two downsides.  If we end up doing \"subproject\"\n> thing, we could rectify things later, if this is OK with you.\n>\n\n\nIt would be fine with me if you just  drop the script to\ncontrib/gitview directory.\n\n-aneesh\n"},{"id":"16260","messageId":"20060216084859.GB12055@hand.yhbt.net","threadId":"3355","inReplyTo":"7v4q2zg2an.fsf@assigned-by-dhcp.cox.net","subject":"Re: [ANNOUNCE] git-svn - bidirection operations between svn and git","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-02-16T08:48:59Z","receivedAt":"2006-02-16T08:48:59Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Junio C Hamano <junkio@cox.net> wrote:\n> Eric Wong <normalperson@yhbt.net> writes:\n> \n> > @ Junio: Is there room for this in the git distribution alongside\n> > git-svnimport?\n> \n> Surely.  Things that superficially do similar things are not\n> necessarily mutually exclusive, if that is what you are worried\n> about.  There is not much incumbent advantage for tools that\n> support a narrowly defined specific task (e.g. interfacing with\n> foreign SCM X) on the periphery, while I would perhaps feel more\n> hesitant to support 47 different variants of git-commit ;-).\n\n<snip>\n \n> Even having some experimental tools that are only starting to do\n> useful things might be useful, if we had it in the git.git\n> repository.  For one thing, it would give more exposure to them\n> and help improve things.\n\nGood to know.  I fully agree on this point.\n\n> How about first adding a contrib/ directory and see how it goes?\n\nSure thing.  Don't worry about development history, there's hardly any\nas it was all done pretty quickly.  Being able to draw from my\nexperiences with svn-arch-mirror, arch-svn-merge (this one sucked), and\ngit-archimport helped greatly; as did the very simple and flexible\nnature of git.\n\n-- \nEric Wong\n"},{"id":"16262","messageId":"7vmzgrbqy0.fsf@assigned-by-dhcp.cox.net","threadId":"3355","inReplyTo":"cc723f590602160030n498b18edla328f7c64d44c04a@mail.gmail.com","subject":"Re: [ANNOUNCE] git-svn - bidirection operations between svn and git","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-16T09:20:23Z","receivedAt":"2006-02-16T09:20:23Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Aneesh Kumar <aneesh.kumar@gmail.com> writes:\n\n> It would be fine with me if you just  drop the script to\n> contrib/gitview directory.\n\nOK.  One final question.  Actually, two.  Is the original author\nScott James Remnant OK with adding the script to a GPLv2\nproject?  Also do you want your HP affiliation appear in the\nauthor field or your gmail address?\n"},{"id":"16269","messageId":"cc723f590602160320p7d551c58q96f6882c97e8422b@mail.gmail.com","threadId":"3355","inReplyTo":"7vmzgrbqy0.fsf@assigned-by-dhcp.cox.net","subject":"Re: [ANNOUNCE] git-svn - bidirection operations between svn and git","fromName":"Aneesh Kumar","fromEmail":"aneesh.kumar@gmail.com","sentAt":"2006-02-16T11:20:01Z","receivedAt":"2006-02-16T11:20:01Z","isPatch":false,"sender":{"key":"aneesh.kumar@gmail.com","avatar":"https://gravatar.com/avatar/0621fc0b2f14ead1e9024382f16053a808c148596da30c1b92572fa075621f68?d=mp&s=160"},"body":"On 2/16/06, Junio C Hamano <junkio@cox.net> wrote:\n> Aneesh Kumar <aneesh.kumar@gmail.com> writes:\n>\n> > It would be fine with me if you just  drop the script to\n> > contrib/gitview directory.\n>\n> OK.  One final question.  Actually, two.  Is the original author\n> Scott James Remnant OK with adding the script to a GPLv2\n> project?  Also do you want your HP affiliation appear in the\n> author field or your gmail address?\n>\n>\n>\n\nScott James code was motivation to start the project. But if you\ncompare the two code lot of changes are done. Infact only thing that\nremain now is how i draw using the cairo which is also modified a bit.\n\nThis is the COPYING file that scott had in bzrk project.\n\nhttp://people.ubuntu.com/~scott/bzr/bzrk/COPYING\n\nBut gitview is quiet different from bzrk. I just wanted to add it to\nthe code that i started with bzrk code.\n\nRegarding HP affiliation i guess it should remain. In short you can\nadd the file as I send you\n\n-aneesh\n"},{"id":"16270","messageId":"20060216115707.GP31278@pasky.or.cz","threadId":"3355","inReplyTo":"cc723f590602160320p7d551c58q96f6882c97e8422b@mail.gmail.com","subject":"Re: [ANNOUNCE] git-svn - bidirection operations between svn and git","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-02-16T11:57:07Z","receivedAt":"2006-02-16T11:57:07Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Thu, Feb 16, 2006 at 12:20:01PM CET, I got a letter\nwhere Aneesh Kumar <aneesh.kumar@gmail.com> said that...\n> Scott James code was motivation to start the project. But if you\n> compare the two code lot of changes are done. Infact only thing that\n> remain now is how i draw using the cairo which is also modified a bit.\n> \n> This is the COPYING file that scott had in bzrk project.\n> \n> http://people.ubuntu.com/~scott/bzr/bzrk/COPYING\n> \n> But gitview is quiet different from bzrk. I just wanted to add it to\n> the code that i started with bzrk code.\n\nIANAL but AFAIK even if the code is quite different by now, if you\n_started_ with bzrk code the copyright of the original author is still\nlurking inside your code - it's basically a continuous series of\ndirectly derived works.\n\nOTOH, what am I not getting? The bzrk's license seems to be GPLv2, our\nlicense seems to be GPLv2, ...\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nOf the 3 great composers Mozart tells us what it's like to be human,\nBeethoven tells us what it's like to be Beethoven and Bach tells us\nwhat it's like to be the universe.  -- Douglas Adams\n"},{"id":"16271","messageId":"cc723f590602160401gda03e31lfd43545a1a317d0d@mail.gmail.com","threadId":"3355","inReplyTo":"20060216115707.GP31278@pasky.or.cz","subject":"Re: [ANNOUNCE] git-svn - bidirection operations between svn and git","fromName":"Aneesh Kumar","fromEmail":"aneesh.kumar@gmail.com","sentAt":"2006-02-16T12:01:03Z","receivedAt":"2006-02-16T12:01:03Z","isPatch":false,"sender":{"key":"aneesh.kumar@gmail.com","avatar":"https://gravatar.com/avatar/0621fc0b2f14ead1e9024382f16053a808c148596da30c1b92572fa075621f68?d=mp&s=160"},"body":"On 2/16/06, Petr Baudis <pasky@suse.cz> wrote:\n> Dear diary, on Thu, Feb 16, 2006 at 12:20:01PM CET, I got a letter\n> where Aneesh Kumar <aneesh.kumar@gmail.com> said that...\n> > Scott James code was motivation to start the project. But if you\n> > compare the two code lot of changes are done. Infact only thing that\n> > remain now is how i draw using the cairo which is also modified a bit.\n> >\n> > This is the COPYING file that scott had in bzrk project.\n> >\n> > http://people.ubuntu.com/~scott/bzr/bzrk/COPYING\n> >\n> > But gitview is quiet different from bzrk. I just wanted to add it to\n> > the code that i started with bzrk code.\n>\n> IANAL but AFAIK even if the code is quite different by now, if you\n> _started_ with bzrk code the copyright of the original author is still\n> lurking inside your code - it's basically a continuous series of\n> directly derived works.\n>\n> OTOH, what am I not getting? The bzrk's license seems to be GPLv2, our\n> license seems to be GPLv2, ...\n>\n>\n\nCorrect. That way i guess we can add the code the way i sent. In any\ncase i am marking this mail to scott. So if  he has anything to add he\ncan let us know\n\n-aneesh\n"},{"id":"16274","messageId":"20060216134248.GC4271@duckman.conectiva","threadId":"3355","inReplyTo":"20060216073826.GA12055@hand.yhbt.net","subject":"Re: [ANNOUNCE] git-svn - bidirection operations between svn and git","fromName":"Eduardo Pereira Habkost","fromEmail":"ehabkost@mandriva.com","sentAt":"2006-02-16T13:42:48Z","receivedAt":"2006-02-16T13:42:48Z","isPatch":false,"sender":{"key":"ehabkost@mandriva.com","avatar":null},"body":"On Wed, Feb 15, 2006 at 11:38:26PM -0800, Eric Wong wrote:\n> Hello, I've written a simple tool for interoperating between git and\n> svn.  I wrote this so I could use git to work on projects where other\n> developers use Subversion.  I really hate using svn, but some projects I\n> work on require it, and svk isn't nearly as fast nor simple as git.\n\nGreat, I was doing some testing with git-svnimport for this, but I missed\na tool to automatically commit to svn what I have in my GIT tree.\n\n> \n> git-svn does not replace git-svnimport, git-svnimport handles branches\n> and tags automatically, but is too inflexible about repository layouts\n> to be useful for a good number of projects I follow, and of course\n> git-svnimport can't commit to Subversion repositories :)\n\nI am already using git-svnimport to keep a \"mirror\" of some subversion\nrepositories, here (automatically udpated on crontab). Do you plan to\nallow \"integration\" with repositories that are just clones of\ngit-svnimport'ed repositories?\n\nI plan to keep using git-svnimport and the standard git tools to work\nusing the \"svn mirror on git\" as the main repository, but I plan to use\n\"git-svn commit\" to commit to the SVN repositories. I want this \"commit\ntool\" to not affect the current repository in any way, just like git-push:\nonly send the commits to the remote repository and don't change anything\nin the local repository.\n\nHowever, it seems that \"git-svn commit\" does some tasks assuming we\nare on a \"git-svn aware\" repository (e.g. the \"resyncing\" just after\nthe commit). Would you accept patches to allow using \"git-svn commit\"\nto commit changes from any GIT repository (i.e. not \"svn-git aware\"\nrepositories) to any SVN repository, just like \"git-push\" would work\nfor a GIT repository?\n\nHowever, I am not sure if the easier way would be changing git-svn to\ndo this for me or writing a different script just for this task.\n\n> \n> git-svn only cares about a single branch/trunk in SVN[1], but you can\n> use as many branches in git as you want.  This makes it much easier to\n> use and allows it to handle just about any repository layout, not just\n> those recommended in the SVN book/developers.\n> \n> Although importing changesets from SVN is mostly a linear affair,\n> committing to SVN is the opposite.  You may commit git tree objects in\n> any order you want.  It simply clobbers the existing svn tree as\n> 'git-checkout -f' would, but tags file renames/copies carefully so users\n> on the SVN side can see them.  You can even do some wacky things with\n> patch reordering.\n\nGood, this is what I expect to be able to do when commiting to svn.\n\n-- \nEduardo\n"},{"id":"16284","messageId":"20060216192550.GD12055@hand.yhbt.net","threadId":"3355","inReplyTo":"20060216134248.GC4271@duckman.conectiva","subject":"Re: [ANNOUNCE] git-svn - bidirection operations between svn and git","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-02-16T19:25:50Z","receivedAt":"2006-02-16T19:25:50Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Eduardo Pereira Habkost <ehabkost@mandriva.com> wrote:\n> On Wed, Feb 15, 2006 at 11:38:26PM -0800, Eric Wong wrote:\n> > Hello, I've written a simple tool for interoperating between git and\n> > svn.  I wrote this so I could use git to work on projects where other\n> > developers use Subversion.  I really hate using svn, but some projects I\n> > work on require it, and svk isn't nearly as fast nor simple as git.\n> \n> Great, I was doing some testing with git-svnimport for this, but I missed\n> a tool to automatically commit to svn what I have in my GIT tree.\n> \n> > \n> > git-svn does not replace git-svnimport, git-svnimport handles branches\n> > and tags automatically, but is too inflexible about repository layouts\n> > to be useful for a good number of projects I follow, and of course\n> > git-svnimport can't commit to Subversion repositories :)\n> \n> I am already using git-svnimport to keep a \"mirror\" of some subversion\n> repositories, here (automatically udpated on crontab). Do you plan to\n> allow \"integration\" with repositories that are just clones of\n> git-svnimport'ed repositories?\n\nIt's possible, just not very obvious at the moment.  git-svn was written\nas quickly as possible without regard to svnimport compatibility since I\nhad some repos that didn't work with svnimport to begin with.\n\nThe 'ADDITIONAL FETCH ARGUMENTS' part of the manpage is worth reading\nfor you.  Basically, you can define equalities\n\"(svn revision number)=(git commit)\" as arguments to git-svn fetch to \nadd parents for all the revisions it imports.\n\nIf I were you, I'd only want git-svn to care about partial history,\nsince you already have the rest of it from git-svnimport.  You can do\nthis:\n\n\tsvn_revno=<last svn revision number you imported from git-svnimport>\n\tgit_commit=<equivalent commit sha1 name of svn_revno above>\n\tgit-svn fetch --revision $svn_revno:HEAD $svn_revno=$git_commit\n\n> I plan to keep using git-svnimport and the standard git tools to work\n> using the \"svn mirror on git\" as the main repository, but I plan to use\n> \"git-svn commit\" to commit to the SVN repositories. I want this \"commit\n> tool\" to not affect the current repository in any way, just like git-push:\n> only send the commits to the remote repository and don't change anything\n> in the local repository.\n \n> However, it seems that \"git-svn commit\" does some tasks assuming we\n> are on a \"git-svn aware\" repository (e.g. the \"resyncing\" just after\n> the commit). Would you accept patches to allow using \"git-svn commit\"\n> to commit changes from any GIT repository (i.e. not \"svn-git aware\"\n> repositories) to any SVN repository, just like \"git-push\" would work\n> for a GIT repository?\n>\n> However, I am not sure if the easier way would be changing git-svn to\n> do this for me or writing a different script just for this task.\n\nYou should be 95% there just by exporting the svn_checkout_tree()\nfunction to the command-line.  Perhaps automating reading of the\n$svn_rev variable can be in order.\n\n-- \nEric Wong\n"},{"id":"16285","messageId":"20060216194751.GB4446@Muzzle","threadId":"3355","inReplyTo":"20060216073826.GA12055@hand.yhbt.net","subject":"[PATCH] git-svn: fix revision order when XML::Simple is not loaded","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-02-16T19:47:51Z","receivedAt":"2006-02-16T19:47:51Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Thanks to Emmanuel Guerin for finding the bug.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n\n---\n\n contrib/git-svn/git-svn |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\n98de7584b4991ab9c4025e36bfbfc10eacd17b8d\ndiff --git a/contrib/git-svn/git-svn b/contrib/git-svn/git-svn\nindex 62fc14f..ddd9579 100755\n--- a/contrib/git-svn/git-svn\n+++ b/contrib/git-svn/git-svn\n@@ -523,7 +523,7 @@ sub svn_log_raw {\n \n \t\t\t# if we have an empty log message, put something there:\n \t\t\tif (@svn_log) {\n-\t\t\t\t$svn_log[0]->{msg} ||= \"\\n\";\n+\t\t\t\t$svn_log[$#svn_log]->{msg} ||= \"\\n\";\n \t\t\t}\n \t\t\tnext;\n \t\t}\n@@ -538,7 +538,7 @@ sub svn_log_raw {\n \t\t\t\t\tdate => \"$tz $Y-$m-$d $H:$M:$S\",\n \t\t\t\t\tauthor => $author,\n \t\t\t\t\tmsg => '' );\n-\t\t\tunshift @svn_log, \\%log_msg;\n+\t\t\tpush @svn_log, \\%log_msg;\n \t\t\t$state = 'msg_start';\n \t\t\tnext;\n \t\t}\n@@ -546,7 +546,7 @@ sub svn_log_raw {\n \t\tif ($state eq 'msg_start' && /^$/) {\n \t\t\t$state = 'msg';\n \t\t} elsif ($state eq 'msg') {\n-\t\t\t$svn_log[0]->{msg} .= $_.\"\\n\";\n+\t\t\t$svn_log[$#svn_log]->{msg} .= $_.\"\\n\";\n \t\t}\n \t}\n \tclose $log_fh or croak $?;\n-- \n1.2.0.gdee6\n"},{"id":"16288","messageId":"20060216214402.GA19155@hand.yhbt.net","threadId":"3355","inReplyTo":"20060216194751.GB4446@Muzzle","subject":"Re: [PATCH] git-svn: fix revision order when XML::Simple is not loaded","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-02-16T21:44:02Z","receivedAt":"2006-02-16T21:44:02Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Just to add, XML::Simple is a recommended dependency.  git-svn will work\nfine without it (after this patch) as long as the repository doesn't\nhave any log messages that regurgitate or otherwise look like svn log\noutput (most svn repositories are sane in this regard :)\n\nI may add support for the SVN:: perl libraries in the future, but I'll\nalways git-svn compatible with the command-line svn client and lazy load\nany non-standard libraries.\n\n-- \nEric Wong\n"},{"id":"16295","messageId":"20060217021332.GA11061@Muzzle","threadId":"3355","inReplyTo":"20060216194751.GB4446@Muzzle","subject":"[PATCH] git-svn: ensure fetch always works chronologically.","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-02-17T02:13:32Z","receivedAt":"2006-02-17T02:13:32Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"We run svn log against a URL without a working copy for the first fetch,\nso we end up a log that's sorted from highest to lowest.  That's bad, we\nalways want lowest to highest.  Just default to --revision 0:HEAD now if\n-r isn't specified for the first fetch.\n\nAlso sort the revisions after we get them just in case somebody\naccidentally reverses the argument to --revision for whatever reason.\n\nThanks again to Emmanuel Guerin for helping me find this.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n\n---\n\n contrib/git-svn/git-svn |    7 ++++---\n 1 files changed, 4 insertions(+), 3 deletions(-)\n\n2ec4f205eaa3914a64205ea224292b9e27e06cdf\ndiff --git a/contrib/git-svn/git-svn b/contrib/git-svn/git-svn\nindex ddd9579..2caf057 100755\n--- a/contrib/git-svn/git-svn\n+++ b/contrib/git-svn/git-svn\n@@ -168,14 +168,15 @@ sub fetch {\n \tmy (@parents) = @_;\n \t$SVN_URL ||= file_to_s(\"$GIT_DIR/$GIT_SVN/info/url\");\n \tmy @log_args = -d $SVN_WC ? ($SVN_WC) : ($SVN_URL);\n-\tif (-d $SVN_WC && !$_revision) {\n-\t\t$_revision = 'BASE:HEAD';\n+\tunless ($_revision) {\n+\t\t$_revision = -d $SVN_WC ? 'BASE:HEAD' : '0:HEAD';\n \t}\n-\tpush @log_args, \"-r$_revision\" if $_revision;\n+\tpush @log_args, \"-r$_revision\";\n \tpush @log_args, '--stop-on-copy' unless $_no_stop_copy;\n \n \teval { require XML::Simple or croak $! };\n \tmy $svn_log = $@ ? svn_log_raw(@log_args) : svn_log_xml(@log_args);\n+\t@$svn_log = sort { $a->{revision} <=> $b->{revision} } @$svn_log;\n \n \tmy $base = shift @$svn_log or croak \"No base revision!\\n\";\n \tmy $last_commit = undef;\n-- \n1.2.0.gdee6\n"}]}