{"thread":{"id":"32659","subject":"[PATCH] git-svn: teach find-rev to find near matches","startedAt":"2013-01-17T22:19:33Z","lastAt":"2013-01-18T23:14:56Z","messageCount":3,"participants":["John Keeping","Eric Wong","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"207175","messageId":"20130117221933.GK4574@serenity.lan","threadId":"32659","inReplyTo":null,"subject":"[PATCH] git-svn: teach find-rev to find near matches","fromName":"John Keeping","fromEmail":"john@keeping.me.uk","sentAt":"2013-01-17T22:19:33Z","receivedAt":"2013-01-17T22:19:33Z","isPatch":true,"sender":{"key":"john@keeping.me.uk","avatar":"https://avatars.githubusercontent.com/u/1702081?v=4"},"body":"When a single SVN repository is split into multiple Git repositories\nmany SVN revisions will exist in only one of the Git repositories\ncreated.  For some projects the only way to build a working artifact is\nto check out corresponding versions of various repositories, with no\nindication of what those are in the Git world - in the SVN world the\nrevision numbers are sufficient.\n\nBy adding \"--before\" to \"git-svn find-rev\" we can say \"tell me what this\nrepository looked like when that other repository looked like this\":\n\n    git svn find-rev --before \\\n        r$(git --git-dir=/over/there.git svn find-rev HEAD)\n\nSigned-off-by: John Keeping <john@keeping.me.uk>\n---\n Documentation/git-svn.txt | 10 ++++++++++\n git-svn.perl              | 12 ++++++++++--\n 2 files changed, 20 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\nindex 69decb1..34d438b 100644\n--- a/Documentation/git-svn.txt\n+++ b/Documentation/git-svn.txt\n@@ -346,6 +346,16 @@ Any other arguments are passed directly to 'git log'\n \tcorresponding git commit hash (this can optionally be followed by a\n \ttree-ish to specify which branch should be searched).  When given a\n \ttree-ish, returns the corresponding SVN revision number.\n++\n+--before;;\n+\tDon't require an exact match if given an SVN revision, instead find\n+\tthe commit corresponding to the state of the SVN repository (on the\n+\tcurrent branch) at the specified revision.\n++\n+--after;;\n+\tDon't require an exact match if given an SVN revision; if there is\n+\tnot an exact match return the closest match searching forward in the\n+\thistory.\n \n 'set-tree'::\n \tYou should consider using 'dcommit' instead of this command.\ndiff --git a/git-svn.perl b/git-svn.perl\nindex bd5266c..d086694 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -114,6 +114,7 @@ my ($_stdin, $_help, $_edit,\n \t$_message, $_file, $_branch_dest,\n \t$_template, $_shared,\n \t$_version, $_fetch_all, $_no_rebase, $_fetch_parent,\n+\t$_before, $_after,\n \t$_merge, $_strategy, $_preserve_merges, $_dry_run, $_local,\n \t$_prefix, $_no_checkout, $_url, $_verbose,\n \t$_commit_url, $_tag, $_merge_info, $_interactive);\n@@ -258,7 +259,8 @@ my %cmd = (\n \t\t\t} ],\n \t'find-rev' => [ \\&cmd_find_rev,\n \t                \"Translate between SVN revision numbers and tree-ish\",\n-\t\t\t{} ],\n+\t\t\t{ 'before' => \\$_before,\n+\t\t\t  'after' => \\$_after } ],\n \t'rebase' => [ \\&cmd_rebase, \"Fetch and rebase your working directory\",\n \t\t\t{ 'merge|m|M' => \\$_merge,\n \t\t\t  'verbose|v' => \\$_verbose,\n@@ -1191,7 +1193,13 @@ sub cmd_find_rev {\n \t\t\t    \"$head history\\n\";\n \t\t}\n \t\tmy $desired_revision = substr($revision_or_hash, 1);\n-\t\t$result = $gs->rev_map_get($desired_revision, $uuid);\n+\t\tif ($_before) {\n+\t\t\t$result = $gs->find_rev_before($desired_revision, 1);\n+\t\t} elsif ($_after) {\n+\t\t\t$result = $gs->find_rev_after($desired_revision, 1);\n+\t\t} else {\n+\t\t\t$result = $gs->rev_map_get($desired_revision, $uuid);\n+\t\t}\n \t} else {\n \t\tmy (undef, $rev, undef) = cmt_metadata($revision_or_hash);\n \t\t$result = $rev;\n-- \n1.8.1.1\n"},{"id":"207187","messageId":"20130118004917.GA27106@dcvr.yhbt.net","threadId":"32659","inReplyTo":"20130117221933.GK4574@serenity.lan","subject":"Re: [PATCH] git-svn: teach find-rev to find near matches","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2013-01-18T00:49:17Z","receivedAt":"2013-01-18T00:49:17Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"John Keeping <john@keeping.me.uk> wrote:\n> When a single SVN repository is split into multiple Git repositories\n> many SVN revisions will exist in only one of the Git repositories\n> created.  For some projects the only way to build a working artifact is\n> to check out corresponding versions of various repositories, with no\n> indication of what those are in the Git world - in the SVN world the\n> revision numbers are sufficient.\n> \n> By adding \"--before\" to \"git-svn find-rev\" we can say \"tell me what this\n> repository looked like when that other repository looked like this\":\n> \n>     git svn find-rev --before \\\n>         r$(git --git-dir=/over/there.git svn find-rev HEAD)\n> \n> Signed-off-by: John Keeping <john@keeping.me.uk>\n\nThanks.\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n\nI've pushed this out to git://bogomips.org/git-svn along with a few\nother things I seem to have forgotten about :x\n\nJohn Keeping (1):\n      git-svn: teach find-rev to find near matches\n\nJonathan Nieder (2):\n      Git::SVN::Editor::T: pass $deletions to ->A and ->D\n      git svn: do not overescape URLs (fallback case)\n"},{"id":"207237","messageId":"7va9s6ozgv.fsf@alter.siamese.dyndns.org","threadId":"32659","inReplyTo":"20130118004917.GA27106@dcvr.yhbt.net","subject":"Re: [PATCH] git-svn: teach find-rev to find near matches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-18T23:14:56Z","receivedAt":"2013-01-18T23:14:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n> I've pushed this out to git://bogomips.org/git-svn along with a few\n> other things I seem to have forgotten about :x\n>\n> John Keeping (1):\n>       git-svn: teach find-rev to find near matches\n>\n> Jonathan Nieder (2):\n>       Git::SVN::Editor::T: pass $deletions to ->A and ->D\n>       git svn: do not overescape URLs (fallback case)\n\nThanks; pulled and pushed out.\n"}]}