{"thread":{"id":"17577","subject":"[PATCH] git-svn: Print revision while searching for earliest use of path","startedAt":"2009-02-05T05:09:30Z","lastAt":"2009-02-09T21:22:44Z","messageCount":5,"participants":["Deskin Miller","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"103268","messageId":"1233810570-30765-1-git-send-email-deskinm@umich.edu","threadId":"17577","inReplyTo":null,"subject":"[PATCH] git-svn: Print revision while searching for earliest use of path","fromName":"Deskin Miller","fromEmail":"deskinm@umich.edu","sentAt":"2009-02-05T05:09:30Z","receivedAt":"2009-02-05T05:09:30Z","isPatch":true,"sender":{"key":"deskinm@umich.edu","avatar":"https://gravatar.com/avatar/d340a0e612cdf0a79535c71863c0b4c535e9aba63b42032226ae903e638b64f9?d=mp&s=160"},"body":"When initializing a git-svn repository from a Subversion repository, it\nis common to be interested in a path which did not exist in the initial\ncommit to Subversion.  In a large repository like e.g. Apache, this may\ntake some time while the user receives no additional feedback.  Print\nthe highest revision number scanned thus far to let the user know\nsomething is still happening.\n\nSigned-off-by: Deskin Miller <deskinm@umich.edu>\n---\nThis came about on account of patmaddox asking on #git why git-svn\nseemed to be hung on clone.  Despite the admonition that this might take\na long time, I also like to have some indication that progress is being\nmade.  My first version of this printed using '\\rChecked through\nr$revision' but the subsequent output line when the path is found ends\nup clobbered on the same line, and I'm not skilled enough at the\nterminal or Perl to address this cleanly.  If the current version is\nfelt to be too verbose since it is printing a new line, I'd be up for\nsquelching the output to e.g. every 1000 revisions or so.\n\nAnecdotally, it looks like Subversion looks for the path in blocks of\n100 revisions, so we get the nice whole revision number for free.  I\ncouldn't find any documentation on the proper format of the error\nmessage, so I just came up with the regular expressions to parse the\nrevision myself; if they need to be more explicit to avoid really\negregious path names, I can make an effort.\n\nI tested on both http:// and file:// transport, to come up with the\ndifferent error strings; since the error number for file is the same as\nsvn:// I'm hoping that the error string is the same too.  If someone can\nbounce this off a svn:// repo I'd appreciate it, otherwise I'll dig out\nthe documentation and set up a network-served svn repository myself\n(which is really my job as the patch author anyway).\n\nDeskin Miller\n\n git-svn.perl |    7 +++++++\n 1 files changed, 7 insertions(+), 0 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 79888a0..60b56be 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -4542,6 +4542,12 @@ sub skip_unknown_revs {\n \t#   More codes may be discovered later...\n \tif ($errno == 175007 || $errno == 175002 || $errno == 160013) {\n \t\tmy $err_key = $err->expanded_message;\n+\t\tmy $revision = $err_key;\n+\t\tif ($errno == 175007 || $errno == 175002 ) {\n+\t\t\t$revision =~ s/.*!svn\\/bc\\/(\\d+).*/$1/;\n+\t\t} elsif ($errno == 160013) {\n+\t\t\t$revision =~ s/.*File not found: revision (\\d+).*/$1/;\n+\t\t}\n \t\t# revision numbers change every time, filter them out\n \t\t$err_key =~ s/\\d+/\\0/g;\n \t\t$err_key = \"$errno\\0$err_key\";\n@@ -4555,6 +4561,7 @@ sub skip_unknown_revs {\n \t\t\t     \"This may take a while on large repositories\\n\";\n \t\t\t$ignored_err{$err_key} = 1;\n \t\t}\n+\t\tprint \"Checked through r$revision\\n\";\n \t\treturn;\n \t}\n \tdie \"Error from SVN, ($errno): \", $err->expanded_message,\"\\n\";\n-- \n1.6.1.399.g0d272\n"},{"id":"103275","messageId":"20090205064240.GA22926@dcvr.yhbt.net","threadId":"17577","inReplyTo":"1233810570-30765-1-git-send-email-deskinm@umich.edu","subject":"Re: [PATCH] git-svn: Print revision while searching for earliest use of path","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-02-05T06:42:40Z","receivedAt":"2009-02-05T06:42:40Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Deskin Miller <deskinm@umich.edu> wrote:\n> When initializing a git-svn repository from a Subversion repository, it\n> is common to be interested in a path which did not exist in the initial\n> commit to Subversion.  In a large repository like e.g. Apache, this may\n> take some time while the user receives no additional feedback.  Print\n> the highest revision number scanned thus far to let the user know\n> something is still happening.\n> \n> Signed-off-by: Deskin Miller <deskinm@umich.edu>\n> ---\n> This came about on account of patmaddox asking on #git why git-svn\n> seemed to be hung on clone.  Despite the admonition that this might take\n> a long time, I also like to have some indication that progress is being\n> made.  My first version of this printed using '\\rChecked through\n> r$revision' but the subsequent output line when the path is found ends\n> up clobbered on the same line, and I'm not skilled enough at the\n> terminal or Perl to address this cleanly.  If the current version is\n> felt to be too verbose since it is printing a new line, I'd be up for\n> squelching the output to e.g. every 1000 revisions or so.\n\nThis is definitely useful on slow/large repositories.  The current\noutput with newlines is fine by me.\n\n> Anecdotally, it looks like Subversion looks for the path in blocks of\n> 100 revisions, so we get the nice whole revision number for free.  I\n> couldn't find any documentation on the proper format of the error\n> message, so I just came up with the regular expressions to parse the\n> revision myself; if they need to be more explicit to avoid really\n> egregious path names, I can make an effort.\n> \n> I tested on both http:// and file:// transport, to come up with the\n> different error strings; since the error number for file is the same as\n> svn:// I'm hoping that the error string is the same too.  If someone can\n> bounce this off a svn:// repo I'd appreciate it, otherwise I'll dig out\n> the documentation and set up a network-served svn repository myself\n> (which is really my job as the patch author anyway).\n\nCouldn't we avoid the trouble of parsing the inconsistent error\nmessages by printing this status message after the get_log() calls\nin gs_fetch_loop_common() ?\n\n-- \nEric Wong\n"},{"id":"103332","messageId":"86d4c5e00902050542n74b10bfdw5e9249ac23fdc9e7@mail.gmail.com","threadId":"17577","inReplyTo":"86d4c5e00902050540lf8a3adfq18b1fed909d6e68a@mail.gmail.com","subject":"Re: [PATCH] git-svn: Print revision while searching for earliest use of path","fromName":"Deskin Miller","fromEmail":"deskinm@umich.edu","sentAt":"2009-02-05T13:42:42Z","receivedAt":"2009-02-05T13:42:42Z","isPatch":true,"sender":{"key":"deskinm@umich.edu","avatar":"https://gravatar.com/avatar/d340a0e612cdf0a79535c71863c0b4c535e9aba63b42032226ae903e638b64f9?d=mp&s=160"},"body":"Resending due to temporary insanity with email, sorry Eric.\n\nOn Thu, Feb 5, 2009 at 01:42, Eric Wong <normalperson@yhbt.net> wrote:\n> Deskin Miller <deskinm@umich.edu> wrote:\n>> If the current version is\n>> felt to be too verbose since it is printing a new line, I'd be up for\n>> squelching the output to e.g. every 1000 revisions or so.\n>\n> This is definitely useful on slow/large repositories.  The current\n> output with newlines is fine by me.\n\nOk.\n\n> Couldn't we avoid the trouble of parsing the inconsistent error\n> messages by printing this status message after the get_log() calls\n> in gs_fetch_loop_common() ?\n\nI didn't look at get_log closely, because I thought it executed only\nonce.  I definitely agree that it would be cleaner if it's possible.\nLet me look at the code some more and I'll see what I can do, or feel\nfree to post an alternate implementation.\n\nDeskin Miller\n"},{"id":"103797","messageId":"1234139598-13703-1-git-send-email-deskinm@umich.edu","threadId":"17577","inReplyTo":"86d4c5e00902050542n74b10bfdw5e9249ac23fdc9e7@mail.gmail.com","subject":"[PATCH v2] git-svn: Print revision while searching for earliest use of path","fromName":"Deskin Miller","fromEmail":"deskinm@umich.edu","sentAt":"2009-02-09T00:33:18Z","receivedAt":"2009-02-09T00:33:18Z","isPatch":true,"sender":{"key":"deskinm@umich.edu","avatar":"https://gravatar.com/avatar/d340a0e612cdf0a79535c71863c0b4c535e9aba63b42032226ae903e638b64f9?d=mp&s=160"},"body":"When initializing a git-svn repository from a Subversion repoository,\nit is common to be interested in a path which did not exist in the\ninitial commit to Subversion.  In a large repository, the initial fetch\nmay take some looking for the earliest existence of the path time while\nthe user receives no additional feedback.  Print the highest revision\nnumber scanned thus far to let the user know something is still\nhappening.\n\nSigned-off-by: Deskin Miller <deskinm@umich.edu>\n---\nI'd never looked closely enough at gs_fetch_loop_common to grok what was\ngoing on, and my previous experience with svn's get_log led me to think\nthat git-svn would slurp up log info for all commits at once.  Silly of\nme.\n\nEric, things are much cleaner doing as you suggest.  I added a\ncarriage-return at the end of the message because I like it that way,\nand the line will be overwritten once it actually starts fetching data\nfrom svn.  I don't feel strongly about it though, so if it's better to\nmake it a newline, please feel free to change it and apply.\n\nDeskin Miller\n\n git-svn.perl |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 79888a0..601e2a3 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -4348,6 +4348,9 @@ sub gs_fetch_loop_common {\n \t\t}\n \t\t$self->get_log([$longest_path], $min, $max, 0, 1, 1,\n \t\t               sub { $revs{$_[1]} = _cb(@_) });\n+\t\tif ($err) {\n+\t\t\tprint \"Checked through r$max\\r\";\n+\t\t}\n \t\tif ($err && $max >= $head) {\n \t\t\tprint STDERR \"Path '$longest_path' \",\n \t\t\t\t     \"was probably deleted:\\n\",\n-- \n1.6.1.399.g0d272\n"},{"id":"103901","messageId":"20090209212244.GA26706@dcvr.yhbt.net","threadId":"17577","inReplyTo":"1234139598-13703-1-git-send-email-deskinm@umich.edu","subject":"Re: [PATCH v2] git-svn: Print revision while searching for earliest use of path","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-02-09T21:22:44Z","receivedAt":"2009-02-09T21:22:44Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Deskin Miller <deskinm@umich.edu> wrote:\n> When initializing a git-svn repository from a Subversion repoository,\n> it is common to be interested in a path which did not exist in the\n> initial commit to Subversion.  In a large repository, the initial fetch\n> may take some looking for the earliest existence of the path time while\n> the user receives no additional feedback.  Print the highest revision\n> number scanned thus far to let the user know something is still\n> happening.\n> \n> Signed-off-by: Deskin Miller <deskinm@umich.edu>\n\nThanks Deskin,\n\nThe carriage return actually looks quite good :)\n\nAcked-by: From: Eric Wong <normalperson@yhbt.net>\n\n> ---\n> I'd never looked closely enough at gs_fetch_loop_common to grok what was\n> going on, and my previous experience with svn's get_log led me to think\n> that git-svn would slurp up log info for all commits at once.  Silly of\n> me.\n> \n> Eric, things are much cleaner doing as you suggest.  I added a\n> carriage-return at the end of the message because I like it that way,\n> and the line will be overwritten once it actually starts fetching data\n> from svn.  I don't feel strongly about it though, so if it's better to\n> make it a newline, please feel free to change it and apply.\n> \n> Deskin Miller\n> \n>  git-svn.perl |    3 +++\n>  1 files changed, 3 insertions(+), 0 deletions(-)\n> \n> diff --git a/git-svn.perl b/git-svn.perl\n> index 79888a0..601e2a3 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -4348,6 +4348,9 @@ sub gs_fetch_loop_common {\n>  \t\t}\n>  \t\t$self->get_log([$longest_path], $min, $max, 0, 1, 1,\n>  \t\t               sub { $revs{$_[1]} = _cb(@_) });\n> +\t\tif ($err) {\n> +\t\t\tprint \"Checked through r$max\\r\";\n> +\t\t}\n>  \t\tif ($err && $max >= $head) {\n>  \t\t\tprint STDERR \"Path '$longest_path' \",\n>  \t\t\t\t     \"was probably deleted:\\n\",\n> -- \n"}]}