{"thread":{"id":"9812","subject":"[PATCH] git-svn: always use --first-parent","startedAt":"2007-09-07T00:00:08Z","lastAt":"2007-09-07T00:37:45Z","messageCount":2,"participants":["Lars Hjemli","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"52822","messageId":"11891232082570-git-send-email-hjemli@gmail.com","threadId":"9812","inReplyTo":null,"subject":"[PATCH] git-svn: always use --first-parent","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2007-09-07T00:00:08Z","receivedAt":"2007-09-07T00:00:08Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"This makes git-svn unconditionally invoke git-log with --first-parent when\nit is trying to discover its upstream subversion branch and collecting the\ncommit ids which should be pushed to it with dcommit. The reason for always\nusing --first-parent is to make git-svn behave in a predictable way when the\nancestry chain contains merges with other git-svn branches.\n\nSince git-svn now always uses 'git-log --first-parent' there is no longer\nany need for the --first-parent option to git-svn, so this is removed.\n\nSigned-off-by: Lars Hjemli <hjemli@gmail.com>\n---\n\nI'd like to add a '--upstream <revspec>' option, just for completeness, but\nthat will also require a new test script and now it's way past my bedtime.\n\n\n Documentation/git-svn.txt |   10 ----------\n git-svn.perl              |   17 +++++------------\n 2 files changed, 5 insertions(+), 22 deletions(-)\n\ndiff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\nindex 42d7b82..be2e34e 100644\n--- a/Documentation/git-svn.txt\n+++ b/Documentation/git-svn.txt\n@@ -317,16 +317,6 @@ This is only used with the 'dcommit' command.\n Print out the series of git arguments that would show\n which diffs would be committed to SVN.\n \n---first-parent::\n-\n-This is only used with the 'dcommit', 'rebase', 'log', 'find-rev' and\n-'show-ignore' commands.\n-\n-These commands tries to detect the upstream subversion branch by means of\n-the embedded 'git-svn-id' line in commit messages. When --first-parent is\n-specified, git-svn only follows the first parent of each commit, effectively\n-ignoring commits brought into the current branch through merge-operations.\n-\n --\n \n ADVANCED OPTIONS\ndiff --git a/git-svn.perl b/git-svn.perl\nindex d21eb7f..badcd33 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -59,7 +59,7 @@ my ($_stdin, $_help, $_edit,\n \t$_template, $_shared,\n \t$_version, $_fetch_all, $_no_rebase,\n \t$_merge, $_strategy, $_dry_run, $_local,\n-\t$_prefix, $_no_checkout, $_verbose, $_first_parent);\n+\t$_prefix, $_no_checkout, $_verbose);\n $Git::SVN::_follow_parent = 1;\n my %remote_opts = ( 'username=s' => \\$Git::SVN::Prompt::_username,\n                     'config-dir=s' => \\$Git::SVN::Ra::config_dir,\n@@ -119,14 +119,12 @@ my %cmd = (\n \t\t\t  'dry-run|n' => \\$_dry_run,\n \t\t\t  'fetch-all|all' => \\$_fetch_all,\n \t\t\t  'no-rebase' => \\$_no_rebase,\n-\t\t\t  'first-parent' => \\$_first_parent,\n \t\t\t%cmt_opts, %fc_opts } ],\n \t'set-tree' => [ \\&cmd_set_tree,\n \t                \"Set an SVN repository to a git tree-ish\",\n \t\t\t{ 'stdin|' => \\$_stdin, %cmt_opts, %fc_opts, } ],\n \t'show-ignore' => [ \\&cmd_show_ignore, \"Show svn:ignore listings\",\n-\t\t\t{ 'revision|r=i' => \\$_revision,\n-\t\t\t  'first-parent' => \\$_first_parent\n+\t\t\t{ 'revision|r=i' => \\$_revision\n \t\t\t} ],\n \t'multi-fetch' => [ \\&cmd_multi_fetch,\n \t                   \"Deprecated alias for $0 fetch --all\",\n@@ -147,20 +145,16 @@ my %cmd = (\n \t\t\t  'non-recursive' => \\$Git::SVN::Log::non_recursive,\n \t\t\t  'authors-file|A=s' => \\$_authors,\n \t\t\t  'color' => \\$Git::SVN::Log::color,\n-\t\t\t  'pager=s' => \\$Git::SVN::Log::pager,\n-\t\t\t  'first-parent' => \\$_first_parent\n+\t\t\t  'pager=s' => \\$Git::SVN::Log::pager\n \t\t\t} ],\n \t'find-rev' => [ \\&cmd_find_rev, \"Translate between SVN revision numbers and tree-ish\",\n-\t\t\t{\n-\t\t\t  'first-parent' => \\$_first_parent\n-\t\t\t} ],\n+\t\t\t{} ],\n \t'rebase' => [ \\&cmd_rebase, \"Fetch and rebase your working directory\",\n \t\t\t{ 'merge|m|M' => \\$_merge,\n \t\t\t  'verbose|v' => \\$_verbose,\n \t\t\t  'strategy|s=s' => \\$_strategy,\n \t\t\t  'local|l' => \\$_local,\n \t\t\t  'fetch-all|all' => \\$_fetch_all,\n-\t\t\t  'first-parent' => \\$_first_parent,\n \t\t\t  %fc_opts } ],\n \t'commit-diff' => [ \\&cmd_commit_diff,\n \t                   'Commit a diff between two trees',\n@@ -818,8 +812,7 @@ sub cmt_metadata {\n \n sub working_head_info {\n \tmy ($head, $refs) = @_;\n-\tmy @args = ('log', '--no-color');\n-\tpush @args, '--first-parent' if $_first_parent;\n+\tmy @args = ('log', '--no-color', '--first-parent');\n \tmy ($fh, $ctx) = command_output_pipe(@args, $head);\n \tmy $hash;\n \tmy %max;\n-- \n1.5.3.1.g0e33-dirty\n"},{"id":"52827","messageId":"20070907003745.GA24713@hand.yhbt.net","threadId":"9812","inReplyTo":"11891232082570-git-send-email-hjemli@gmail.com","subject":"Re: [PATCH] git-svn: always use --first-parent","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-09-07T00:37:45Z","receivedAt":"2007-09-07T00:37:45Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Lars Hjemli <hjemli@gmail.com> wrote:\n> This makes git-svn unconditionally invoke git-log with --first-parent when\n> it is trying to discover its upstream subversion branch and collecting the\n> commit ids which should be pushed to it with dcommit. The reason for always\n> using --first-parent is to make git-svn behave in a predictable way when the\n> ancestry chain contains merges with other git-svn branches.\n> \n> Since git-svn now always uses 'git-log --first-parent' there is no longer\n> any need for the --first-parent option to git-svn, so this is removed.\n> \n> Signed-off-by: Lars Hjemli <hjemli@gmail.com>\n> ---\n> \n> I'd like to add a '--upstream <revspec>' option, just for completeness, but\n> that will also require a new test script and now it's way past my bedtime.\n\nSure thing.  We can work on getting --upstream another time, but for now\nthis is probably the best way to allow merges to work with git-svn.\n\nAcked-by: Eric Wong <normalperson@yhbt.net>\n\n-- \nEric Wong\n"}]}