{"thread":{"id":"19792","subject":"git svn: Supporting multiple branch subdirs?","startedAt":"2009-06-12T21:46:13Z","lastAt":"2009-06-27T22:08:00Z","messageCount":23,"participants":["Marc Branchaud","Michael J Gruber","Eric Wong","Junio C Hamano","Andreas Ericsson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"116186","messageId":"4A32CCA5.7040404@xiplink.com","threadId":"19792","inReplyTo":null,"subject":"git svn: Supporting multiple branch subdirs?","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2009-06-12T21:46:13Z","receivedAt":"2009-06-12T21:46:13Z","isPatch":false,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"Hi,\n\nI believe I need git-svn to support multiple branch subdirectories.\n\nThe motivation for this is the (partial) gitification of the FreeBSD subversion repository.  FreeBSD doesn't follow the usual branches/tags/trunk pattern.  Instead:\n\n- FreeBSD's /trunk is called /head.\n\n- /head is branched into /stable/X subdirs.\n\n- Each /stable/X branch is sub-branched into /releng/X.Y subirs.\n\n- /releng/X.Y.Z branches are tagged under /release/foo.\n\nI'm only looking to get an updatable mirror of their repo -- I don't (yet) need to push changes back to FreeBSD.\n\nI'd like to modify git-svn to support multiple (at least two) -b parameters, so I could import the FreeBSD repo with something like\n\tgit svn init --trunk=head \\\n\t\t--branches=stable \\\n\t\t--branches=releng \\\n\t\t--tags=release \\\n\t\tfile:///local/mirror/of/svn.freebsd.org/base/\n\tgit svn fetch\n\nIs this approach wise or even feasible?  A couple of possible show-stoppers I see are:\n\n- The releng/X.Y branches are created from the stable/X  tree, where X itself doesn't exist from the start.\n\n- FreeBSD likes to make single commits that spans multiple branches.  This is usually done as a security patch: One commit can, for example, touch /head, /stable/X, /stable/W, and several branches under /releng.\n\nIf this isn't completely off the wall, I'd appreciate some pointers on the git-svn.perl code.  I've tried searching through the code to see how the -b parameter is handled, but I got lost pretty quickly.  How does the fetch command deal with branches?\n\nThanks,\n\n\t\tM.\n"},{"id":"116230","messageId":"4A339182.1090204@drmicha.warpmail.net","threadId":"19792","inReplyTo":"4A32CCA5.7040404@xiplink.com","subject":"Re: git svn: Supporting multiple branch subdirs?","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-06-13T11:46:10Z","receivedAt":"2009-06-13T11:46:10Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Marc Branchaud venit, vidit, dixit 12.06.2009 23:46:\n> Hi,\n> \n> I believe I need git-svn to support multiple branch subdirectories.\n> \n> The motivation for this is the (partial) gitification of the FreeBSD subversion repository.  FreeBSD doesn't follow the usual branches/tags/trunk pattern.  Instead:\n> \n> - FreeBSD's /trunk is called /head.\n> \n> - /head is branched into /stable/X subdirs.\n> \n> - Each /stable/X branch is sub-branched into /releng/X.Y subirs.\n> \n> - /releng/X.Y.Z branches are tagged under /release/foo.\n> \n> I'm only looking to get an updatable mirror of their repo -- I don't (yet) need to push changes back to FreeBSD.\n> \n> I'd like to modify git-svn to support multiple (at least two) -b parameters, so I could import the FreeBSD repo with something like\n> \tgit svn init --trunk=head \\\n> \t\t--branches=stable \\\n> \t\t--branches=releng \\\n> \t\t--tags=release \\\n> \t\tfile:///local/mirror/of/svn.freebsd.org/base/\n> \tgit svn fetch\n> \n> Is this approach wise or even feasible?  A couple of possible show-stoppers I see are:\n\nAfter doing the init with \"--branches=stable\" (without releng), do\ngit config --add svn-remote.svn.branches 'releng/*:refs/remotes/*'\n\nThis gives you two branches refspecs in .git/config (feel free to put\nthem in different dirs under remotes if there may be name clashes\nbetween stable and releng branches).\n\n> \n> - The releng/X.Y branches are created from the stable/X  tree, where X itself doesn't exist from the start.\n\nWell, I assume X exists at the time of creation of X.Y. That's all that\nis needed.\n\n> \n> - FreeBSD likes to make single commits that spans multiple branches.  This is usually done as a security patch: One commit can, for example, touch /head, /stable/X, /stable/W, and several branches under /releng.\n\nI assume that git-svn converts such an svn commit into several git\ncommits, one for each affected branch. Since you have a local mirror\nit's easy to try out.\n\n> \n> If this isn't completely off the wall, I'd appreciate some pointers on the git-svn.perl code.  I've tried searching through the code to see how the -b parameter is handled, but I got lost pretty quickly.  How does the fetch command deal with branches?\n\nI think there's no need to hack git-svn. Let us know how it goes with\nthe two branches configs.\n\nMichael\n"},{"id":"116348","messageId":"4A368509.9070801@xiplink.com","threadId":"19792","inReplyTo":"4A339182.1090204@drmicha.warpmail.net","subject":"Re: git svn: Supporting multiple branch subdirs?","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2009-06-15T17:29:45Z","receivedAt":"2009-06-15T17:29:45Z","isPatch":false,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"Michael J Gruber wrote:\n> \n> After doing the init with \"--branches=stable\" (without releng), do\n> git config --add svn-remote.svn.branches 'releng/*:refs/remotes/*'\n> \n> This gives you two branches refspecs in .git/config (feel free to put\n> them in different dirs under remotes if there may be name clashes\n> between stable and releng branches).\n\nThat doesn't seem to work...\n\nHere's my .git/config file before the first fetch:\n\n[svn-remote \"svn\"]\n        useSvnsyncProps = 1\n        ignore-paths = ^[^/]+/(?:cvs2svn|projects|svnadmin|user|vendor.*)\n        url = file:///home/marcnarc/Code/FreeBSD-all-mirror/base\n        fetch = head:refs/remotes/trunk\n        branches = stable/*:refs/remotes/stable/*\n        branches = releng/*:refs/remotes/releng/*\n        tags = release/*:refs/remotes/tags/*\n\n(Shouldn't that fetch line be head:refs/remots/head, since there's nothing called \"trunk\" in the svn repo?  I used git-svn init --trunk=head ...)\n\nWith this, git-svn seems to be (mostly) ignoring the branches in stable/.  I've run the first fetch past the point where the first stable/ branch is created (\"stable/2.0.5\"), but in the repository (while the fetch command is still going, BTW, currently somewhere around commit 15,000), I get:\n\n\t$ git branch -a\n\t  remotes/releng/2.0.5\n\t  remotes/releng/ALPHA_2_0\n\t  remotes/releng/BETA_2_0\n\t  remotes/tags/2.0\n\t  remotes/tags/2.0.5\n\t  remotes/tags/2.1.0\n\t  remotes/tags/2.1.0@12369\n\t  remotes/trunk\n\nAt this point, git-svn has passed the commit that created the stable/2.0.5 branch (8869).  Mind you, nothing was ever committed to that branch, so it's basically a tag.  However, remotes/tags/2.0.5 is at svn commit 9201, which is the correct for the releases/2.0.5 tag.  remotes/tags/2.1.0 is also correct for the tagging of the 2.1.0 release.\n\ngit-svn has also passed the commit that created the stable/2.1 branch (9211), as well as later commits that only apply to that branch.  AFAICT, remotes/tags/2.1.0@12369 (which is not an actual tag or branch in the svn repo) is the stable/2.1 branch up to commit 12369, but there have been later commits to stable/2.1 since then that git-svn has seen.  Those later commits don't seem to be in the git repository at all.\n\nThe releng/* branches look fine, though.\n\n>> - The releng/X.Y branches are created from the stable/X  tree, where X\n>> itself doesn't exist from the start.\n> \n> Well, I assume X exists at the time of creation of X.Y. That's all that\n> is needed.\n\nYes, that assumption is correct (it seems the 2.x releng branches were created off the trunk, not from a stable/ branch).\n\n>> - FreeBSD likes to make single commits that spans multiple branches.\n>> This is usually done as a security patch: One commit can, for example,\n>> touch /head, /stable/X, /stable/W, and several branches under /releng.\n> \n> I assume that git-svn converts such an svn commit into several git\n> commits, one for each affected branch. Since you have a local mirror\n> it's easy to try out.\n\nYep, git-svn does just that.  Nice!\n\n\t\tM.\n"},{"id":"116477","messageId":"4A38FCEE.2020002@drmicha.warpmail.net","threadId":"19792","inReplyTo":"4A368509.9070801@xiplink.com","subject":"Re: git svn: Supporting multiple branch subdirs?","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-06-17T14:25:50Z","receivedAt":"2009-06-17T14:25:50Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Marc Branchaud venit, vidit, dixit 15.06.2009 19:29:\n> Michael J Gruber wrote:\n>>\n>> After doing the init with \"--branches=stable\" (without releng), do\n>> git config --add svn-remote.svn.branches 'releng/*:refs/remotes/*'\n>>\n>> This gives you two branches refspecs in .git/config (feel free to put\n>> them in different dirs under remotes if there may be name clashes\n>> between stable and releng branches).\n> \n> That doesn't seem to work...\n\nNo, it doesn't I'm sorry. I knew that git-svn lumps multiple command\nline arguments into one, but it does so also for config lines. I didn't\nknow that but confirmed from a test (and the source).\n\nNow, one last resort would be a more complicated regexp. Unfortunately,\nsomething like\n\nbranches = (releng|stable)/*:refs/remotes/*/*\n\ndoes not work (regexps don't work, only globs)\n\nand something like\n\nbranches = */*:refs/remotes/*/*\n\nworks in principle but gets everything under head wrong.\n\n> \n> Here's my .git/config file before the first fetch:\n> \n> [svn-remote \"svn\"]\n>         useSvnsyncProps = 1\n>         ignore-paths = ^[^/]+/(?:cvs2svn|projects|svnadmin|user|vendor.*)\n>         url = file:///home/marcnarc/Code/FreeBSD-all-mirror/base\n>         fetch = head:refs/remotes/trunk\n>         branches = stable/*:refs/remotes/stable/*\n>         branches = releng/*:refs/remotes/releng/*\n>         tags = release/*:refs/remotes/tags/*\n> \n> (Shouldn't that fetch line be head:refs/remots/head, since there's nothing called \"trunk\" in the svn repo?  I used git-svn init --trunk=head ...)\n\nThe left hand side of the refspec refers to the svn repo, the right hand\nside only names your local ref. Feel free to put \"head\" there, although\nthis can be confused very easily with \"HEAD\" which has special meaning\nin git.\n\n>> I assume that git-svn converts such an svn commit into several git\n>> commits, one for each affected branch. Since you have a local mirror\n>> it's easy to try out.\n> \n> Yep, git-svn does just that.  Nice!\n> \n> \t\tM.\n\nAt least I got one thing right :)\n\nI've used multiple svn-remote sections before (in cases where the repo\nstructure changed) but I'm afraid this is of no use here. Looking at the\nsource of git-svn, one sees that \"tags\" and \"branches\" are basically\ntreated the same way, they are simply members of a \"remote\"\nstruct/object/whatever it's called in perl and only differ in their\nstandard refspec. Noone keeps us from adding \"branches2\" for a quick\nhack and checking whether everything stays sane... (git-svn perl often\nloops over \"branches tags\", that needs to be replaced).\n\nIn fact, I think the way to go would be replacing the two by an array.\nAs a next step, the command line parsing and config reading needs to be\nchanged so that multiple branches or tags entries end up generating\nmultiple members of that array. Now this only needs to be implemented ;)\n\nMichael\n\nP.S.: Let me know if you give it a shot, so that we don't duplicate our\nwaste of time...\n"},{"id":"116480","messageId":"4A390AFE.5070703@xiplink.com","threadId":"19792","inReplyTo":"4A38FCEE.2020002@drmicha.warpmail.net","subject":"Re: git svn: Supporting multiple branch subdirs?","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2009-06-17T15:25:50Z","receivedAt":"2009-06-17T15:25:50Z","isPatch":false,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"Michael J Gruber wrote:\n> \n>> (Shouldn't that fetch line be head:refs/remots/head, since there's nothing called\n>> \"trunk\" in the svn repo?  I used git-svn init --trunk=head ...)\n> \n> The left hand side of the refspec refers to the svn repo, the right hand\n> side only names your local ref. Feel free to put \"head\" there, although\n> this can be confused very easily with \"HEAD\" which has special meaning\n> in git.\n\nSure.  I was mostly wondering why --trunk=head didn't just reuse the name in my local ref.  A minor bug, perhaps?\n\n(And the FreeBSD community commonly refers to that branch as \"current\", so that's a name I can use locally.)\n\n> P.S.: Let me know if you give it a shot, so that we don't duplicate our\n> waste of time...\n\nI have some cycles to work on this, but I'd need some guidance around git-svn's internals.  I'm not even sure where to start implementing the \"branches2\" hack you described...\n\n\t\tM.\n"},{"id":"116571","messageId":"4A3A4945.6050307@drmicha.warpmail.net","threadId":"19792","inReplyTo":"4A390AFE.5070703@xiplink.com","subject":"Re: git svn: Supporting multiple branch subdirs?","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-06-18T14:03:49Z","receivedAt":"2009-06-18T14:03:49Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Marc Branchaud venit, vidit, dixit 17.06.2009 17:25:\n> Michael J Gruber wrote:\n>>\n>>> (Shouldn't that fetch line be head:refs/remots/head, since there's nothing called\n>>> \"trunk\" in the svn repo?  I used git-svn init --trunk=head ...)\n>>\n>> The left hand side of the refspec refers to the svn repo, the right hand\n>> side only names your local ref. Feel free to put \"head\" there, although\n>> this can be confused very easily with \"HEAD\" which has special meaning\n>> in git.\n> \n> Sure.  I was mostly wondering why --trunk=head didn't just reuse the name in my local ref.  A minor bug, perhaps?\n> \n> (And the FreeBSD community commonly refers to that branch as \"current\", so that's a name I can use locally.)\n> \n>> P.S.: Let me know if you give it a shot, so that we don't duplicate our\n>> waste of time...\n> \n> I have some cycles to work on this, but I'd need some guidance around git-svn's internals.  I'm not even sure where to start implementing the \"branches2\" hack you described...\n\nHeck it's perl, so don't even try to understand the code - after all,\nperl only barely missed the final round in the last competition for the\nnext cryptographic algorithm!\n\nThat being said, I did some clueless hacking in git-svn.perl and let it\nrun against the freebsd repo. Now, how's that:\n\n~/src/git/git-svn fetch -r1:10000\n\ngit branch -r\n  releng/2.0.5\n  releng/ALPHA_2_0\n  releng/BETA_2_0\n  stable/2.0.5\n  stable/2.1\n  tags/2.0\n  tags/2.0.5\n  trunk\n\nThe revision graph looks OK as well. The git-svn config which I used is:\n\n[svn-remote \"svn\"]\n        url = svn://svn.freebsd.org/base\n        fetch = head:refs/remotes/trunk\n        branches = releng/*:refs/remotes/releng/*\n        branchse = stable/*:refs/remotes/stable/*\n        tags = release/*:refs/remotes/tags/*\n\nNo typo there, my git svn knows about \"branches\" and \"branchse\" now ;)\nBTW: In fact there is overlap between releng and stable branches in the\nfeebsd repo, see 2.0.5.\n\nI'll send a monkey patch in a minute.\n\nMichael\n"},{"id":"116574","messageId":"4A3A4F2A.1080701@xiplink.com","threadId":"19792","inReplyTo":"4A3A4945.6050307@drmicha.warpmail.net","subject":"Re: git svn: Supporting multiple branch subdirs?","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2009-06-18T14:28:58Z","receivedAt":"2009-06-18T14:28:58Z","isPatch":false,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"Michael J Gruber wrote:\n> \n> Heck it's perl, so don't even try to understand the code - after all,\n> perl only barely missed the final round in the last competition for the\n> next cryptographic algorithm!\n\n:)\n\nHey, I'm not gonna dis something with such great job-security potential!\n\n> That being said, I did some clueless hacking in git-svn.perl and let it\n> run against the freebsd repo. Now, how's that:\n> \n> ~/src/git/git-svn fetch -r1:10000\n> \n> git branch -r\n>   releng/2.0.5\n>   releng/ALPHA_2_0\n>   releng/BETA_2_0\n>   stable/2.0.5\n>   stable/2.1\n>   tags/2.0\n>   tags/2.0.5\n>   trunk\n> \n> The revision graph looks OK as well. The git-svn config which I used is:\n\nNice!\n\n> [svn-remote \"svn\"]\n>         url = svn://svn.freebsd.org/base\n>         fetch = head:refs/remotes/trunk\n>         branches = releng/*:refs/remotes/releng/*\n>         branchse = stable/*:refs/remotes/stable/*\n>         tags = release/*:refs/remotes/tags/*\n> \n> No typo there, my git svn knows about \"branches\" and \"branchse\" now ;)\n> BTW: In fact there is overlap between releng and stable branches in the\n> feebsd repo, see 2.0.5.\n\nBy \"overlap\" do you mean single commits that touch both branches?  FreeBSD does that a lot.\n\nBut for 2.0.5, it looks to me like the stable/2.0.5 branch was abandoned after the 2.0.5_ALPHA release.\n\n> I'll send a monkey patch in a minute.\n\nFantastic!  Thanks so much for this.\n\n\t\tM.\n"},{"id":"116575","messageId":"1245335463-4488-1-git-send-email-git@drmicha.warpmail.net","threadId":"19792","inReplyTo":"4A3A4945.6050307@drmicha.warpmail.net","subject":"[MONKEY PATCH] git-svn: allow two branch configurations","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-06-18T14:31:03Z","receivedAt":"2009-06-18T14:31:03Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"This is a MONKEY PATCH which introduces a long option and config\nvariable \"branchse\" analogous to \"branches\", with a short option \"-B\".\nIt has the same meaning and can be used to accomadate svn repos with two\ndifferent branches subdirectories.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n git-svn.perl |   18 ++++++++++--------\n 1 files changed, 10 insertions(+), 8 deletions(-)\n\nWell, this is not a serious patch per se, but it shows that git-svn can\nvery well handle multiple branches configs once it is told to read and\nuse them. I don't think it's possible to do this with globs, and\nextending globs to regexps looks like a more complicated approach\n(although they are used internally).\n\nI see two viable options for a real patch now:\n- Extend $remote->branches to be an array and use \"config --get-all\" to\n  read the config; do the same for tags.\n- Use one single array for branches as well as tags.\n\nEric, which way do you prefer? The first one is simpler and may be even\ndoable for me. The second looks more complicated mainly because of \"git\nsvn branch -t\" (which element of the combined array is tags?), even\nthough it's more natural if one thinks about the way svn works.\n\nMichael\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 3301797..e6a9422 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -92,11 +92,12 @@ my %fc_opts = ( 'follow-parent|follow!' => \\$Git::SVN::_follow_parent,\n \t\t'localtime' => \\$Git::SVN::_localtime,\n \t\t%remote_opts );\n \n-my ($_trunk, $_tags, $_branches, $_stdlayout);\n+my ($_trunk, $_tags, $_branches, $_branchse, $_stdlayout);\n my %icv;\n my %init_opts = ( 'template=s' => \\$_template, 'shared:s' => \\$_shared,\n                   'trunk|T=s' => \\$_trunk, 'tags|t=s' => \\$_tags,\n                   'branches|b=s' => \\$_branches, 'prefix=s' => \\$_prefix,\n+                  'branchse|B=s' => \\$_branchse,\n                   'stdlayout|s' => \\$_stdlayout,\n                   'minimize-url|m' => \\$Git::SVN::_minimize_url,\n \t\t  'no-metadata' => sub { $icv{noMetadata} = 1 },\n@@ -358,7 +359,7 @@ sub init_subdir {\n sub cmd_clone {\n \tmy ($url, $path) = @_;\n \tif (!defined $path &&\n-\t    (defined $_trunk || defined $_branches || defined $_tags ||\n+\t    (defined $_trunk || defined $_branches || defined $_branchse || defined $_tags ||\n \t     defined $_stdlayout) &&\n \t    $url !~ m#^[a-z\\+]+://#) {\n \t\t$path = $url;\n@@ -375,7 +376,7 @@ sub cmd_init {\n \t\t$_tags = 'tags' if (!defined $_tags);\n \t\t$_branches = 'branches' if (!defined $_branches);\n \t}\n-\tif (defined $_trunk || defined $_branches || defined $_tags) {\n+\tif (defined $_trunk || defined $_branches || defined $_branchse || defined $_tags) {\n \t\treturn cmd_multi_init(@_);\n \t}\n \tmy $url = shift or die \"SVN repository location required \",\n@@ -800,7 +801,7 @@ sub cmd_proplist {\n \n sub cmd_multi_init {\n \tmy $url = shift;\n-\tunless (defined $_trunk || defined $_branches || defined $_tags) {\n+\tunless (defined $_trunk || defined $_branches || defined $_branchse || defined $_tags) {\n \t\tusage(1);\n \t}\n \n@@ -825,9 +826,10 @@ sub cmd_multi_init {\n \t\t\t\t\t\t   undef, $trunk_ref);\n \t\t}\n \t}\n-\treturn unless defined $_branches || defined $_tags;\n+\treturn unless defined $_branches || defined $_branchse || defined $_tags;\n \tmy $ra = $url ? Git::SVN::Ra->new($url) : undef;\n \tcomplete_url_ls_init($ra, $_branches, '--branches/-b', $_prefix);\n+\tcomplete_url_ls_init($ra, $_branchse, '--branchse/-B', $_prefix);\n \tcomplete_url_ls_init($ra, $_tags, '--tags/-t', $_prefix . 'tags/');\n }\n \n@@ -1563,7 +1565,7 @@ sub fetch_all {\n \tmy $base = defined $fetch ? $head : 0;\n \n \t# read the max revs for wildcard expansion (branches/*, tags/*)\n-\tforeach my $t (qw/branches tags/) {\n+\tforeach my $t (qw/branches branchse tags/) {\n \t\tdefined $remote->{$t} or next;\n \t\tpush @globs, $remote->{$t};\n \t\tmy $max_rev = eval { tmp_config(qw/--int --get/,\n@@ -1609,7 +1611,7 @@ sub read_all_remotes {\n \t\t\t$r->{$1}->{svm} = {};\n \t\t} elsif (m!^(.+)\\.url=\\s*(.*)\\s*$!) {\n \t\t\t$r->{$1}->{url} = $2;\n-\t\t} elsif (m!^(.+)\\.(branches|tags)=\n+\t\t} elsif (m!^(.+)\\.(branches|branchse|tags)=\n \t\t           (.*):refs/remotes/(.+)\\s*$/!x) {\n \t\t\tmy ($p, $g) = ($3, $4);\n \t\t\tmy $rs = $r->{$1}->{$2} = {\n@@ -1760,7 +1762,7 @@ sub find_by_url { # repos_root and, path are optional\n \t\tnext if defined $repos_root && $repos_root ne $u;\n \n \t\tmy $fetch = $remotes->{$repo_id}->{fetch} || {};\n-\t\tforeach (qw/branches tags/) {\n+\t\tforeach (qw/branches branchse tags/) {\n \t\t\tresolve_local_globs($u, $fetch,\n \t\t\t                    $remotes->{$repo_id}->{$_});\n \t\t}\n-- \n1.6.3.2.406.gd6a466\n"},{"id":"116579","messageId":"4A3A649C.8060403@drmicha.warpmail.net","threadId":"19792","inReplyTo":"4A3A4F2A.1080701@xiplink.com","subject":"Re: git svn: Supporting multiple branch subdirs?","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-06-18T16:00:28Z","receivedAt":"2009-06-18T16:00:28Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Marc Branchaud venit, vidit, dixit 18.06.2009 16:28:\n> Michael J Gruber wrote:\n>>\n>> Heck it's perl, so don't even try to understand the code - after all,\n>> perl only barely missed the final round in the last competition for the\n>> next cryptographic algorithm!\n> \n> :)\n> \n> Hey, I'm not gonna dis something with such great job-security potential!\n> \n>> That being said, I did some clueless hacking in git-svn.perl and let it\n>> run against the freebsd repo. Now, how's that:\n>>\n>> ~/src/git/git-svn fetch -r1:10000\n>>\n>> git branch -r\n>>   releng/2.0.5\n>>   releng/ALPHA_2_0\n>>   releng/BETA_2_0\n>>   stable/2.0.5\n>>   stable/2.1\n>>   tags/2.0\n>>   tags/2.0.5\n>>   trunk\n>>\n>> The revision graph looks OK as well. The git-svn config which I used is:\n> \n> Nice!\n> \n>> [svn-remote \"svn\"]\n>>         url = svn://svn.freebsd.org/base\n>>         fetch = head:refs/remotes/trunk\n>>         branches = releng/*:refs/remotes/releng/*\n>>         branchse = stable/*:refs/remotes/stable/*\n>>         tags = release/*:refs/remotes/tags/*\n>>\n>> No typo there, my git svn knows about \"branches\" and \"branchse\" now ;)\n>> BTW: In fact there is overlap between releng and stable branches in the\n>> feebsd repo, see 2.0.5.\n> \n> By \"overlap\" do you mean single commits that touch both branches?  FreeBSD does that a lot.\n\nNo, I just meant that there are stable and releng branches with the same\nname, so that they can't both be mapped to refs/remotes/* but need\ndifferent \"namespaces\" (subdirs) as above.\n\nMichael\n"},{"id":"116772","messageId":"4A3F9A44.8070805@xiplink.com","threadId":"19792","inReplyTo":"1245335463-4488-1-git-send-email-git@drmicha.warpmail.net","subject":"Re: [MONKEY PATCH] git-svn: allow two branch configurations","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2009-06-22T14:50:44Z","receivedAt":"2009-06-22T14:50:44Z","isPatch":true,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"I tried this patch over the weekend, and it worked perfectly.\n\nI've imported the head/, releng/, and stable/ FreeBSD branches, plus the release/ tags -- some 190,000 svn revisions.  The git repository is 720MB, compared to 4.6GB for the synsync'd mirror of the svn repo.\n\nMichael J Gruber wrote:\n> \n> I see two viable options for a real patch now:\n> - Extend $remote->branches to be an array and use \"config --get-all\" to\n>   read the config; do the same for tags.\n> - Use one single array for branches as well as tags.\n> \n> Eric, which way do you prefer? The first one is simpler and may be even\n> doable for me. The second looks more complicated mainly because of \"git\n> svn branch -t\" (which element of the combined array is tags?), even\n> though it's more natural if one thinks about the way svn works.\n\nI favor the first option, mainly because of its simplicity and because it seems natural to me to keep branches and tags separate, despite svn's mechanics.\n\nWith this capability, the 'git svn branch' command (and 'git svn tag') would need to be extended to allow the user to specify the location of the new branch (or tag).  I suggest a -d (for \"destination\") argument.  -d would be required if there's more than one branches (or tags, if -t is also specified) config option for the svn-remote.  The -d value must successfully glob against the LHS of one of the branches' (or tags') refspecs.\n\nThanks, Michael!  I'm going to start putting together some unit tests for this while the implementation details get sorted out.\n\n\t\tM.\n"},{"id":"116828","messageId":"4A410A90.1090101@xiplink.com","threadId":"19792","inReplyTo":"4A3F9A44.8070805@xiplink.com","subject":"[PATCH] git svn: Support multiple branch and tag paths in the svn repository.","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2009-06-23T17:02:08Z","receivedAt":"2009-06-23T17:02:08Z","isPatch":true,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"This enables git-svn.perl to read multiple 'branches' and 'tags' entries in\nsvn-remote config sections.  The init and clone subcommands also support\nmultiple --branches and --tags arguments.\n\nThe branch (and tag) subcommand gets a new argument: --destination (or -d).\nThis argument is required if there are multiple branches (or tags) entries\nconfigured for the remote Subversion repository.  The argument's value\nspecifies which branch (or tag) path to use to create the branch (or tag).\nThe specified value must match the left side (without wildcards) of one of\nthe branches (or tags) refspecs in the svn-remote's config.\n\nSigned-off-by: Marc Branchaud <marcnarc@xiplink.com>\n---\n\nI got carried away making unit tests and went and implemented most of this...\n\nI'm fairly happy with this, except for the way the branch subcommand matches\nrefspecs.  The patch does a simple string comparison, but it'd be better to do\nan actual glob.  I just couldn't track down the right function for that, so I\nleft it as a strcmp and hope that a gitizen can tell me how to glob here.\n\n(ps. I'm trying a new way to send patches -- apologies if it's mangled!)\n\n git-svn.perl                         |   79 +++++++++++++++++-------\n t/t9138-git-svn-multiple-branches.sh |  114 ++++++++++++++++++++++++++++++++++\n 2 files changed, 171 insertions(+), 22 deletions(-)\n create mode 100755 t/t9138-git-svn-multiple-branches.sh\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex ef1d30d..0f2cb8d 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -62,7 +62,7 @@ my ($SVN);\n $sha1 = qr/[a-f\\d]{40}/;\n $sha1_short = qr/[a-f\\d]{4,40}/;\n my ($_stdin, $_help, $_edit,\n-\t$_message, $_file,\n+\t$_message, $_file, $_branch_dest,\n \t$_template, $_shared,\n \t$_version, $_fetch_all, $_no_rebase, $_fetch_parent,\n \t$_merge, $_strategy, $_dry_run, $_local,\n@@ -90,11 +90,11 @@ my %fc_opts = ( 'follow-parent|follow!' => \\$Git::SVN::_follow_parent,\n \t\t'localtime' => \\$Git::SVN::_localtime,\n \t\t%remote_opts );\n \n-my ($_trunk, $_tags, $_branches, $_stdlayout);\n+my ($_trunk, @_tags, @_branches, $_stdlayout);\n my %icv;\n my %init_opts = ( 'template=s' => \\$_template, 'shared:s' => \\$_shared,\n-                  'trunk|T=s' => \\$_trunk, 'tags|t=s' => \\$_tags,\n-                  'branches|b=s' => \\$_branches, 'prefix=s' => \\$_prefix,\n+                  'trunk|T=s' => \\$_trunk, 'tags|t=s@' => \\@_tags,\n+                  'branches|b=s@' => \\@_branches, 'prefix=s' => \\$_prefix,\n                   'stdlayout|s' => \\$_stdlayout,\n                   'minimize-url|m' => \\$Git::SVN::_minimize_url,\n \t\t  'no-metadata' => sub { $icv{noMetadata} = 1 },\n@@ -139,11 +139,13 @@ my %cmd = (\n \tbranch => [ \\&cmd_branch,\n \t            'Create a branch in the SVN repository',\n \t            { 'message|m=s' => \\$_message,\n+\t              'destination|d=s' => \\$_branch_dest,\n \t              'dry-run|n' => \\$_dry_run,\n \t\t      'tag|t' => \\$_tag } ],\n \ttag => [ sub { $_tag = 1; cmd_branch(@_) },\n \t         'Create a tag in the SVN repository',\n \t         { 'message|m=s' => \\$_message,\n+\t           'destination|d=s' => \\$_branch_dest,\n \t           'dry-run|n' => \\$_dry_run } ],\n \t'set-tree' => [ \\&cmd_set_tree,\n \t                \"Set an SVN repository to a git tree-ish\",\n@@ -353,7 +355,7 @@ sub init_subdir {\n sub cmd_clone {\n \tmy ($url, $path) = @_;\n \tif (!defined $path &&\n-\t    (defined $_trunk || defined $_branches || defined $_tags ||\n+\t    (defined $_trunk || @_branches || @_tags ||\n \t     defined $_stdlayout) &&\n \t    $url !~ m#^[a-z\\+]+://#) {\n \t\t$path = $url;\n@@ -366,10 +368,10 @@ sub cmd_clone {\n sub cmd_init {\n \tif (defined $_stdlayout) {\n \t\t$_trunk = 'trunk' if (!defined $_trunk);\n-\t\t$_tags = 'tags' if (!defined $_tags);\n-\t\t$_branches = 'branches' if (!defined $_branches);\n+\t\t@_tags = 'tags' if (! @_tags);\n+\t\t@_branches = 'branches' if (! @_branches);\n \t}\n-\tif (defined $_trunk || defined $_branches || defined $_tags) {\n+\tif (defined $_trunk || @_branches || @_tags) {\n \t\treturn cmd_multi_init(@_);\n \t}\n \tmy $url = shift or die \"SVN repository location required \",\n@@ -587,7 +589,31 @@ sub cmd_branch {\n \tmy ($src, $rev, undef, $gs) = working_head_info($head);\n \n \tmy $remote = Git::SVN::read_all_remotes()->{$gs->{repo_id}};\n-\tmy $glob = $remote->{ $_tag ? 'tags' : 'branches' };\n+\tmy $allglobs = $remote->{ $_tag ? 'tags' : 'branches' };\n+\tmy $glob;\n+\tif ($#{$allglobs} == 0) {\n+\t\t$glob = $allglobs->[0];\n+\t} else {\n+\t\tunless(defined $_branch_dest) {\n+\t\t\tdie \"Multiple \",\n+\t\t\t    $_tag ? \"tag\" : \"branch\",\n+\t\t\t    \" paths defined for Subversion repository.\\n\",\n+\t\t            \"You must specify where you want to create the \",\n+\t\t            $_tag ? \"tag\" : \"branch\",\n+\t\t            \" with the --destination argument.\\n\";\n+\t\t}\n+\t\tforeach my $g (@{$allglobs}) {\n+\t\t\tif ($_branch_dest eq $g->{path}->{left}) {\n+\t\t\t\t$glob = $g;\n+\t\t\t\tlast;\n+\t\t\t}\n+\t\t}\n+\t\tunless (defined $glob) {\n+\t\t\tdie \"Unknown \",\n+\t\t\t    $_tag ? \"tag\" : \"branch\",\n+\t\t\t    \" destination $_branch_dest\\n\";\n+\t\t}\n+\t}\n \tmy ($lft, $rgt) = @{ $glob->{path} }{qw/left right/};\n \tmy $dst = join '/', $remote->{url}, $lft, $branch_name, ($rgt || ());\n \n@@ -794,7 +820,7 @@ sub cmd_proplist {\n \n sub cmd_multi_init {\n \tmy $url = shift;\n-\tunless (defined $_trunk || defined $_branches || defined $_tags) {\n+\tunless (defined $_trunk || @_branches || @_tags) {\n \t\tusage(1);\n \t}\n \n@@ -819,10 +845,14 @@ sub cmd_multi_init {\n \t\t\t\t\t\t   undef, $trunk_ref);\n \t\t}\n \t}\n-\treturn unless defined $_branches || defined $_tags;\n+\treturn unless @_branches || @_tags;\n \tmy $ra = $url ? Git::SVN::Ra->new($url) : undef;\n-\tcomplete_url_ls_init($ra, $_branches, '--branches/-b', $_prefix);\n-\tcomplete_url_ls_init($ra, $_tags, '--tags/-t', $_prefix . 'tags/');\n+\tforeach my $path (@_branches) {\n+\t\tcomplete_url_ls_init($ra, $path, '--branches/-b', $_prefix);\n+\t}\n+\tforeach my $path (@_tags) {\n+\t\tcomplete_url_ls_init($ra, $path, '--tags/-t', $_prefix.'tags/');\n+\t}\n }\n \n sub cmd_multi_fetch {\n@@ -1093,6 +1123,7 @@ sub complete_url_ls_init {\n \t\tdie \"--prefix='$pfx' must have a trailing slash '/'\\n\";\n \t}\n \tcommand_noisy('config',\n+\t\t      '--add',\n \t              \"svn-remote.$gs->{repo_id}.$n\",\n \t              \"$remote_path:refs/remotes/$pfx*\" .\n \t                ('/*' x (($remote_path =~ tr/*/*/) - 1)) );\n@@ -1548,7 +1579,9 @@ sub fetch_all {\n \t# read the max revs for wildcard expansion (branches/*, tags/*)\n \tforeach my $t (qw/branches tags/) {\n \t\tdefined $remote->{$t} or next;\n-\t\tpush @globs, $remote->{$t};\n+\t\tforeach my $b (@{$remote->{$t}}) {\n+\t\t    push @globs, $b;\n+\t\t}\n \t\tmy $max_rev = eval { tmp_config(qw/--int --get/,\n \t\t                         \"svn-remote.$repo_id.${t}-maxRev\") };\n \t\tif (defined $max_rev && ($max_rev < $base)) {\n@@ -1595,15 +1628,16 @@ sub read_all_remotes {\n \t\t} elsif (m!^(.+)\\.(branches|tags)=\n \t\t           (.*):refs/remotes/(.+)\\s*$/!x) {\n \t\t\tmy ($p, $g) = ($3, $4);\n-\t\t\tmy $rs = $r->{$1}->{$2} = {\n-\t\t\t                  t => $2,\n-\t\t\t\t\t  remote => $1,\n-\t\t\t                  path => Git::SVN::GlobSpec->new($p),\n-\t\t\t                  ref => Git::SVN::GlobSpec->new($g) };\n+\t\t\tmy $rs = {\n+\t\t\t    t => $2,\n+\t\t\t    remote => $1,\n+\t\t\t    path => Git::SVN::GlobSpec->new($p),\n+\t\t\t    ref => Git::SVN::GlobSpec->new($g) };\n \t\t\tif (length($rs->{ref}->{right}) != 0) {\n \t\t\t\tdie \"The '*' glob character must be the last \",\n \t\t\t\t    \"character of '$g'\\n\";\n \t\t\t}\n+\t\t\tpush @{ $r->{$1}->{$2} }, $rs;\n \t\t}\n \t}\n \n@@ -1743,9 +1777,10 @@ sub find_by_url { # repos_root and, path are optional\n \t\tnext if defined $repos_root && $repos_root ne $u;\n \n \t\tmy $fetch = $remotes->{$repo_id}->{fetch} || {};\n-\t\tforeach (qw/branches tags/) {\n-\t\t\tresolve_local_globs($u, $fetch,\n-\t\t\t                    $remotes->{$repo_id}->{$_});\n+\t\tforeach my $t (qw/branches tags/) {\n+\t\t\tforeach my $globspec (@{$remotes->{$repo_id}->{$t}}) {\n+\t\t\t\tresolve_local_globs($u, $fetch, $globspec);\n+\t\t\t}\n \t\t}\n \t\tmy $p = $path;\n \t\tmy $rwr = rewrite_root({repo_id => $repo_id});\ndiff --git a/t/t9138-git-svn-multiple-branches.sh b/t/t9138-git-svn-multiple-branches.sh\nnew file mode 100755\nindex 0000000..9725ccf\n--- /dev/null\n+++ b/t/t9138-git-svn-multiple-branches.sh\n@@ -0,0 +1,114 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2009 Marc Branchaud\n+#\n+\n+test_description='git svn multiple branch and tag paths in the svn repo'\n+. ./lib-git-svn.sh\n+\n+test_expect_success 'setup svnrepo' '\n+\tmkdir\tproject \\\n+\t\tproject/trunk \\\n+\t\tproject/b_one \\\n+\t\tproject/b_two \\\n+\t\tproject/tags_A \\\n+\t\tproject/tags_B &&\n+\techo 1 > project/trunk/a.file &&\n+\tsvn import -m \"$test_description\" project \"$svnrepo/project\" &&\n+\trm -rf project &&\n+\tsvn cp -m \"Branch 1\" \"$svnrepo/project/trunk\" \\\n+\t\t\t     \"$svnrepo/project/b_one/first\" &&\n+\tsvn cp -m \"Tag 1\" \"$svnrepo/project/trunk\" \\\n+\t\t\t  \"$svnrepo/project/tags_A/1.0\" &&\n+\tsvn co \"$svnrepo/project\" svn_project &&\n+\tcd svn_project &&\n+\t\t.\n+\t\techo 2 > trunk/a.file &&\n+\t\tsvn ci -m \"Change 1\" trunk/a.file &&\n+\t\tsvn cp -m \"Branch 2\" \"$svnrepo/project/trunk\" \\\n+\t\t\t\t     \"$svnrepo/project/b_one/second\" &&\n+\t\tsvn cp -m \"Tag 2\" \"$svnrepo/project/trunk\" \\\n+\t\t\t\t  \"$svnrepo/project/tags_A/2.0\" &&\n+\t\techo 3 > trunk/a.file &&\n+\t\tsvn ci -m \"Change 2\" trunk/a.file &&\n+\t\tsvn cp -m \"Branch 3\" \"$svnrepo/project/trunk\" \\\n+\t\t\t\t     \"$svnrepo/project/b_two/1\" &&\n+\t\tsvn cp -m \"Tag 3\" \"$svnrepo/project/trunk\" \\\n+\t\t\t\t  \"$svnrepo/project/tags_A/3.0\" &&\n+\t\techo 4 > trunk/a.file &&\n+\t\tsvn ci -m \"Change 3\" trunk/a.file &&\n+\t\tsvn cp -m \"Branch 4\" \"$svnrepo/project/trunk\" \\\n+\t\t\t\t     \"$svnrepo/project/b_two/2\" &&\n+\t\tsvn cp -m \"Tag 4\" \"$svnrepo/project/trunk\" \\\n+\t\t\t\t  \"$svnrepo/project/tags_A/4.0\" &&\n+\t\tsvn up &&\n+\t\techo 5 > b_one/first/a.file &&\n+\t\tsvn ci -m \"Change 4\" b_one/first/a.file &&\n+\t\tsvn cp -m \"Tag 5\" \"$svnrepo/project/b_one/first\" \\\n+\t\t\t\t  \"$svnrepo/project/tags_B/v5\" &&\n+\t\techo 6 > b_one/second/a.file &&\n+\t\tsvn ci -m \"Change 5\" b_one/second/a.file &&\n+\t\tsvn cp -m \"Tag 6\" \"$svnrepo/project/b_one/second\" \\\n+\t\t\t\t  \"$svnrepo/project/tags_B/v6\" &&\n+\t\techo 7 > b_two/1/a.file &&\n+\t\tsvn ci -m \"Change 6\" b_two/1/a.file &&\n+\t\tsvn cp -m \"Tag 7\" \"$svnrepo/project/b_two/1\" \\\n+\t\t\t\t  \"$svnrepo/project/tags_B/v7\" &&\n+\t\techo 8 > b_two/2/a.file &&\n+\t\tsvn ci -m \"Change 7\" b_two/2/a.file &&\n+\t\tsvn cp -m \"Tag 8\" \"$svnrepo/project/b_two/2\" \\\n+\t\t\t\t  \"$svnrepo/project/tags_B/v8\" &&\n+\tcd ..\n+\t'\n+\n+test_expect_success 'clone multiple branch and tag paths' '\n+\tgit svn clone -T trunk \\\n+\t\t      -b b_one/* --branches b_two/* \\\n+\t\t      -t tags_A/* --tags tags_B \\\n+\t\t      \"$svnrepo/project\" git_project &&\n+\tcd git_project &&\n+\t\tgit rev-parse refs/remotes/first &&\n+\t\tgit rev-parse refs/remotes/second &&\n+\t\tgit rev-parse refs/remotes/1 &&\n+\t\tgit rev-parse refs/remotes/2 &&\n+\t\tgit rev-parse refs/remotes/tags/1.0 &&\n+\t\tgit rev-parse refs/remotes/tags/2.0 &&\n+\t\tgit rev-parse refs/remotes/tags/3.0 &&\n+\t\tgit rev-parse refs/remotes/tags/4.0 &&\n+\t\tgit rev-parse refs/remotes/tags/v5 &&\n+\t\tgit rev-parse refs/remotes/tags/v6 &&\n+\t\tgit rev-parse refs/remotes/tags/v7 &&\n+\t\tgit rev-parse refs/remotes/tags/v8 &&\n+\tcd ..\n+\t'\n+\n+test_expect_success 'Multiple branch or tag paths require -d' '\n+\tcd git_project &&\n+\t\ttest_must_fail git svn branch -m \"No new branch\" Nope &&\n+\t\ttest_must_fail git svn tag -m \"No new tag\" Tagless &&\n+\t\ttest_must_fail git rev-parse refs/remotes/Nope &&\n+\t\ttest_must_fail git rev-parse refs/remotes/tags/Tagless &&\n+\tcd ../svn_project &&\n+\t\tsvn up &&\n+\t\ttest_must_fail test -d b_one/Nope &&\n+\t\ttest_must_fail test -d b_two/Nope &&\n+\t\ttest_must_fail test -d tags_A/Tagless &&\n+\t\ttest_must_fail test -d tags_B/Tagless &&\n+\tcd ..\n+\t'\n+\n+test_expect_success 'create new branches and tags' '\n+\t( cd git_project && git svn branch -m \"New branch 1\" -d project/b_one New1 ) &&\n+\t( cd svn_project && svn up && test -e b_one/New1/a.file ) &&\n+\n+\t( cd git_project && git svn branch -m \"New branch 2\" -d project/b_two New2 ) &&\n+\t( cd svn_project && svn up && test -e b_two/New2/a.file ) &&\n+\n+\t( cd git_project && git svn branch -t -m \"New tag 1\" -d project/tags_A Tag1 ) &&\n+\t( cd svn_project && svn up && test -e tags_A/Tag1/a.file )\n+\n+\t( cd git_project && git svn tag -m \"New tag 2\" -d project/tags_B Tag2 ) &&\n+\t( cd svn_project && svn up && test -e tags_B/Tag2/a.file )\n+\t'\n+\n+test_done\n-- \n1.6.3.3\n"},{"id":"116911","messageId":"20090625093602.GA3997@dcvr.yhbt.net","threadId":"19792","inReplyTo":"4A410A90.1090101@xiplink.com","subject":"Re: [PATCH] git svn: Support multiple branch and tag paths in the svn repository.","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-06-25T09:36:02Z","receivedAt":"2009-06-25T09:36:02Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Marc Branchaud <marcnarc@xiplink.com> wrote:\n> This enables git-svn.perl to read multiple 'branches' and 'tags' entries in\n> svn-remote config sections.  The init and clone subcommands also support\n> multiple --branches and --tags arguments.\n> \n> The branch (and tag) subcommand gets a new argument: --destination (or -d).\n> This argument is required if there are multiple branches (or tags) entries\n> configured for the remote Subversion repository.  The argument's value\n> specifies which branch (or tag) path to use to create the branch (or tag).\n> The specified value must match the left side (without wildcards) of one of\n> the branches (or tags) refspecs in the svn-remote's config.\n> \n> Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>\n> ---\n> \n> I got carried away making unit tests and went and implemented most of this...\n> \n> I'm fairly happy with this, except for the way the branch subcommand matches\n> refspecs.  The patch does a simple string comparison, but it'd be better to do\n> an actual glob.  I just couldn't track down the right function for that, so I\n> left it as a strcmp and hope that a gitizen can tell me how to glob here.\n> \n> (ps. I'm trying a new way to send patches -- apologies if it's mangled!)\n\nThanks Marc!  Everything looks fine here; I don't think I'll have time\nto test it myself any time soon but your test case looks good and\ndoesn't break any of the other tests :)  Sorry for the delay, I haven't\nhad access to my computer or email much in the past few weeks.\n\nAcked and and pushed out to git://git.bogomips.org/git-svn along with a\nfollowup patch to convert the glob to a regexp for branching:\n\n>From f7050599310c18bd67b35b8d59486116b30ff1f6 Mon Sep 17 00:00:00 2001\nFrom: Eric Wong <normalperson@yhbt.net>\nDate: Thu, 25 Jun 2009 02:28:15 -0700\nSubject: [PATCH] git-svn: convert globs to regexps for branch destinations\n\nMarc Branchaud wrote:\n> I'm fairly happy with this, except for the way the branch\n> subcommand matches refspecs.  The patch does a simple string\n> comparison, but it'd be better to do an actual glob.  I just\n> couldn't track down the right function for that, so I left it as\n> a strcmp and hope that a gitizen can tell me how to glob here.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n\n I haven't actually tested it, and yes, it should probably be\n moved to Git.pm even though it's not necessarily git-only...\n\n git-svn.perl |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 48e8aad..6c42e2a 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -646,7 +646,9 @@ sub cmd_branch {\n \t\t            \" with the --destination argument.\\n\";\n \t\t}\n \t\tforeach my $g (@{$allglobs}) {\n-\t\t\tif ($_branch_dest eq $g->{path}->{left}) {\n+\t\t\t# SVN::Git::Editor could probably be moved to Git.pm..\n+\t\t\tmy $re = SVN::Git::Editor::glob2pat($g->{path}->{left});\n+\t\t\tif ($_branch_dest =~ /$re/) {\n \t\t\t\t$glob = $g;\n \t\t\t\tlast;\n \t\t\t}\n-- \nEric Wong\n"},{"id":"116973","messageId":"7v3a9o0x48.fsf@alter.siamese.dyndns.org","threadId":"19792","inReplyTo":"20090625093602.GA3997@dcvr.yhbt.net","subject":"Re: [PATCH] git svn: Support multiple branch and tag paths in the svn repository.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-06-25T22:25:27Z","receivedAt":"2009-06-25T22:25:27Z","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> Acked and and pushed out to git://git.bogomips.org/git-svn along with a\n> followup patch ...\n\nHmmm...\n\nt9138-git-svn-multiple-branches.sh does not seem to pass for me.\n\n    ...\n    A    svn_project/tags_A/1.0\n    A    svn_project/tags_A/1.0/a.file\n    Checked out revision 3.\n    ./test-lib.sh: line 329: .: filename argument required\n    .: usage: . filename [arguments]\n    FATAL: Unexpected exit with code 2\n"},{"id":"116984","messageId":"20090626003338.GA591@dcvr.yhbt.net","threadId":"19792","inReplyTo":"7v3a9o0x48.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git svn: Support multiple branch and tag paths in the svn repository.","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-06-26T00:33:39Z","receivedAt":"2009-06-26T00:33:39Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> Eric Wong <normalperson@yhbt.net> writes:\n> \n> > Acked and and pushed out to git://git.bogomips.org/git-svn along with a\n> > followup patch ...\n> \n> Hmmm...\n> \n> t9138-git-svn-multiple-branches.sh does not seem to pass for me.\n> \n>     ...\n>     A    svn_project/tags_A/1.0\n>     A    svn_project/tags_A/1.0/a.file\n>     Checked out revision 3.\n>     ./test-lib.sh: line 329: .: filename argument required\n>     .: usage: . filename [arguments]\n>     FATAL: Unexpected exit with code 2\n\nOops, I wasn't reading the test too closely[1], this should fix it:\n\n>From 1ad8ff7b49f508ad37081a709d4230833564eca2 Mon Sep 17 00:00:00 2001\nFrom: Eric Wong <normalperson@yhbt.net>\nDate: Thu, 25 Jun 2009 16:09:59 -0700\nSubject: [PATCH] t9138: remove stray \".\" in tests\n\nThis breaks bash and probably some other shells, but worked\nfine with dash in my limited testing.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n t/t9138-git-svn-multiple-branches.sh |    1 -\n 1 files changed, 0 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t9138-git-svn-multiple-branches.sh b/t/t9138-git-svn-multiple-branches.sh\nindex 9725ccf..37ecdb0 100755\n--- a/t/t9138-git-svn-multiple-branches.sh\n+++ b/t/t9138-git-svn-multiple-branches.sh\n@@ -22,7 +22,6 @@ test_expect_success 'setup svnrepo' '\n \t\t\t  \"$svnrepo/project/tags_A/1.0\" &&\n \tsvn co \"$svnrepo/project\" svn_project &&\n \tcd svn_project &&\n-\t\t.\n \t\techo 2 > trunk/a.file &&\n \t\tsvn ci -m \"Change 1\" trunk/a.file &&\n \t\tsvn cp -m \"Branch 2\" \"$svnrepo/project/trunk\" \\\n-- \nEric Wong\n\n[1] - the test should use the new svn_cmd wrapper and avoid cd + cd ..\nwhich is more error prone than (cd ).  I'll try to find time to fix\nit later tonight.\n"},{"id":"117001","messageId":"4A445A29.90907@op5.se","threadId":"19792","inReplyTo":"20090626003338.GA591@dcvr.yhbt.net","subject":"Re: [PATCH] git svn: Support multiple branch and tag paths in the svn repository.","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2009-06-26T05:18:33Z","receivedAt":"2009-06-26T05:18:33Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Eric Wong wrote:\n> Junio C Hamano <gitster@pobox.com> wrote:\n>> Eric Wong <normalperson@yhbt.net> writes:\n>>\n>>> Acked and and pushed out to git://git.bogomips.org/git-svn along with a\n>>> followup patch ...\n>> Hmmm...\n>>\n>> t9138-git-svn-multiple-branches.sh does not seem to pass for me.\n>>\n>>     ...\n>>     A    svn_project/tags_A/1.0\n>>     A    svn_project/tags_A/1.0/a.file\n>>     Checked out revision 3.\n>>     ./test-lib.sh: line 329: .: filename argument required\n>>     .: usage: . filename [arguments]\n>>     FATAL: Unexpected exit with code 2\n> \n> Oops, I wasn't reading the test too closely[1], this should fix it:\n> \n> From 1ad8ff7b49f508ad37081a709d4230833564eca2 Mon Sep 17 00:00:00 2001\n> From: Eric Wong <normalperson@yhbt.net>\n> Date: Thu, 25 Jun 2009 16:09:59 -0700\n> Subject: [PATCH] t9138: remove stray \".\" in tests\n> \n> This breaks bash and probably some other shells, but worked\n> fine with dash in my limited testing.\n> \n\nPlease reword to \"The stray dots break bash and ...\"\nRight now it reads as if the patch itself breaks bash et al.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n\nConsidering the successes of the wars on alcohol, poverty, drugs and\nterror, I think we should give some serious thought to declaring war\non peace.\n"},{"id":"117036","messageId":"20090626181100.GA25118@dcvr.yhbt.net","threadId":"19792","inReplyTo":"4A445A29.90907@op5.se","subject":"Re: [PATCH] git svn: Support multiple branch and tag paths in the svn repository.","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-06-26T18:11:00Z","receivedAt":"2009-06-26T18:11:00Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Andreas Ericsson <ae@op5.se> wrote:\n> Eric Wong wrote:\n>> Junio C Hamano <gitster@pobox.com> wrote:\n>>> Eric Wong <normalperson@yhbt.net> writes:\n>>>\n>>>> Acked and and pushed out to git://git.bogomips.org/git-svn along with a\n>>>> followup patch ...\n>>> Hmmm...\n>>>\n>>> t9138-git-svn-multiple-branches.sh does not seem to pass for me.\n>>>\n>>>     ...\n>>>     A    svn_project/tags_A/1.0\n>>>     A    svn_project/tags_A/1.0/a.file\n>>>     Checked out revision 3.\n>>>     ./test-lib.sh: line 329: .: filename argument required\n>>>     .: usage: . filename [arguments]\n>>>     FATAL: Unexpected exit with code 2\n>>\n>> Oops, I wasn't reading the test too closely[1], this should fix it:\n>>\n>> From 1ad8ff7b49f508ad37081a709d4230833564eca2 Mon Sep 17 00:00:00 2001\n>> From: Eric Wong <normalperson@yhbt.net>\n>> Date: Thu, 25 Jun 2009 16:09:59 -0700\n>> Subject: [PATCH] t9138: remove stray \".\" in tests\n>>\n>> This breaks bash and probably some other shells, but worked\n>> fine with dash in my limited testing.\n>\n> Please reword to \"The stray dots break bash and ...\"\n> Right now it reads as if the patch itself breaks bash et al.\n\nOops, reworded to:\n\n    t9138: remove stray dot in test which broke bash\n\n    The stray dot broke bash and probably some other shells,\n    but worked fine with dash in my limited testing.\n\nAnd pushed out to git://git.bogomips.org/git-svn\n\nThere's also some other changes in there that have been sitting a while\nthat may have been lost in the shuffle in the weeks I was offline:\n\nBen Jackson (3):\n      Add 'git svn help [cmd]' which works outside a repo.\n      git-svn: speed up find_rev_before\n      Add 'git svn reset' to unwind 'git svn fetch'\n\nEric Wong (2):\n      git-svn: convert globs to regexps for branch destinations\n      t9138: remove stray dot in test which broke bash\n\nMarc Branchaud (1):\n      git svn: Support multiple branch and tag paths in the svn repository.\n\nThomas Rast (1):\n      git-svn: let 'dcommit $rev' work on $rev instead of HEAD\n\n-- \nEric Wong\n"},{"id":"117038","messageId":"4A451F8A.9060501@xiplink.com","threadId":"19792","inReplyTo":"20090625093602.GA3997@dcvr.yhbt.net","subject":"Re: [PATCH] git svn: Support multiple branch and tag paths in the svn repository.","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2009-06-26T19:20:42Z","receivedAt":"2009-06-26T19:20:42Z","isPatch":true,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"Thanks a bunch, Eric!\n\nCan I assume that since you've taken the commit into your repo that the feature will find itself into Junio's git at some point?\n\nI'll send out a documentation patch shortly.\n\nIs the svn_cmd wrapper simply a drop-in replacement for svn?  I can make that change, too.\n\n\t\tM.\n\n\nEric Wong wrote:\n> Marc Branchaud <marcnarc@xiplink.com> wrote:\n>> This enables git-svn.perl to read multiple 'branches' and 'tags' entries in\n>> svn-remote config sections.  The init and clone subcommands also support\n>> multiple --branches and --tags arguments.\n>>\n>> The branch (and tag) subcommand gets a new argument: --destination (or -d).\n>> This argument is required if there are multiple branches (or tags) entries\n>> configured for the remote Subversion repository.  The argument's value\n>> specifies which branch (or tag) path to use to create the branch (or tag).\n>> The specified value must match the left side (without wildcards) of one of\n>> the branches (or tags) refspecs in the svn-remote's config.\n>>\n>> Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>\n>> ---\n>>\n>> I got carried away making unit tests and went and implemented most of this...\n>>\n>> I'm fairly happy with this, except for the way the branch subcommand matches\n>> refspecs.  The patch does a simple string comparison, but it'd be better to do\n>> an actual glob.  I just couldn't track down the right function for that, so I\n>> left it as a strcmp and hope that a gitizen can tell me how to glob here.\n>>\n>> (ps. I'm trying a new way to send patches -- apologies if it's mangled!)\n> \n> Thanks Marc!  Everything looks fine here; I don't think I'll have time\n> to test it myself any time soon but your test case looks good and\n> doesn't break any of the other tests :)  Sorry for the delay, I haven't\n> had access to my computer or email much in the past few weeks.\n> \n> Acked and and pushed out to git://git.bogomips.org/git-svn along with a\n> followup patch to convert the glob to a regexp for branching:\n> \n> From f7050599310c18bd67b35b8d59486116b30ff1f6 Mon Sep 17 00:00:00 2001\n> From: Eric Wong <normalperson@yhbt.net>\n> Date: Thu, 25 Jun 2009 02:28:15 -0700\n> Subject: [PATCH] git-svn: convert globs to regexps for branch destinations\n> \n> Marc Branchaud wrote:\n>> I'm fairly happy with this, except for the way the branch\n>> subcommand matches refspecs.  The patch does a simple string\n>> comparison, but it'd be better to do an actual glob.  I just\n>> couldn't track down the right function for that, so I left it as\n>> a strcmp and hope that a gitizen can tell me how to glob here.\n> \n> Signed-off-by: Eric Wong <normalperson@yhbt.net>\n> ---\n> \n>  I haven't actually tested it, and yes, it should probably be\n>  moved to Git.pm even though it's not necessarily git-only...\n> \n>  git-svn.perl |    4 +++-\n>  1 files changed, 3 insertions(+), 1 deletions(-)\n> \n> diff --git a/git-svn.perl b/git-svn.perl\n> index 48e8aad..6c42e2a 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -646,7 +646,9 @@ sub cmd_branch {\n>  \t\t            \" with the --destination argument.\\n\";\n>  \t\t}\n>  \t\tforeach my $g (@{$allglobs}) {\n> -\t\t\tif ($_branch_dest eq $g->{path}->{left}) {\n> +\t\t\t# SVN::Git::Editor could probably be moved to Git.pm..\n> +\t\t\tmy $re = SVN::Git::Editor::glob2pat($g->{path}->{left});\n> +\t\t\tif ($_branch_dest =~ /$re/) {\n>  \t\t\t\t$glob = $g;\n>  \t\t\t\tlast;\n>  \t\t\t}\n"},{"id":"117040","messageId":"4A45344F.1010708@xiplink.com","threadId":"19792","inReplyTo":"4A451F8A.9060501@xiplink.com","subject":"[PATCH] git svn: Doc update for multiple branch and tag paths","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2009-06-26T20:49:19Z","receivedAt":"2009-06-26T20:49:19Z","isPatch":true,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>\n---\n\nIncludes changes to the description to be more accurate.\n\n Documentation/git-svn.txt |   44 +++++++++++++++++++++++++++++++++++---------\n 1 files changed, 35 insertions(+), 9 deletions(-)\n\ndiff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\nindex bb22d8e..5cbcdf4 100644\n--- a/Documentation/git-svn.txt\n+++ b/Documentation/git-svn.txt\n@@ -3,7 +3,7 @@ git-svn(1)\n \n NAME\n ----\n-git-svn - Bidirectional operation between a single Subversion branch and git\n+git-svn - Bidirectional operation between a Subversion repository and git\n \n SYNOPSIS\n --------\n@@ -15,13 +15,12 @@ DESCRIPTION\n It provides a bidirectional flow of changes between a Subversion and a git\n repository.\n \n-'git-svn' can track a single Subversion branch simply by using a\n-URL to the branch, follow branches laid out in the Subversion recommended\n-method (trunk, branches, tags directories) with the --stdlayout option, or\n-follow branches in any layout with the -T/-t/-b options (see options to\n-'init' below, and also the 'clone' command).\n+'git-svn' can track a standard Subversion repository,\n+following the common \"trunk/branches/tags\" layout, with the --stdlayout option.\n+It can also follow branches and tags in any layout with the -T/-t/-b options\n+(see options to 'init' below, and also the 'clone' command).\n \n-Once tracking a Subversion branch (with any of the above methods), the git\n+Once tracking a Subversion repository (with any of the above methods), the git\n repository can be updated from Subversion by the 'fetch' command and\n Subversion updated from git by the 'dcommit' command.\n \n@@ -48,8 +47,11 @@ COMMANDS\n --stdlayout;;\n \tThese are optional command-line options for init.  Each of\n \tthese flags can point to a relative repository path\n-\t(--tags=project/tags') or a full url\n-\t(--tags=https://foo.org/project/tags). The option --stdlayout is\n+\t(--tags=project/tags) or a full url\n+\t(--tags=https://foo.org/project/tags).\n+\tYou can specify more than one --tags and/or --branches options, in case\n+\tyour Subversion repository places tags or branches under multiple paths.\n+\tThe option --stdlayout is\n \ta shorthand way of setting trunk,tags,branches as the relative paths,\n \twhich is the Subversion default. If any of the other options are given\n \tas well, they take precedence.\n@@ -204,6 +206,20 @@ config key: svn.commiturl (overwrites all svn-remote.<name>.commiturl options)\n \tCreate a tag by using the tags_subdir instead of the branches_subdir\n \tspecified during git svn init.\n \n+-d;;\n+--destination;;\n+\tIf more than one --branches (or --tags) option was given to the 'init'\n+\tor 'clone' command, you must provide the location of the branch (or\n+\ttag) you wish to create in the SVN repository.  The value of this\n+\toption must match one of the paths specified by a --branches (or\n+\t--tags) option.  You can see these paths with the commands\n++\n+\tgit config --get-all svn-remote.<name>.branches\n+\tgit config --get-all svn-remote.<name>.tags\n++\n+where <name> is the name of the SVN repository as specified by the -R option to\n+'init' (or \"svn\" by default).\n+\n 'tag'::\n \tCreate a tag in the SVN repository. This is a shorthand for\n \t'branch -t'.\n@@ -669,6 +685,16 @@ already dcommitted.  It is considered bad practice to --amend commits\n you've already pushed to a remote repository for other users, and\n dcommit with SVN is analogous to that.\n \n+When using multiple --branches or --tags, 'git-svn' does not automatically\n+handle name collisions (for example, if two branches from different paths have\n+the same name, or if a branch and a tag have the same name).  In these cases,\n+use 'init' to set up your git repository then, before your first 'fetch', edit\n+the .git/config file so that the branches and tags are associated with\n+different name spaces.  For example:\n+\n+\tbranches = stable/*:refs/remotes/svn/stable/*\n+\tbranches = debug/*:refs/remotes/svn/debug/*\n+\n BUGS\n ----\n \n-- \n1.6.3.3\n"},{"id":"117041","messageId":"20090626205738.GB25118@dcvr.yhbt.net","threadId":"19792","inReplyTo":"4A451F8A.9060501@xiplink.com","subject":"Re: [PATCH] git svn: Support multiple branch and tag paths in the svn repository.","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-06-26T20:57:38Z","receivedAt":"2009-06-26T20:57:38Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Marc Branchaud <marcnarc@xiplink.com> wrote:\n> Thanks a bunch, Eric!\n\nNo problem, thanks for adding this feature since people have wanted it\nfor a while now and I couldn't get a chance to deliver it.\n\n> Can I assume that since you've taken the commit into your repo that\n> the feature will find itself into Junio's git at some point?\n\nYes.\n\n> I'll send out a documentation patch shortly.\n>\n> Is the svn_cmd wrapper simply a drop-in replacement for svn?  I can\n> make that change, too.\n\nYes, it should be a simple substitution. Can you also start using\n\"(cd $FOO && stuff && more_stuff)\" to chdir in subshells to avoid\nhaving to keep track of \"cd ..\"?  Thanks again!\n\n-- \nEric Wong\n"},{"id":"117042","messageId":"4A4538C3.5060901@xiplink.com","threadId":"19792","inReplyTo":"20090626205738.GB25118@dcvr.yhbt.net","subject":"[PATCH] git svn: Fix t9138-multiple-branches to use svn_cmd and (cd ...) syntax.","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2009-06-26T21:08:19Z","receivedAt":"2009-06-26T21:08:19Z","isPatch":true,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"---\n\nThis is against the master branch of Eric's git://git.bogomips.org/git-svn repo.\n\nEric, if there's anything else I can do to help this along please let me know!\n\n\t\tM.\n\n\n t/t9138-git-svn-multiple-branches.sh |  123 ++++++++++++++++++----------------\n 1 files changed, 66 insertions(+), 57 deletions(-)\n\ndiff --git a/t/t9138-git-svn-multiple-branches.sh b/t/t9138-git-svn-multiple-branches.sh\nindex 37ecdb0..cb9a6d2 100755\n--- a/t/t9138-git-svn-multiple-branches.sh\n+++ b/t/t9138-git-svn-multiple-branches.sh\n@@ -14,58 +14,58 @@ test_expect_success 'setup svnrepo' '\n \t\tproject/tags_A \\\n \t\tproject/tags_B &&\n \techo 1 > project/trunk/a.file &&\n-\tsvn import -m \"$test_description\" project \"$svnrepo/project\" &&\n+\tsvn_cmd import -m \"$test_description\" project \"$svnrepo/project\" &&\n \trm -rf project &&\n-\tsvn cp -m \"Branch 1\" \"$svnrepo/project/trunk\" \\\n-\t\t\t     \"$svnrepo/project/b_one/first\" &&\n-\tsvn cp -m \"Tag 1\" \"$svnrepo/project/trunk\" \\\n-\t\t\t  \"$svnrepo/project/tags_A/1.0\" &&\n-\tsvn co \"$svnrepo/project\" svn_project &&\n-\tcd svn_project &&\n+\tsvn_cmd cp -m \"Branch 1\" \"$svnrepo/project/trunk\" \\\n+\t\t\t\t \"$svnrepo/project/b_one/first\" &&\n+\tsvn_cmd cp -m \"Tag 1\" \"$svnrepo/project/trunk\" \\\n+\t\t\t      \"$svnrepo/project/tags_A/1.0\" &&\n+\tsvn_cmd co \"$svnrepo/project\" svn_project &&\n+\t( cd svn_project &&\n \t\techo 2 > trunk/a.file &&\n-\t\tsvn ci -m \"Change 1\" trunk/a.file &&\n-\t\tsvn cp -m \"Branch 2\" \"$svnrepo/project/trunk\" \\\n-\t\t\t\t     \"$svnrepo/project/b_one/second\" &&\n-\t\tsvn cp -m \"Tag 2\" \"$svnrepo/project/trunk\" \\\n-\t\t\t\t  \"$svnrepo/project/tags_A/2.0\" &&\n+\t\tsvn_cmd ci -m \"Change 1\" trunk/a.file &&\n+\t\tsvn_cmd cp -m \"Branch 2\" \"$svnrepo/project/trunk\" \\\n+\t\t\t\t\t \"$svnrepo/project/b_one/second\" &&\n+\t\tsvn_cmd cp -m \"Tag 2\" \"$svnrepo/project/trunk\" \\\n+\t\t\t\t      \"$svnrepo/project/tags_A/2.0\" &&\n \t\techo 3 > trunk/a.file &&\n-\t\tsvn ci -m \"Change 2\" trunk/a.file &&\n-\t\tsvn cp -m \"Branch 3\" \"$svnrepo/project/trunk\" \\\n-\t\t\t\t     \"$svnrepo/project/b_two/1\" &&\n-\t\tsvn cp -m \"Tag 3\" \"$svnrepo/project/trunk\" \\\n-\t\t\t\t  \"$svnrepo/project/tags_A/3.0\" &&\n+\t\tsvn_cmd ci -m \"Change 2\" trunk/a.file &&\n+\t\tsvn_cmd cp -m \"Branch 3\" \"$svnrepo/project/trunk\" \\\n+\t\t\t\t\t \"$svnrepo/project/b_two/1\" &&\n+\t\tsvn_cmd cp -m \"Tag 3\" \"$svnrepo/project/trunk\" \\\n+\t\t\t\t      \"$svnrepo/project/tags_A/3.0\" &&\n \t\techo 4 > trunk/a.file &&\n-\t\tsvn ci -m \"Change 3\" trunk/a.file &&\n-\t\tsvn cp -m \"Branch 4\" \"$svnrepo/project/trunk\" \\\n-\t\t\t\t     \"$svnrepo/project/b_two/2\" &&\n-\t\tsvn cp -m \"Tag 4\" \"$svnrepo/project/trunk\" \\\n-\t\t\t\t  \"$svnrepo/project/tags_A/4.0\" &&\n-\t\tsvn up &&\n+\t\tsvn_cmd ci -m \"Change 3\" trunk/a.file &&\n+\t\tsvn_cmd cp -m \"Branch 4\" \"$svnrepo/project/trunk\" \\\n+\t\t\t\t\t \"$svnrepo/project/b_two/2\" &&\n+\t\tsvn_cmd cp -m \"Tag 4\" \"$svnrepo/project/trunk\" \\\n+\t\t\t\t      \"$svnrepo/project/tags_A/4.0\" &&\n+\t\tsvn_cmd up &&\n \t\techo 5 > b_one/first/a.file &&\n-\t\tsvn ci -m \"Change 4\" b_one/first/a.file &&\n-\t\tsvn cp -m \"Tag 5\" \"$svnrepo/project/b_one/first\" \\\n-\t\t\t\t  \"$svnrepo/project/tags_B/v5\" &&\n+\t\tsvn_cmd ci -m \"Change 4\" b_one/first/a.file &&\n+\t\tsvn_cmd cp -m \"Tag 5\" \"$svnrepo/project/b_one/first\" \\\n+\t\t\t\t      \"$svnrepo/project/tags_B/v5\" &&\n \t\techo 6 > b_one/second/a.file &&\n-\t\tsvn ci -m \"Change 5\" b_one/second/a.file &&\n-\t\tsvn cp -m \"Tag 6\" \"$svnrepo/project/b_one/second\" \\\n-\t\t\t\t  \"$svnrepo/project/tags_B/v6\" &&\n+\t\tsvn_cmd ci -m \"Change 5\" b_one/second/a.file &&\n+\t\tsvn_cmd cp -m \"Tag 6\" \"$svnrepo/project/b_one/second\" \\\n+\t\t\t\t      \"$svnrepo/project/tags_B/v6\" &&\n \t\techo 7 > b_two/1/a.file &&\n-\t\tsvn ci -m \"Change 6\" b_two/1/a.file &&\n-\t\tsvn cp -m \"Tag 7\" \"$svnrepo/project/b_two/1\" \\\n-\t\t\t\t  \"$svnrepo/project/tags_B/v7\" &&\n+\t\tsvn_cmd ci -m \"Change 6\" b_two/1/a.file &&\n+\t\tsvn_cmd cp -m \"Tag 7\" \"$svnrepo/project/b_two/1\" \\\n+\t\t\t\t      \"$svnrepo/project/tags_B/v7\" &&\n \t\techo 8 > b_two/2/a.file &&\n-\t\tsvn ci -m \"Change 7\" b_two/2/a.file &&\n-\t\tsvn cp -m \"Tag 8\" \"$svnrepo/project/b_two/2\" \\\n-\t\t\t\t  \"$svnrepo/project/tags_B/v8\" &&\n-\tcd ..\n-\t'\n+\t\tsvn_cmd ci -m \"Change 7\" b_two/2/a.file &&\n+\t\tsvn_cmd cp -m \"Tag 8\" \"$svnrepo/project/b_two/2\" \\\n+\t\t\t\t      \"$svnrepo/project/tags_B/v8\"\n+\t)\n+'\n \n test_expect_success 'clone multiple branch and tag paths' '\n \tgit svn clone -T trunk \\\n \t\t      -b b_one/* --branches b_two/* \\\n \t\t      -t tags_A/* --tags tags_B \\\n \t\t      \"$svnrepo/project\" git_project &&\n-\tcd git_project &&\n+\t( cd git_project &&\n \t\tgit rev-parse refs/remotes/first &&\n \t\tgit rev-parse refs/remotes/second &&\n \t\tgit rev-parse refs/remotes/1 &&\n@@ -77,37 +77,46 @@ test_expect_success 'clone multiple branch and tag paths' '\n \t\tgit rev-parse refs/remotes/tags/v5 &&\n \t\tgit rev-parse refs/remotes/tags/v6 &&\n \t\tgit rev-parse refs/remotes/tags/v7 &&\n-\t\tgit rev-parse refs/remotes/tags/v8 &&\n-\tcd ..\n-\t'\n+\t\tgit rev-parse refs/remotes/tags/v8\n+\t)\n+'\n \n test_expect_success 'Multiple branch or tag paths require -d' '\n-\tcd git_project &&\n+\t( cd git_project &&\n \t\ttest_must_fail git svn branch -m \"No new branch\" Nope &&\n \t\ttest_must_fail git svn tag -m \"No new tag\" Tagless &&\n \t\ttest_must_fail git rev-parse refs/remotes/Nope &&\n-\t\ttest_must_fail git rev-parse refs/remotes/tags/Tagless &&\n-\tcd ../svn_project &&\n-\t\tsvn up &&\n+\t\ttest_must_fail git rev-parse refs/remotes/tags/Tagless\n+\t) &&\n+\t( cd svn_project &&\n+\t\tsvn_cmd up &&\n \t\ttest_must_fail test -d b_one/Nope &&\n \t\ttest_must_fail test -d b_two/Nope &&\n \t\ttest_must_fail test -d tags_A/Tagless &&\n-\t\ttest_must_fail test -d tags_B/Tagless &&\n-\tcd ..\n-\t'\n+\t\ttest_must_fail test -d tags_B/Tagless\n+\t)\n+'\n \n test_expect_success 'create new branches and tags' '\n-\t( cd git_project && git svn branch -m \"New branch 1\" -d project/b_one New1 ) &&\n-\t( cd svn_project && svn up && test -e b_one/New1/a.file ) &&\n+\t( cd git_project &&\n+\t\tgit svn branch -m \"New branch 1\" -d project/b_one New1 ) &&\n+\t( cd svn_project &&\n+\t\tsvn_cmd up && test -e b_one/New1/a.file ) &&\n \n-\t( cd git_project && git svn branch -m \"New branch 2\" -d project/b_two New2 ) &&\n-\t( cd svn_project && svn up && test -e b_two/New2/a.file ) &&\n+\t( cd git_project &&\n+\t\tgit svn branch -m \"New branch 2\" -d project/b_two New2 ) &&\n+\t( cd svn_project &&\n+\t\tsvn_cmd up && test -e b_two/New2/a.file ) &&\n \n-\t( cd git_project && git svn branch -t -m \"New tag 1\" -d project/tags_A Tag1 ) &&\n-\t( cd svn_project && svn up && test -e tags_A/Tag1/a.file )\n+\t( cd git_project &&\n+\t\tgit svn branch -t -m \"New tag 1\" -d project/tags_A Tag1 ) &&\n+\t( cd svn_project &&\n+\t\tsvn_cmd up && test -e tags_A/Tag1/a.file ) &&\n \n-\t( cd git_project && git svn tag -m \"New tag 2\" -d project/tags_B Tag2 ) &&\n-\t( cd svn_project && svn up && test -e tags_B/Tag2/a.file )\n-\t'\n+\t( cd git_project &&\n+\t\tgit svn tag -m \"New tag 2\" -d project/tags_B Tag2 ) &&\n+\t( cd svn_project &&\n+\t\tsvn_cmd up && test -e tags_B/Tag2/a.file )\n+'\n \n test_done\n-- \n1.6.3.3\n"},{"id":"117049","messageId":"20090626215452.GC25118@dcvr.yhbt.net","threadId":"19792","inReplyTo":"4A4538C3.5060901@xiplink.com","subject":"Re: [PATCH] git svn: Fix t9138-multiple-branches to use svn_cmd and (cd ...) syntax.","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-06-26T21:54:52Z","receivedAt":"2009-06-26T21:54:52Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Marc Branchaud <marcnarc@xiplink.com> wrote:\n> ---\n> \n> This is against the master branch of Eric's git://git.bogomips.org/git-svn repo.\n> \n> Eric, if there's anything else I can do to help this along please let me know!\n\nThanks Marc, sign-off?\n\n-- \nEric Wong\n"},{"id":"117088","messageId":"4A4634D7.9000607@xiplink.com","threadId":"19792","inReplyTo":"20090626215452.GC25118@dcvr.yhbt.net","subject":"Re: [PATCH] git svn: Fix t9138-multiple-branches to use svn_cmd and (cd ...) syntax.","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2009-06-27T15:03:51Z","receivedAt":"2009-06-27T15:03:51Z","isPatch":true,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"Eric Wong wrote:\n> \n> Thanks Marc, sign-off?\n\nDoh!\n\nSigned-off-by: Marc Branchaud <marcnarc@xiplink.com>\n\n\t\tM.\n"},{"id":"117106","messageId":"20090627220800.GA8876@dcvr.yhbt.net","threadId":"19792","inReplyTo":"4A4634D7.9000607@xiplink.com","subject":"Re: [PATCH] git svn: Fix t9138-multiple-branches to use svn_cmd and (cd ...) syntax.","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-06-27T22:08:00Z","receivedAt":"2009-06-27T22:08:00Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Marc Branchaud <marcnarc@xiplink.com> wrote:\n> Eric Wong wrote:\n>>\n>> Thanks Marc, sign-off?\n>\n> Doh!\n>\n> Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>\n\nThanks Marc!  This and the other patch pushed out to\ngit://git.bogomips.org/git-svn\n\n-- \nEric Wong\n"}]}