{"thread":{"id":"43310","subject":"Re: [PATCH] git-svnimport: support for partial imports","startedAt":"2006-10-25T22:50:26Z","lastAt":"2006-11-01T00:51:05Z","messageCount":7,"participants":["Sasha Khapyorsky","Junio C Hamano","Karl Hasselström"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"298126","messageId":"20061025225026.GA13031@sashak.voltaire.com","threadId":"43310","inReplyTo":null,"subject":"[PATCH] git-svnimport: support for partial imports","fromName":"Sasha Khapyorsky","fromEmail":"sashak@voltaire.com","sentAt":"2006-10-25T22:50:26Z","receivedAt":"2006-10-25T22:50:26Z","isPatch":true,"sender":{"key":"sashak@voltaire.com","avatar":null},"body":"This adds support for partial svn imports. Let's assume that SVN\nrepository layout looks like:\n\n  $trunk/path/to/our/project\n  $branches/path/to/our/project\n  $tags/path/to/our/project\n\n, and we would like to import only tree under this specific\n'path/to/our/project' and not whole tree under $trunk, $branches, etc..\nNow we will be be able to do it by using '-P path/to/our/project' option\nwith git-svnimport.\n\nSigned-off-by: Sasha Khapyorsky <sashak@voltaire.com>\n---\n git-svnimport.perl |   29 +++++++++++++++++++++++++----\n 1 files changed, 25 insertions(+), 4 deletions(-)\n\ndiff --git a/git-svnimport.perl b/git-svnimport.perl\nindex f6eff8e..cbaa8ab 100755\n--- a/git-svnimport.perl\n+++ b/git-svnimport.perl\n@@ -31,7 +31,7 @@ die \"Need SVN:Core 1.2.1 or better\" if $\n $ENV{'TZ'}=\"UTC\";\n \n our($opt_h,$opt_o,$opt_v,$opt_u,$opt_C,$opt_i,$opt_m,$opt_M,$opt_t,$opt_T,\n-    $opt_b,$opt_r,$opt_I,$opt_A,$opt_s,$opt_l,$opt_d,$opt_D,$opt_S,$opt_F);\n+    $opt_b,$opt_r,$opt_I,$opt_A,$opt_s,$opt_l,$opt_d,$opt_D,$opt_S,$opt_F,$opt_P);\n \n sub usage() {\n \tprint STDERR <<END;\n@@ -39,17 +39,19 @@ Usage: ${\\basename $0}     # fetch/updat\n        [-o branch-for-HEAD] [-h] [-v] [-l max_rev]\n        [-C GIT_repository] [-t tagname] [-T trunkname] [-b branchname]\n        [-d|-D] [-i] [-u] [-r] [-I ignorefilename] [-s start_chg]\n-       [-m] [-M regex] [-A author_file] [-S] [-F] [SVN_URL]\n+       [-m] [-M regex] [-A author_file] [-S] [-F] [-P project_name] [SVN_URL]\n END\n \texit(1);\n }\n \n-getopts(\"A:b:C:dDFhiI:l:mM:o:rs:t:T:Suv\") or usage();\n+getopts(\"A:b:C:dDFhiI:l:mM:o:rs:t:T:SP:uv\") or usage();\n usage if $opt_h;\n \n my $tag_name = $opt_t || \"tags\";\n my $trunk_name = $opt_T || \"trunk\";\n my $branch_name = $opt_b || \"branches\";\n+my $project_name = $opt_P || \"\";\n+$project_name = \"/\" . $project_name if ($project_name);\n \n @ARGV == 1 or @ARGV == 2 or usage();\n \n@@ -427,6 +429,20 @@ sub get_ignore($$$$$) {\n \t}\n }\n \n+sub project_path($$)\n+{\n+\tmy ($path, $project) = @_;\n+\n+\t$path = \"/\".$path unless ($path =~ m#^\\/#) ;\n+\treturn $1 if ($path =~ m#^$project\\/(.*)$#);\n+\n+\t$path =~ s#\\.#\\\\\\.#g;\n+\t$path =~ s#\\+#\\\\\\+#g;\n+\treturn \"/\" if ($project =~ m#^$path.*$#);\n+\n+\treturn undef;\n+}\n+\n sub split_path($$) {\n \tmy($rev,$path) = @_;\n \tmy $branch;\n@@ -446,7 +462,11 @@ sub split_path($$) {\n \t\tprint STDERR \"$rev: Unrecognized path: $path\\n\" unless (defined $no_error{$path});\n \t\treturn ()\n \t}\n-\t$path = \"/\" if $path eq \"\";\n+\tif ($path eq \"\") {\n+\t\t$path = \"/\";\n+\t} elsif ($project_name) {\n+\t\t$path = project_path($path, $project_name);\n+\t}\n \treturn ($branch,$path);\n }\n \n@@ -898,6 +918,7 @@ sub commit_all {\n \twhile(my($path,$action) = each %$changed_paths) {\n \t\t($branch,$path) = split_path($revision,$path);\n \t\tnext if not defined $branch;\n+\t\tnext if not defined $path;\n \t\t$done{$branch}{$path} = $action;\n \t}\n \twhile(($branch,$changed_paths) = each %done) {\n-- \n1.4.3.1.g9f9e\n"},{"id":"296546","messageId":"20061026084710.GC13780@diana.vm.bytemark.co.uk","threadId":"43310","inReplyTo":"20061025225026.GA13031@sashak.voltaire.com","subject":"Re: [PATCH] git-svnimport: support for partial imports","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-10-26T08:47:10Z","receivedAt":"2006-10-26T08:47:10Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2006-10-26 00:50:26 +0200, Sasha Khapyorsky wrote:\n\n> This adds support for partial svn imports. Let's assume that SVN\n> repository layout looks like:\n>\n>   $trunk/path/to/our/project\n>   $branches/path/to/our/project\n>   $tags/path/to/our/project\n>\n> , and we would like to import only tree under this specific\n> 'path/to/our/project' and not whole tree under $trunk, $branches,\n> etc.. Now we will be be able to do it by using '-P\n> path/to/our/project' option with git-svnimport.\n\nIsn't this already doable with \"-T trunk/path/to/our/project -t\ntags/path/to/our/project -b branches/path/to/our/project\"?\n\n-- \nKarl Hasselström, kha@treskal.com\n"},{"id":"295741","messageId":"20061026103120.GA15502@sashak.voltaire.com","threadId":"43310","inReplyTo":"20061026084710.GC13780@diana.vm.bytemark.co.uk","subject":"Re: [PATCH] git-svnimport: support for partial imports","fromName":"Sasha Khapyorsky","fromEmail":"sashak@voltaire.com","sentAt":"2006-10-26T10:31:20Z","receivedAt":"2006-10-26T10:31:20Z","isPatch":true,"sender":{"key":"sashak@voltaire.com","avatar":null},"body":"On 10:47 Thu 26 Oct     , Karl Hasselstr?m wrote:\n> On 2006-10-26 00:50:26 +0200, Sasha Khapyorsky wrote:\n> \n> > This adds support for partial svn imports. Let's assume that SVN\n> > repository layout looks like:\n> >\n> >   $trunk/path/to/our/project\n> >   $branches/path/to/our/project\n> >   $tags/path/to/our/project\n> >\n> > , and we would like to import only tree under this specific\n> > 'path/to/our/project' and not whole tree under $trunk, $branches,\n> > etc.. Now we will be be able to do it by using '-P\n> > path/to/our/project' option with git-svnimport.\n> \n> Isn't this already doable with \"-T trunk/path/to/our/project -t\n> tags/path/to/our/project -b branches/path/to/our/project\"?\n\nIn such case git-svnimport will not be able to resolve branches and\ntags names - note that actual SVN paths are:\n\n  branches/<branch-name>/path/to/our/project\n  tags/<tag-name>/path/to/our/project\n\n"},{"id":"297340","messageId":"20061026105428.GA16372@diana.vm.bytemark.co.uk","threadId":"43310","inReplyTo":"20061026103120.GA15502@sashak.voltaire.com","subject":"Re: [PATCH] git-svnimport: support for partial imports","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-10-26T10:54:28Z","receivedAt":"2006-10-26T10:54:28Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2006-10-26 12:31:20 +0200, Sasha Khapyorsky wrote:\n\n> On 10:47 Thu 26 Oct, Karl Hasselström wrote:\n\n> > Isn't this already doable with \"-T trunk/path/to/our/project -t\n> > tags/path/to/our/project -b branches/path/to/our/project\"?\n>\n> In such case git-svnimport will not be able to resolve branches and\n> tags names - note that actual SVN paths are:\n>\n>   branches/<branch-name>/path/to/our/project\n>   tags/<tag-name>/path/to/our/project\n\nAahh, right. I didn't think of that.\n\n-- \nKarl Hasselström, kha@treskal.com\n"},{"id":"294305","messageId":"20061031225054.GA20211@sashak.voltaire.com","threadId":"43310","inReplyTo":"20061025225026.GA13031@sashak.voltaire.com","subject":"Re: [PATCH] git-svnimport: support for partial imports","fromName":"Sasha Khapyorsky","fromEmail":"sashak@voltaire.com","sentAt":"2006-10-31T22:50:54Z","receivedAt":"2006-10-31T22:50:54Z","isPatch":true,"sender":{"key":"sashak@voltaire.com","avatar":null},"body":"On 00:50 Thu 26 Oct     , Sasha Khapyorsky wrote:\n> This adds support for partial svn imports. Let's assume that SVN\n> repository layout looks like:\n> \n>   $trunk/path/to/our/project\n>   $branches/path/to/our/project\n>   $tags/path/to/our/project\n> \n> , and we would like to import only tree under this specific\n> 'path/to/our/project' and not whole tree under $trunk, $branches, etc..\n> Now we will be be able to do it by using '-P path/to/our/project' option\n> with git-svnimport.\n> \n> Signed-off-by: Sasha Khapyorsky <sashak@voltaire.com>\n\nAny news about status of this patch?\n\n"},{"id":"294362","messageId":"7v1wooqc6j.fsf@assigned-by-dhcp.cox.net","threadId":"43310","inReplyTo":"20061031225054.GA20211@sashak.voltaire.com","subject":"Re: [PATCH] git-svnimport: support for partial imports","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-31T23:48:36Z","receivedAt":"2006-10-31T23:48:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sasha Khapyorsky <sashak@voltaire.com> writes:\n\n> On 00:50 Thu 26 Oct     , Sasha Khapyorsky wrote:\n>> This adds support for partial svn imports. Let's assume that SVN\n>> repository layout looks like:\n>> \n>>   $trunk/path/to/our/project\n>>   $branches/path/to/our/project\n>>   $tags/path/to/our/project\n>> \n>> , and we would like to import only tree under this specific\n>> 'path/to/our/project' and not whole tree under $trunk, $branches, etc..\n>> Now we will be be able to do it by using '-P path/to/our/project' option\n>> with git-svnimport.\n>> \n>> Signed-off-by: Sasha Khapyorsky <sashak@voltaire.com>\n>\n> Any news about status of this patch?\n\nSomebody mentioned this duplicates something that can be already\ndone, and I saw you refuted that.  At that point I thought then\nit would be Ok to add, and then I forgot about it.  Sorry.\n\nWill apply unless somebody objects immediately ;-).\n"},{"id":"296977","messageId":"20061101005105.GA20556@sashak.voltaire.com","threadId":"43310","inReplyTo":"7v1wooqc6j.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] git-svnimport: support for partial imports","fromName":"Sasha Khapyorsky","fromEmail":"sashak@voltaire.com","sentAt":"2006-11-01T00:51:05Z","receivedAt":"2006-11-01T00:51:05Z","isPatch":true,"sender":{"key":"sashak@voltaire.com","avatar":null},"body":"On 15:48 Tue 31 Oct     , Junio C Hamano wrote:\n> Sasha Khapyorsky <sashak@voltaire.com> writes:\n> \n> > On 00:50 Thu 26 Oct     , Sasha Khapyorsky wrote:\n> >> This adds support for partial svn imports. Let's assume that SVN\n> >> repository layout looks like:\n> >> \n> >>   $trunk/path/to/our/project\n> >>   $branches/path/to/our/project\n> >>   $tags/path/to/our/project\n> >> \n> >> , and we would like to import only tree under this specific\n> >> 'path/to/our/project' and not whole tree under $trunk, $branches, etc..\n> >> Now we will be be able to do it by using '-P path/to/our/project' option\n> >> with git-svnimport.\n> >> \n> >> Signed-off-by: Sasha Khapyorsky <sashak@voltaire.com>\n> >\n> > Any news about status of this patch?\n> \n> Somebody mentioned this duplicates something that can be already\n> done, and I saw you refuted that.  At that point I thought then\n> it would be Ok to add, and then I forgot about it.  Sorry.\n\nNo problem.\n\n"}]}