Add a --dry-run option to git-svn rebase
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 Add a --dry-run option to git-svn rebase
When working with multiple branches in an svn repository, it can be useful to verify the svn repository and local tracking branch that will be used for the rebase operation.
--- Documentation/git-svn.txt | 8 ++++++-- git-svn.perl | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-)
Documentation/git-svn.txt +6 -2
@@ -342,11 +342,15 @@ Passed directly to git-rebase when using 'dcommit' if a -n:: --dry-run:: -This is only used with the 'dcommit' command. +This can be used with the 'dcommit' and 'rebase' commands. -Print out the series of git arguments that would show +For 'dcommit', print out the series of git arguments that would show which diffs would be committed to SVN. +For 'rebase', display the local branch associated with the upstream svn +repository associated with the current branch and the URL of svn +repository that will be fetched from. + -- ADVANCED OPTIONS
git-svn.perl +6 -0
@@ -176,6 +176,7 @@ my %cmd = ( 'strategy|s=s' => \$_strategy, 'local|l' => \$_local, 'fetch-all|all' => \$_fetch_all, + 'dryrun|n' => \$_dry_run, %fc_opts } ], 'commit-diff' => [ \&cmd_commit_diff, 'Commit a diff between two trees',
@@ -553,6 +554,11 @@ sub cmd_rebase { die "Unable to determine upstream SVN information from ", "working tree history\n"; } + if ($_dry_run) { + print "remote-branch: " . $gs->refname . "\n"; + print "svn-url: " . $url . "\n"; + return; + } if (command(qw/diff-index HEAD --/)) { print STDERR "Cannot rebase with uncommited changes:\n"; command_noisy('status');
Signature · 1 line
1.5.5.1.316.g377d9.dirty
[resending to correct Eric's email address]
On Tue, May 20 2008, Seth Falcon wrote:
[...]
git-svn.perl my %cmd = ( · line 179
Quoted 9 lines
git-svn.perl +1
-0@@ -176,6 +176,7 @@ my %cmd = ( 'strategy|s=s' => \$_strategy, 'local|l' => \$_local, 'fetch-all|all' => \$_fetch_all, + 'dryrun|n' => \$_dry_run,
s/dryrun/dry-run/ perhaps? Also, it looks like you've used spaces instead of tabs.
Toby.
PATCH 1/1 Add a --dry-run option to git-svn rebase
When working with multiple branches in an svn repository, it can be useful to verify the svn repository and local tracking branch that will be used for the rebase operation.
---
Reworked to fix the spelling of dry-run and whitespace issues.
Documentation/git-svn.txt | 8 ++++++-- git-svn.perl | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-)
Documentation/git-svn.txt +6 -2
@@ -342,11 +342,15 @@ Passed directly to git-rebase when using 'dcommit' if a -n:: --dry-run:: -This is only used with the 'dcommit' command. +This can be used with the 'dcommit' and 'rebase' commands. -Print out the series of git arguments that would show +For 'dcommit', print out the series of git arguments that would show which diffs would be committed to SVN. +For 'rebase', display the local branch associated with the upstream svn +repository associated with the current branch and the URL of svn +repository that will be fetched from. + -- ADVANCED OPTIONS
git-svn.perl +6 -0
@@ -176,6 +176,7 @@ my %cmd = ( 'strategy|s=s' => \$_strategy, 'local|l' => \$_local, 'fetch-all|all' => \$_fetch_all, + 'dry-run|n' => \$_dry_run, %fc_opts } ], 'commit-diff' => [ \&cmd_commit_diff, 'Commit a diff between two trees',
@@ -553,6 +554,11 @@ sub cmd_rebase { die "Unable to determine upstream SVN information from ", "working tree history\n"; } + if ($_dry_run) { + print "remote-branch: " . $gs->refname . "\n"; + print "svn-url: " . $url . "\n"; + return; + } if (command(qw/diff-index HEAD --/)) { print STDERR "Cannot rebase with uncommited changes:\n"; command_noisy('status');
Signature · 1 line
1.5.5.1.316.g377d9.dirty
A message that is not in the archive (sent off-list or not yet received): [email protected]
Eric Wong
Acked-byQuoted 11 lines · Seth Falcon
Hi Eric,
I think this may have slipped by without your notice as I gather things have been busy for you.
Could you take a look at this patch and let me know if you like it/hate it/have a suggestion?
My motivation was wanting to automate some commit rewritting and wanting a script to be able to determine what the local upstream branch is...
This patch looks reasonable to me.
Quoted 5 lines · * On 2008-05-19 at 20:29 -0700 Seth Falcon wrote:
Quoted 4 lines
git-svn.perl +0
-0@@ -553,6 +554,11 @@ sub cmd_rebase { die "Unable to determine upstream SVN information from ", "working tree history\n"; }
Quoted 8 lines
git-svn.perl sub cmd_rebase { · line 564
Quoted 8 lines
git-svn.perl +5
-0+ if ($_dry_run) { + print "remote-branch: " . $gs->refname . "\n"; + print "svn-url: " . $url . "\n"; + return; + } if (command(qw/diff-index HEAD --/)) { print STDERR "Cannot rebase with uncommited changes:\n"; command_noisy('status');
One minor nit is 'url' not being capitalized in the output. Perhaps:
Remote Branch: foo
SVN URL: http://asdf/foo/trunk
Which would make it consistent with 'git svn info' using spaces:
RFC822-style headers would be alright, too.
Remote-Branch: foo
SVN-URL: http://asdf/foo/trunk
I do however harbor a deep dislike of camel-case (used by 'git log --pretty=fuller' and .git/config).
RemoteBranch: foo
SvnUrl: http://asdf/foo/trunk
Hmm, I don't think I've even _noticed_ a real bike shed in decades. Perhaps they should be painted purple with yellow polkadots and have the words "BIKE SHED" on a flashing neon sign.
Signature · 1 line
Eric Wong
Quoted 5 lines · * On 2008-06-01 at 03:13 -0700 Eric Wong wrote:
This patch looks reasonable to me.
Acked-by Eric Wong <[email protected]>One minor nit is 'url' not being capitalized in the output. Perhaps:
Any of the suggested bike shed colors are fine by me :-) I'll assume the patch is fine as-is, or will be edited by Junio before being applied, unless I hear otherwise.
Signature · 1 line
Seth Falcon | http://userprimary.net/user/
Quoted 10 lines · Seth Falcon
Quoted 5 lines · * On 2008-06-01 at 03:13 -0700 Eric Wong wrote:
This patch looks reasonable to me.
Acked-by Eric Wong <[email protected]>One minor nit is 'url' not being capitalized in the output. Perhaps:
Any of the suggested bike shed colors are fine by me :-) I'll assume the patch is fine as-is, or will be edited by Junio before being applied, unless I hear otherwise.
Yeah, I've queued the patch. Thanks, both.
Quoted 1 line · * On 2008-05-20 at 12:19 +1200 toby.allsopp (toby.allsopp - NAVMAN) wrote:
[resending to correct Eric's email address]
Sorry about that, typoed the address.
Quoted 2 lines
s/dryrun/dry-run/ perhaps? Also, it looks like you've used spaces instead of tabs.
I'll address both of those and resend, thanks.
+ seth
Signature · 1 line
Seth Falcon | http://userprimary.net/user/
On Tue, May 20 2008, Seth Falcon wrote:
[...]
git-svn.perl my %cmd = ( · line 179
Quoted 9 lines
git-svn.perl +1
-0@@ -176,6 +176,7 @@ my %cmd = ( 'strategy|s=s' => \$_strategy, 'local|l' => \$_local, 'fetch-all|all' => \$_fetch_all, + 'dryrun|n' => \$_dry_run,
s/dryrun/dry-run/ perhaps? Also, it looks like you've used spaces instead of tabs.
Toby.