{"thread":{"id":"41403","subject":"git svn dcommit doesn't support --username option for file:/// urls","startedAt":"2016-02-12T23:14:45Z","lastAt":"2016-02-15T22:01:17Z","messageCount":5,"participants":["Tim Ringenbach","Eric Wong"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"278039","messageId":"CAGZMbfc5Oi=EOYbCbZWfM1T65AZwCEbsso+QTkAe1sa4hRC61A@mail.gmail.com","threadId":"41403","inReplyTo":null,"subject":"git svn dcommit doesn't support --username option for file:/// urls","fromName":"Tim Ringenbach","fromEmail":"tim.ringenbach@gmail.com","sentAt":"2016-02-12T23:14:45Z","receivedAt":"2016-02-12T23:14:45Z","isPatch":false,"sender":{"key":"tim.ringenbach@gmail.com","avatar":null},"body":"Hi,\n\n'git svn dcommit' doesn't seem to honor the --username argument when\nmy svn repository url is a file:/// url.  It doesn't complain either,\nit just seems to silently ignore the option. My dcommits show up as\nthe user I'm logged in as. The only way I found to change that is to\n'sudo' to some other user.\n\nThe actual 'svn' command does support --username with 'svn commit'.\n\nWhat I'm actually up to, is trying to make a svn to git mirror\nbi-directional. Right now, I have a cron job that 'git svn fetch's and\n'git push origin's with some configs setup so that it does what I\nwant.\n\nI was experimenting with writing some scripting to go in the other\ndirection, and my first step was seeing if I could commit to svn as\nany user.  It seems like I should be able to and that git-svn just\ndoesn't support it.\n\n(BTW, I'm aware there's a lot of pitfalls I'll have to work around,\nand that I'll need to be very careful with verifying that the most\nrecent 'git-svn-id:' matches the branch and revision I expect to be\ncommitting to, and that bad things will happen if I mess it up.)\n\nThanks,\nTim\n"},{"id":"278151","messageId":"20160215100636.GA5785@dcvr.yhbt.net","threadId":"41403","inReplyTo":"CAGZMbfc5Oi=EOYbCbZWfM1T65AZwCEbsso+QTkAe1sa4hRC61A@mail.gmail.com","subject":"Re: git svn dcommit doesn't support --username option for file:/// urls","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2016-02-15T10:06:36Z","receivedAt":"2016-02-15T10:06:36Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Tim Ringenbach <tim.ringenbach@gmail.com> wrote:\n> Hi,\n> \n> 'git svn dcommit' doesn't seem to honor the --username argument when\n> my svn repository url is a file:/// url.  It doesn't complain either,\n> it just seems to silently ignore the option. My dcommits show up as\n> the user I'm logged in as. The only way I found to change that is to\n> 'sudo' to some other user.\n> \n> The actual 'svn' command does support --username with 'svn commit'.\n\nInteresting, I didn't know --username would be handled with\nfile:// at all by svn(1).  I don't think we do anything special\ndepending on the URL scheme for auth, either.\n\nI took a quick look at the svn(1) code\n(subversion/svn/svn.c in git://git.apache.org/subversion.git)\nbut didn't see anything jump out at me (I'm not really familiar\nwith that code, either).\n\nTotally untested, but does flipping the order of auth providers\nhelp at all?\n\ndiff --git a/perl/Git/SVN/Ra.pm b/perl/Git/SVN/Ra.pm\nindex e764696..c6ce247 100644\n--- a/perl/Git/SVN/Ra.pm\n+++ b/perl/Git/SVN/Ra.pm\n@@ -43,6 +43,7 @@ END {\n sub _auth_providers () {\n \trequire SVN::Client;\n \tmy @rv = (\n+\t  SVN::Client::get_username_provider(),\n \t  SVN::Client::get_simple_provider(),\n \t  SVN::Client::get_ssl_server_trust_file_provider(),\n \t  SVN::Client::get_simple_prompt_provider(\n@@ -53,7 +54,6 @@ sub _auth_providers () {\n \t  SVN::Client::get_ssl_client_cert_pw_file_provider(),\n \t  SVN::Client::get_ssl_client_cert_pw_prompt_provider(\n \t    \\&Git::SVN::Prompt::ssl_client_cert_pw, 2),\n-\t  SVN::Client::get_username_provider(),\n \t  SVN::Client::get_ssl_server_trust_prompt_provider(\n \t    \\&Git::SVN::Prompt::ssl_server_trust),\n \t  SVN::Client::get_username_prompt_provider(\n\n\n(I'm not sure if it breaks other things, either).\n"},{"id":"278186","messageId":"CAGZMbfdem6YzrEUw9A6ZWAbm6zXkNxqM3myAjHz4xFDS79VYwA@mail.gmail.com","threadId":"41403","inReplyTo":"20160215100636.GA5785@dcvr.yhbt.net","subject":"Re: git svn dcommit doesn't support --username option for file:/// urls","fromName":"Tim Ringenbach","fromEmail":"tim.ringenbach@gmail.com","sentAt":"2016-02-15T19:16:48Z","receivedAt":"2016-02-15T19:16:48Z","isPatch":false,"sender":{"key":"tim.ringenbach@gmail.com","avatar":null},"body":"On Mon, Feb 15, 2016 at 4:06 AM, Eric Wong <normalperson@yhbt.net> wrote:\n[snip]\n> Totally untested, but does flipping the order of auth providers\n> help at all?\n\nThanks for looking into this. Unfortunately, that didn't seem to make\na difference.\nI tried several times, and I tried both with and without\n--interactive, but the commits\nalways shared up as my unix user.\n\nI added a \"print \"test\\n\";\" to make sure my modify copy was being\nused, and I did see\nthat output, so I know I was running the right code.\n\nFor reference, here's what diff outputs on my side.\n\n--- git-2.7.1/perl/Git/SVN/Ra.pm 2016-02-05 17:31:08.000000000 -0600\n+++ local/share/perl/5.10.1/Git/SVN/Ra.pm 2016-02-15 13:06:27.000000000 -0600\n@@ -42,7 +42,9 @@ END {\n\n sub _auth_providers () {\n  require SVN::Client;\n+ print \"test\\n\";\n  my @rv = (\n+  SVN::Client::get_username_provider(),\n   SVN::Client::get_simple_provider(),\n   SVN::Client::get_ssl_server_trust_file_provider(),\n   SVN::Client::get_simple_prompt_provider(\n@@ -53,7 +55,6 @@ sub _auth_providers () {\n   SVN::Client::get_ssl_client_cert_pw_file_provider(),\n   SVN::Client::get_ssl_client_cert_pw_prompt_provider(\n     \\&Git::SVN::Prompt::ssl_client_cert_pw, 2),\n-  SVN::Client::get_username_provider(),\n   SVN::Client::get_ssl_server_trust_prompt_provider(\n     \\&Git::SVN::Prompt::ssl_server_trust),\n   SVN::Client::get_username_prompt_provider(\n\n\nThanks,\nTim\n"},{"id":"278197","messageId":"20160215211413.GA1578@dcvr.yhbt.net","threadId":"41403","inReplyTo":"CAGZMbfdem6YzrEUw9A6ZWAbm6zXkNxqM3myAjHz4xFDS79VYwA@mail.gmail.com","subject":"Re: git svn dcommit doesn't support --username option for file:/// urls","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2016-02-15T21:14:13Z","receivedAt":"2016-02-15T21:14:13Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Tim Ringenbach <tim.ringenbach@gmail.com> wrote:\n> On Mon, Feb 15, 2016 at 4:06 AM, Eric Wong <normalperson@yhbt.net> wrote:\n> [snip]\n> > Totally untested, but does flipping the order of auth providers\n> > help at all?\n> \n> Thanks for looking into this. Unfortunately, that didn't seem to make\n> a difference.\n\nThanks for trying.\n\nIt might take a while for me to get around to looking at this\nmore, so it would be very helpful if you poked around and tried\nsome different things in the source.\n\nIt should be helpful to look at any other SVN wrappers (or code\nSVN itself).  In the past, I got a lot of help from looking at\nsvk/SVN::Mirror.\n\nI'm certainly no expert when it comes to using the SVN API,\nso it's likely we're doing something wrong...\n\nBtw, which version of SVN are you using?  I also wonder if\nthere's something version-dependent.\n"},{"id":"278231","messageId":"CAGZMbffPYjX4g19AUPWJvknUtQ4AFeacKXpnQtuuOb1pPcOz-A@mail.gmail.com","threadId":"41403","inReplyTo":"20160215211413.GA1578@dcvr.yhbt.net","subject":"Re: git svn dcommit doesn't support --username option for file:/// urls","fromName":"Tim Ringenbach","fromEmail":"tim.ringenbach@gmail.com","sentAt":"2016-02-15T22:01:17Z","receivedAt":"2016-02-15T22:01:17Z","isPatch":false,"sender":{"key":"tim.ringenbach@gmail.com","avatar":null},"body":"On Mon, Feb 15, 2016 at 3:14 PM, Eric Wong <normalperson@yhbt.net> wrote:\n> It might take a while for me to get around to looking at this\n> more, so it would be very helpful if you poked around and tried\n> some different things in the source.\n\nOk, I played around with it some and found something that works.\nI commented out all the providers except for:\n\n   SVN::Client::get_username_prompt_provider(\n     \\&Git::SVN::Prompt::username, 2)\n\nAnd that seems to actually work!\n\nInterestingly, it doesn't actually interactively prompt me for a\nusername. At least, not when I ran 'git svn dcommit --username test'.\nIt did when I later ran a 'git svn fetch'.\n\nI don't know this API at all, and it's been a long time since I've\ndone any perl. (And I didn't even realize you used perl bindings to\nlibsvn until a few minutes ago, I just assumed you somehow implemented\neverything from scratch.)\n\nBut my guess is that 'SVN::Client::get_username_provider()' is\nprovided by the perl binding and isn't git-svn specific, and so it\nknows nothing of the --username argument, it simply is reading ~/.svn.\n(Assuming git-svn reads ~/.svn at all.) (That hints at maybe I could\ncontrol the user with the files in ~/.svn, which I didn't even\nconsider previously.) And if it knows nothing about git-svn or any\narguments passed, then that explains why it didn't work.\n\nMeanwhile, 'SVN::Client::get_username_prompt_provider' also looks like\na stock SVN::Client function, but it's passed in a Git::SVN::\nargument, that I'm assuming is some sort of callback. So in that case\nit's able to provided it with the passed in --username argument, or\nfailing that, it prompts me.\n\nSo I have something that I think will work for me. I'm not sure how to\nturn it into a reasonable patch though. Maybe we need to eliminate\nsome of the auth_provides from the list if the --username option is\npassed in?\n\n> Btw, which version of SVN are you using?  I also wonder if\n> there's something version-dependent.\n\nsvn --version\nsvn, version 1.6.12 (r955767)\n\nI know that's pretty old.\n\nThanks,\nTim\n"}]}