{"thread":{"id":"3467","subject":"[PATCH] contrib/git-svn: version 0.10.0","startedAt":"2006-02-26T10:22:27Z","lastAt":"2006-02-27T00:16:08Z","messageCount":6,"participants":["Eric Wong","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"16747","messageId":"11409493472879-git-send-email-normalperson@yhbt.net","threadId":"3467","inReplyTo":"11409493473344-git-send-email-normalperson@yhbt.net","subject":"[PATCH] contrib/git-svn: version 0.10.0","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-02-26T10:22:27Z","receivedAt":"2006-02-26T10:22:27Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"New features deserve an increment of the minor version.  This will very\nlikely become 1.0.0 unless release-critical bugs are found.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n\n---\n\n contrib/git-svn/git-svn.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\n8d35c4193507147a6caa8a25b0ed1e5e9c43a49c\ndiff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl\nindex 29c8690..9f12836 100755\n--- a/contrib/git-svn/git-svn.perl\n+++ b/contrib/git-svn/git-svn.perl\n@@ -8,7 +8,7 @@ use vars qw/\t$AUTHOR $VERSION\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.1';\n+$VERSION = '0.10.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-- \n1.2.2.ga559\n"},{"id":"16748","messageId":"11409493473344-git-send-email-normalperson@yhbt.net","threadId":"3467","inReplyTo":"11409493473353-git-send-email-normalperson@yhbt.net","subject":"[PATCH] contrib/git-svn: optimize sequential commits to svn","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-02-26T10:22:27Z","receivedAt":"2006-02-26T10:22:27Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Avoid running 'svn up' to a previous revision if we know the\nrevision we just committed is the first descendant of the\nrevision we came from.\n\nThis reduces the time to do a series of commits by about 25%.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n\n---\n\n contrib/git-svn/git-svn.perl |   30 +++++++++++++++++++++++++++---\n 1 files changed, 27 insertions(+), 3 deletions(-)\n\nea810425ed7d5d16c12b3f49246ba2a03ac3d23d\ndiff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl\nindex 84d43de..29c8690 100755\n--- a/contrib/git-svn/git-svn.perl\n+++ b/contrib/git-svn/git-svn.perl\n@@ -30,6 +30,7 @@ use File::Basename qw/dirname basename/;\n use File::Path qw/mkpath/;\n use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;\n use File::Spec qw//;\n+use POSIX qw/strftime/;\n my $sha1 = qr/[a-f\\d]{40}/;\n my $sha1_short = qr/[a-f\\d]{6,40}/;\n my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit,\n@@ -591,6 +592,7 @@ sub handle_rmdir {\n sub svn_commit_tree {\n \tmy ($svn_rev, $commit) = @_;\n \tmy $commit_msg = \"$GIT_DIR/$GIT_SVN/.svn-commit.tmp.$$\";\n+\tmy %log_msg = ( msg => '' );\n \topen my $msg, '>', $commit_msg  or croak $!;\n \n \tchomp(my $type = `git-cat-file -t $commit`);\n@@ -606,6 +608,7 @@ sub svn_commit_tree {\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\t$log_msg{msg} .= $_;\n \t\t\t\tprint $msg $_ or croak $!;\n \t\t\t}\n \t\t}\n@@ -625,9 +628,30 @@ sub svn_commit_tree {\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+\tmy @svn_up = qw(svn up);\n \tpush @svn_up, '--ignore-externals' unless $_no_ignore_ext;\n+\tif ($rev_committed == ($svn_rev + 1)) {\n+\t\tpush @svn_up, \"-r$rev_committed\";\n+\t\tsys(@svn_up);\n+\t\tmy $info = svn_info('.');\n+\t\tmy $date = $info->{'Last Changed Date'} or die \"Missing date\\n\";\n+\t\tif ($info->{'Last Changed Rev'} != $rev_committed) {\n+\t\t\tcroak \"$info->{'Last Changed Rev'} != $rev_committed\\n\"\n+\t\t}\n+\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$log_msg{date} = \"$tz $Y-$m-$d $H:$M:$S\";\n+\t\t$log_msg{author} = $info->{'Last Changed Author'};\n+\t\t$log_msg{revision} = $rev_committed;\n+\t\t$log_msg{msg} .= \"\\n\";\n+\t\tmy $parent = file_to_s(\"$REV_DIR/$svn_rev\");\n+\t\tgit_commit(\\%log_msg, $parent, $commit);\n+\t\treturn $rev_committed;\n+\t}\n+\t# resync immediately\n+\tpush @svn_up, \"-r$svn_rev\";\n \tsys(@svn_up);\n \treturn fetch(\"$rev_committed=$commit\")->{revision};\n }\n@@ -724,7 +748,7 @@ sub svn_info {\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\tif (m#^([^:]+)\\s*:\\s*(\\S.*)$#) {\n \t\t\t$ret->{$1} = $2;\n \t\t\tpush @{$ret->{-order}}, $1;\n \t\t}\n-- \n1.2.2.ga559\n"},{"id":"16749","messageId":"11409493473353-git-send-email-normalperson@yhbt.net","threadId":"3467","inReplyTo":null,"subject":"[PATCH] contrib/git-svn: add show-ignore command","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-02-26T10:22:27Z","receivedAt":"2006-02-26T10:22:27Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Recursively finds and lists the svn:ignore property on\ndirectories.  The output is suitable for appending to the\n$GIT_DIR/info/exclude file.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n\n---\n\n contrib/git-svn/git-svn.perl |   25 +++++++++++++++++++++++++\n contrib/git-svn/git-svn.txt  |    7 +++++++\n 2 files changed, 32 insertions(+), 0 deletions(-)\n\n0858c770ef3e0f440c20a255baaf4792b3201813\ndiff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl\nindex a32ce15..84d43de 100755\n--- a/contrib/git-svn/git-svn.perl\n+++ b/contrib/git-svn/git-svn.perl\n@@ -49,6 +49,7 @@ my %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+\t'show-ignore' => [ \\&show_ignore, \"Show svn:ignore listings\" ],\n \trebuild => [ \\&rebuild, \"Rebuild git-svn metadata (after git clone)\" ],\n \thelp => [ \\&usage, \"Show help\" ],\n );\n@@ -258,6 +259,30 @@ sub commit {\n \n }\n \n+sub show_ignore {\n+\trequire File::Find or die $!;\n+\tmy $exclude_file = \"$GIT_DIR/info/exclude\";\n+\topen my $fh, '<', $exclude_file or croak $!;\n+\tchomp(my @excludes = (<$fh>));\n+\tclose $fh or croak $!;\n+\t\n+\t$SVN_URL ||= file_to_s(\"$GIT_DIR/$GIT_SVN/info/url\");\n+\tchdir $SVN_WC or croak $!;\n+\tmy %ign;\n+\tFile::Find::find({wanted=>sub{if(lstat $_ && -d _ && -d \"$_/.svn\"){\n+\t\ts#^\\./##;\n+\t\t@{$ign{$_}} = safe_qx(qw(svn propget svn:ignore),$_);\n+\t\t}}, no_chdir=>1},'.');\n+\t\n+\tprint \"\\n# /\\n\";\n+\tforeach (@{$ign{'.'}}) { print '/',$_ if /\\S/ }\n+\tdelete $ign{'.'};\n+\tforeach my $i (sort keys %ign) {\n+\t\tprint \"\\n# \",$i,\"\\n\";\n+\t\tforeach (@{$ign{$i}}) { print '/',$i,'/',$_ if /\\S/ }\n+\t}\n+}\n+\n ########################### utility functions #########################\n \n sub setup_git_svn {\ndiff --git a/contrib/git-svn/git-svn.txt b/contrib/git-svn/git-svn.txt\nindex cf098d7..b4b7789 100644\n--- a/contrib/git-svn/git-svn.txt\n+++ b/contrib/git-svn/git-svn.txt\n@@ -61,6 +61,11 @@ rebuild::\n \tthe directory/repository you're tracking has moved or changed\n \tprotocols.\n \n+show-ignore::\n+\tRecursively finds and lists the svn:ignore property on\n+\tdirectories.  The output is suitable for appending to\n+\tthe $GIT_DIR/info/exclude file.\n+\n OPTIONS\n -------\n -r <ARG>::\n@@ -152,6 +157,8 @@ Tracking and contributing to an Subversi\n \tgit commit git-svn-HEAD..my-branch\n # Something is committed to SVN, pull the latest into your branch::\n \tgit-svn fetch && git pull . git-svn-HEAD\n+# Append svn:ignore settings to the default git exclude file:\n+\tgit-svn show-ignore >> .git/info/exclude\n \n DESIGN PHILOSOPHY\n -----------------\n-- \n1.2.2.ga559\n"},{"id":"16771","messageId":"7vlkvx7mve.fsf@assigned-by-dhcp.cox.net","threadId":"3467","inReplyTo":"11409493473353-git-send-email-normalperson@yhbt.net","subject":"Re: [PATCH] contrib/git-svn: add show-ignore command","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-26T22:53:41Z","receivedAt":"2006-02-26T22:53:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"After Andrew Morten raised the issue, I've made sure I _really_\nenable my pre-applypatch hook.\n\nPlease enable your pre-commit hook (comes with the distribution\nas a sample hook) to catch these trailing whitespaces before\nthey hit your commit objects.\n\nApplying 'contrib/git-svn: add show-ignore command'\n\n*\n* You have some suspicious patch lines:\n*\n* In contrib/git-svn/git-svn.perl\n* trailing whitespace (line 268)\ncontrib/git-svn/git-svn.perl:268:\t\n* trailing whitespace (line 276)\ncontrib/git-svn/git-svn.perl:276:\t\n"},{"id":"16775","messageId":"20060226234601.GA28732@localdomain","threadId":"3467","inReplyTo":"7vlkvx7mve.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] contrib/git-svn: add show-ignore command","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-02-26T23:46:01Z","receivedAt":"2006-02-26T23:46:01Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Junio C Hamano <junkio@cox.net> wrote:\n> After Andrew Morten raised the issue, I've made sure I _really_\n> enable my pre-applypatch hook.\n> \n> Please enable your pre-commit hook (comes with the distribution\n> as a sample hook) to catch these trailing whitespaces before\n> they hit your commit objects.\n\nOops, sorry about this one.  I forgot it on the directory I was working\non at the time.  I've also added Dave Jones' whitespace hilighter lines\nto my .vimrc as well.\n\n-- \nEric Wong\n"},{"id":"16780","messageId":"20060227001608.GB28732@localdomain","threadId":"3467","inReplyTo":"20060226234601.GA28732@localdomain","subject":"[PATCH] contrib/git-svn: add show-ignore command","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-02-27T00:16:08Z","receivedAt":"2006-02-27T00:16:08Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Recursively finds and lists the svn:ignore property on\ndirectories.  The output is suitable for appending to the\n$GIT_DIR/info/exclude file.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n\n---\n\n Note: Whitespace cleaned\n\n contrib/git-svn/git-svn.perl |   25 +++++++++++++++++++++++++\n contrib/git-svn/git-svn.txt  |    7 +++++++\n 2 files changed, 32 insertions(+), 0 deletions(-)\n\n63b497ce5f0762cdfef3ef30ec658b8c98e1a144\ndiff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl\nindex a32ce15..3d855f1 100755\n--- a/contrib/git-svn/git-svn.perl\n+++ b/contrib/git-svn/git-svn.perl\n@@ -49,6 +49,7 @@ my %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+\t'show-ignore' => [ \\&show_ignore, \"Show svn:ignore listings\" ],\n \trebuild => [ \\&rebuild, \"Rebuild git-svn metadata (after git clone)\" ],\n \thelp => [ \\&usage, \"Show help\" ],\n );\n@@ -258,6 +259,30 @@ sub commit {\n \n }\n \n+sub show_ignore {\n+\trequire File::Find or die $!;\n+\tmy $exclude_file = \"$GIT_DIR/info/exclude\";\n+\topen my $fh, '<', $exclude_file or croak $!;\n+\tchomp(my @excludes = (<$fh>));\n+\tclose $fh or croak $!;\n+\n+\t$SVN_URL ||= file_to_s(\"$GIT_DIR/$GIT_SVN/info/url\");\n+\tchdir $SVN_WC or croak $!;\n+\tmy %ign;\n+\tFile::Find::find({wanted=>sub{if(lstat $_ && -d _ && -d \"$_/.svn\"){\n+\t\ts#^\\./##;\n+\t\t@{$ign{$_}} = safe_qx(qw(svn propget svn:ignore),$_);\n+\t\t}}, no_chdir=>1},'.');\n+\n+\tprint \"\\n# /\\n\";\n+\tforeach (@{$ign{'.'}}) { print '/',$_ if /\\S/ }\n+\tdelete $ign{'.'};\n+\tforeach my $i (sort keys %ign) {\n+\t\tprint \"\\n# \",$i,\"\\n\";\n+\t\tforeach (@{$ign{$i}}) { print '/',$i,'/',$_ if /\\S/ }\n+\t}\n+}\n+\n ########################### utility functions #########################\n \n sub setup_git_svn {\ndiff --git a/contrib/git-svn/git-svn.txt b/contrib/git-svn/git-svn.txt\nindex cf098d7..b4b7789 100644\n--- a/contrib/git-svn/git-svn.txt\n+++ b/contrib/git-svn/git-svn.txt\n@@ -61,6 +61,11 @@ rebuild::\n \tthe directory/repository you're tracking has moved or changed\n \tprotocols.\n \n+show-ignore::\n+\tRecursively finds and lists the svn:ignore property on\n+\tdirectories.  The output is suitable for appending to\n+\tthe $GIT_DIR/info/exclude file.\n+\n OPTIONS\n -------\n -r <ARG>::\n@@ -152,6 +157,8 @@ Tracking and contributing to an Subversi\n \tgit commit git-svn-HEAD..my-branch\n # Something is committed to SVN, pull the latest into your branch::\n \tgit-svn fetch && git pull . git-svn-HEAD\n+# Append svn:ignore settings to the default git exclude file:\n+\tgit-svn show-ignore >> .git/info/exclude\n \n DESIGN PHILOSOPHY\n -----------------\n-- \n1.2.2.ga559\n"}]}