* [git-svn PATCH] Add --no-rebase option to git-svn dcommit
@ 2007-05-03 5:51 Karl Hasselström
2007-05-03 6:48 ` David Kågedal
2007-05-04 7:59 ` Eric Wong
0 siblings, 2 replies; 7+ messages in thread
From: Karl Hasselström @ 2007-05-03 5:51 UTC (permalink / raw)
To: Eric Wong; +Cc: Junio C Hamano, git
git-svn dcommit exports commits to Subversion, then imports them back
to git again, and last but not least rebases or resets HEAD to the
last of the new commits. I guess this rebasing is convenient when
using just git, but when the commits to be exported are managed by
StGIT, it's really annoying. So add an option to disable this
behavior. And document it, too!
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
Arguably, the switch should be --rebase instead, and default to not
rebase. But that would change the existing behavior, and possibly make
dcommit less convenient to use for at least the person who implemented
the existing behavior. Opinions?
Documentation/git-svn.txt | 3 +++
git-svn.perl | 33 ++++++++++++++++++---------------
2 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 62d7ef8..fcdeeaa 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -125,6 +125,9 @@ and have no uncommitted changes.
alternative to HEAD.
This is advantageous over 'set-tree' (below) because it produces
cleaner, more linear history.
++
+--no-rebase;;
+ After committing, do not rebase or reset.
--
'log'::
diff --git a/git-svn.perl b/git-svn.perl
index 6657e10..3c4f490 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -55,7 +55,7 @@ $sha1_short = qr/[a-f\d]{4,40}/;
my ($_stdin, $_help, $_edit,
$_message, $_file,
$_template, $_shared,
- $_version, $_fetch_all,
+ $_version, $_fetch_all, $_no_rebase,
$_merge, $_strategy, $_dry_run, $_local,
$_prefix, $_no_checkout, $_verbose);
$Git::SVN::_follow_parent = 1;
@@ -114,6 +114,7 @@ my %cmd = (
'verbose|v' => \$_verbose,
'dry-run|n' => \$_dry_run,
'fetch-all|all' => \$_fetch_all,
+ 'no-rebase' => \$_no_rebase,
%cmt_opts, %fc_opts } ],
'set-tree' => [ \&cmd_set_tree,
"Set an SVN repository to a git tree-ish",
@@ -413,21 +414,23 @@ sub cmd_dcommit {
return;
}
$_fetch_all ? $gs->fetch_all : $gs->fetch;
- # we always want to rebase against the current HEAD, not any
- # head that was passed to us
- my @diff = command('diff-tree', 'HEAD', $gs->refname, '--');
- my @finish;
- if (@diff) {
- @finish = rebase_cmd();
- print STDERR "W: HEAD and ", $gs->refname, " differ, ",
- "using @finish:\n", "@diff";
- } else {
- print "No changes between current HEAD and ",
- $gs->refname, "\nResetting to the latest ",
- $gs->refname, "\n";
- @finish = qw/reset --mixed/;
+ unless ($_no_rebase) {
+ # we always want to rebase against the current HEAD, not any
+ # head that was passed to us
+ my @diff = command('diff-tree', 'HEAD', $gs->refname, '--');
+ my @finish;
+ if (@diff) {
+ @finish = rebase_cmd();
+ print STDERR "W: HEAD and ", $gs->refname, " differ, ",
+ "using @finish:\n", "@diff";
+ } else {
+ print "No changes between current HEAD and ",
+ $gs->refname, "\nResetting to the latest ",
+ $gs->refname, "\n";
+ @finish = qw/reset --mixed/;
+ }
+ command_noisy(@finish, $gs->refname);
}
- command_noisy(@finish, $gs->refname);
}
sub cmd_find_rev {
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [git-svn PATCH] Add --no-rebase option to git-svn dcommit
2007-05-03 5:51 [git-svn PATCH] Add --no-rebase option to git-svn dcommit Karl Hasselström
@ 2007-05-03 6:48 ` David Kågedal
2007-05-03 15:53 ` Seth Falcon
2007-05-04 7:59 ` Eric Wong
1 sibling, 1 reply; 7+ messages in thread
From: David Kågedal @ 2007-05-03 6:48 UTC (permalink / raw)
To: git
Karl Hasselström <kha@treskal.com> writes:
> git-svn dcommit exports commits to Subversion, then imports them back
> to git again, and last but not least rebases or resets HEAD to the
> last of the new commits. I guess this rebasing is convenient when
> using just git, but when the commits to be exported are managed by
> StGIT, it's really annoying. So add an option to disable this
> behavior. And document it, too!
>
> Signed-off-by: Karl Hasselström <kha@treskal.com>
> ---
>
> Arguably, the switch should be --rebase instead, and default to not
> rebase. But that would change the existing behavior, and possibly make
> dcommit less convenient to use for at least the person who implemented
> the existing behavior. Opinions?
I don't agree. The rebase behaviour makes perfect sense in the normal
case, and I've been using it without problems. The special case is
when you start using stgit, so that's when you need to tell dcommit to
do something out of the ordinary.
Other than that, I like your patch. But you knew that already :-)
--
David Kågedal
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [git-svn PATCH] Add --no-rebase option to git-svn dcommit
2007-05-03 6:48 ` David Kågedal
@ 2007-05-03 15:53 ` Seth Falcon
0 siblings, 0 replies; 7+ messages in thread
From: Seth Falcon @ 2007-05-03 15:53 UTC (permalink / raw)
To: git
David Kågedal <davidk@lysator.liu.se> writes:
> Karl Hasselström <kha@treskal.com> writes:
>
>> git-svn dcommit exports commits to Subversion, then imports them back
>> to git again, and last but not least rebases or resets HEAD to the
>> last of the new commits. I guess this rebasing is convenient when
>> using just git, but when the commits to be exported are managed by
>> StGIT, it's really annoying. So add an option to disable this
>> behavior. And document it, too!
>>
>> Signed-off-by: Karl Hasselström <kha@treskal.com>
>> ---
>>
>> Arguably, the switch should be --rebase instead, and default to not
>> rebase. But that would change the existing behavior, and possibly make
>> dcommit less convenient to use for at least the person who implemented
>> the existing behavior. Opinions?
>
> I don't agree. The rebase behaviour makes perfect sense in the normal
> case, and I've been using it without problems. The special case is
> when you start using stgit, so that's when you need to tell dcommit to
> do something out of the ordinary.
I'm happy with git-svn dcommit's current behavior. Since it is
git-svn and not git-stGIT, I'm not in favor of changing a default to
make a stGIT use case more convenient.
+ seth
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [git-svn PATCH] Add --no-rebase option to git-svn dcommit
2007-05-03 5:51 [git-svn PATCH] Add --no-rebase option to git-svn dcommit Karl Hasselström
2007-05-03 6:48 ` David Kågedal
@ 2007-05-04 7:59 ` Eric Wong
2007-05-04 8:04 ` Eric Wong
2007-05-04 9:08 ` David Kågedal
1 sibling, 2 replies; 7+ messages in thread
From: Eric Wong @ 2007-05-04 7:59 UTC (permalink / raw)
To: Karl Hasselström; +Cc: Junio C Hamano, git
Karl Hasselström <kha@treskal.com> wrote:
> git-svn dcommit exports commits to Subversion, then imports them back
> to git again, and last but not least rebases or resets HEAD to the
> last of the new commits. I guess this rebasing is convenient when
> using just git, but when the commits to be exported are managed by
> StGIT, it's really annoying. So add an option to disable this
> behavior. And document it, too!
Cool, I've been planning to add this myself, too.
Acked-by: Eric Wong <normalperson@yhbt.net>
> Signed-off-by: Karl Hasselström <kha@treskal.com>
> ---
>
> Arguably, the switch should be --rebase instead, and default to not
> rebase. But that would change the existing behavior, and possibly make
> dcommit less convenient to use for at least the person who implemented
> the existing behavior. Opinions?
>
> Documentation/git-svn.txt | 3 +++
> git-svn.perl | 33 ++++++++++++++++++---------------
> 2 files changed, 21 insertions(+), 15 deletions(-)
>
> diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
> index 62d7ef8..fcdeeaa 100644
> --- a/Documentation/git-svn.txt
> +++ b/Documentation/git-svn.txt
> @@ -125,6 +125,9 @@ and have no uncommitted changes.
> alternative to HEAD.
> This is advantageous over 'set-tree' (below) because it produces
> cleaner, more linear history.
> ++
> +--no-rebase;;
> + After committing, do not rebase or reset.
> --
>
> 'log'::
> diff --git a/git-svn.perl b/git-svn.perl
> index 6657e10..3c4f490 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -55,7 +55,7 @@ $sha1_short = qr/[a-f\d]{4,40}/;
> my ($_stdin, $_help, $_edit,
> $_message, $_file,
> $_template, $_shared,
> - $_version, $_fetch_all,
> + $_version, $_fetch_all, $_no_rebase,
> $_merge, $_strategy, $_dry_run, $_local,
> $_prefix, $_no_checkout, $_verbose);
> $Git::SVN::_follow_parent = 1;
> @@ -114,6 +114,7 @@ my %cmd = (
> 'verbose|v' => \$_verbose,
> 'dry-run|n' => \$_dry_run,
> 'fetch-all|all' => \$_fetch_all,
> + 'no-rebase' => \$_no_rebase,
> %cmt_opts, %fc_opts } ],
> 'set-tree' => [ \&cmd_set_tree,
> "Set an SVN repository to a git tree-ish",
> @@ -413,21 +414,23 @@ sub cmd_dcommit {
> return;
> }
> $_fetch_all ? $gs->fetch_all : $gs->fetch;
> - # we always want to rebase against the current HEAD, not any
> - # head that was passed to us
> - my @diff = command('diff-tree', 'HEAD', $gs->refname, '--');
> - my @finish;
> - if (@diff) {
> - @finish = rebase_cmd();
> - print STDERR "W: HEAD and ", $gs->refname, " differ, ",
> - "using @finish:\n", "@diff";
> - } else {
> - print "No changes between current HEAD and ",
> - $gs->refname, "\nResetting to the latest ",
> - $gs->refname, "\n";
> - @finish = qw/reset --mixed/;
> + unless ($_no_rebase) {
> + # we always want to rebase against the current HEAD, not any
> + # head that was passed to us
> + my @diff = command('diff-tree', 'HEAD', $gs->refname, '--');
> + my @finish;
> + if (@diff) {
> + @finish = rebase_cmd();
> + print STDERR "W: HEAD and ", $gs->refname, " differ, ",
> + "using @finish:\n", "@diff";
> + } else {
> + print "No changes between current HEAD and ",
> + $gs->refname, "\nResetting to the latest ",
> + $gs->refname, "\n";
> + @finish = qw/reset --mixed/;
> + }
> + command_noisy(@finish, $gs->refname);
> }
> - command_noisy(@finish, $gs->refname);
> }
>
> sub cmd_find_rev {
>
--
Eric Wong
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [git-svn PATCH] Add --no-rebase option to git-svn dcommit
2007-05-04 7:59 ` Eric Wong
@ 2007-05-04 8:04 ` Eric Wong
2007-05-04 10:26 ` Karl Hasselström
2007-05-04 9:08 ` David Kågedal
1 sibling, 1 reply; 7+ messages in thread
From: Eric Wong @ 2007-05-04 8:04 UTC (permalink / raw)
To: Karl Hasselström; +Cc: Junio C Hamano, git
Eric Wong <normalperson@yhbt.net> wrote:
> Karl Hasselström <kha@treskal.com> wrote:
> > git-svn dcommit exports commits to Subversion, then imports them back
> > to git again, and last but not least rebases or resets HEAD to the
> > last of the new commits. I guess this rebasing is convenient when
> > using just git, but when the commits to be exported are managed by
> > StGIT, it's really annoying. So add an option to disable this
> > behavior. And document it, too!
>
> Cool, I've been planning to add this myself, too.
>
> Acked-by: Eric Wong <normalperson@yhbt.net>
>
> > Signed-off-by: Karl Hasselström <kha@treskal.com>
> > ---
> >
> > Arguably, the switch should be --rebase instead, and default to not
> > rebase. But that would change the existing behavior, and possibly make
> > dcommit less convenient to use for at least the person who implemented
> > the existing behavior. Opinions?
Erm, sorry, I skipped over this part. No. I like rebase being the
default behavior.
> > Documentation/git-svn.txt | 3 +++
> > git-svn.perl | 33 ++++++++++++++++++---------------
> > 2 files changed, 21 insertions(+), 15 deletions(-)
> >
> > diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
> > index 62d7ef8..fcdeeaa 100644
> > --- a/Documentation/git-svn.txt
> > +++ b/Documentation/git-svn.txt
> > @@ -125,6 +125,9 @@ and have no uncommitted changes.
> > alternative to HEAD.
> > This is advantageous over 'set-tree' (below) because it produces
> > cleaner, more linear history.
> > ++
> > +--no-rebase;;
> > + After committing, do not rebase or reset.
> > --
> >
> > 'log'::
> > diff --git a/git-svn.perl b/git-svn.perl
> > index 6657e10..3c4f490 100755
> > --- a/git-svn.perl
> > +++ b/git-svn.perl
> > @@ -55,7 +55,7 @@ $sha1_short = qr/[a-f\d]{4,40}/;
> > my ($_stdin, $_help, $_edit,
> > $_message, $_file,
> > $_template, $_shared,
> > - $_version, $_fetch_all,
> > + $_version, $_fetch_all, $_no_rebase,
> > $_merge, $_strategy, $_dry_run, $_local,
> > $_prefix, $_no_checkout, $_verbose);
> > $Git::SVN::_follow_parent = 1;
> > @@ -114,6 +114,7 @@ my %cmd = (
> > 'verbose|v' => \$_verbose,
> > 'dry-run|n' => \$_dry_run,
> > 'fetch-all|all' => \$_fetch_all,
> > + 'no-rebase' => \$_no_rebase,
> > %cmt_opts, %fc_opts } ],
> > 'set-tree' => [ \&cmd_set_tree,
> > "Set an SVN repository to a git tree-ish",
> > @@ -413,21 +414,23 @@ sub cmd_dcommit {
> > return;
> > }
> > $_fetch_all ? $gs->fetch_all : $gs->fetch;
> > - # we always want to rebase against the current HEAD, not any
> > - # head that was passed to us
> > - my @diff = command('diff-tree', 'HEAD', $gs->refname, '--');
> > - my @finish;
> > - if (@diff) {
> > - @finish = rebase_cmd();
> > - print STDERR "W: HEAD and ", $gs->refname, " differ, ",
> > - "using @finish:\n", "@diff";
> > - } else {
> > - print "No changes between current HEAD and ",
> > - $gs->refname, "\nResetting to the latest ",
> > - $gs->refname, "\n";
> > - @finish = qw/reset --mixed/;
> > + unless ($_no_rebase) {
> > + # we always want to rebase against the current HEAD, not any
> > + # head that was passed to us
> > + my @diff = command('diff-tree', 'HEAD', $gs->refname, '--');
> > + my @finish;
> > + if (@diff) {
> > + @finish = rebase_cmd();
> > + print STDERR "W: HEAD and ", $gs->refname, " differ, ",
> > + "using @finish:\n", "@diff";
> > + } else {
> > + print "No changes between current HEAD and ",
> > + $gs->refname, "\nResetting to the latest ",
> > + $gs->refname, "\n";
> > + @finish = qw/reset --mixed/;
> > + }
> > + command_noisy(@finish, $gs->refname);
> > }
> > - command_noisy(@finish, $gs->refname);
> > }
> >
> > sub cmd_find_rev {
--
Eric Wong
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [git-svn PATCH] Add --no-rebase option to git-svn dcommit
2007-05-04 7:59 ` Eric Wong
2007-05-04 8:04 ` Eric Wong
@ 2007-05-04 9:08 ` David Kågedal
1 sibling, 0 replies; 7+ messages in thread
From: David Kågedal @ 2007-05-04 9:08 UTC (permalink / raw)
To: git
Eric Wong <normalperson@yhbt.net> writes:
> Karl Hasselström <kha@treskal.com> wrote:
>> git-svn dcommit exports commits to Subversion, then imports them back
>> to git again, and last but not least rebases or resets HEAD to the
>> last of the new commits. I guess this rebasing is convenient when
>> using just git, but when the commits to be exported are managed by
>> StGIT, it's really annoying. So add an option to disable this
>> behavior. And document it, too!
>
> Cool, I've been planning to add this myself, too.
One thing I haven't figured out, although I haven't looked at the code
much, is this: When does git-svn do a merge rather than a rebase?
How can there ever be a diff? Is this perhaps something that can
happen if you use set-tree, because I don't see how it happens with
dcommit.
--
David Kågedal
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [git-svn PATCH] Add --no-rebase option to git-svn dcommit
2007-05-04 8:04 ` Eric Wong
@ 2007-05-04 10:26 ` Karl Hasselström
0 siblings, 0 replies; 7+ messages in thread
From: Karl Hasselström @ 2007-05-04 10:26 UTC (permalink / raw)
To: Eric Wong; +Cc: Junio C Hamano, git
On 2007-05-04 01:04:24 -0700, Eric Wong wrote:
> Erm, sorry, I skipped over this part. No. I like rebase being the
> default behavior.
As did everyone else. So I guess that's settled, then. :-)
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-05-04 11:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-03 5:51 [git-svn PATCH] Add --no-rebase option to git-svn dcommit Karl Hasselström
2007-05-03 6:48 ` David Kågedal
2007-05-03 15:53 ` Seth Falcon
2007-05-04 7:59 ` Eric Wong
2007-05-04 8:04 ` Eric Wong
2007-05-04 10:26 ` Karl Hasselström
2007-05-04 9:08 ` David Kågedal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).