threads / patch / 13573

patchAdd a --dry-run option to git-svn rebase

Subject: [PATCH] Add a --dry-run option to git-svn rebase

## tl;dr

8 messages between May 19, 2008 and Jun 2, 2008. Diffs are folded; open one to read it.

replies: 7people: 4as markdown or json

Seth Falcon· May 19, 2008, 14:20 UTC · lore

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.

Signed-off-by: Seth Falcon <seth@userprimary.net>
---
 Documentation/git-svn.txt |    8 ++++++--
 git-svn.perl              |    6 ++++++
 2 files changed, 12 insertions(+), 2 deletions(-)
Show changes to 2 files +12 −2

Documentation/git-svn.txt, git-svn.perl

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index c6b56b4..5890028 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -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
diff --git a/git-svn.perl b/git-svn.perl
index 2c53f39..de52c12 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -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');
-- 
1.5.5.1.316.g377d9.dirty
Toby Allsopp· May 20, 2008, 00:19 UTC · re: Seth Falcon · lore

Re: [PATCH] Add a --dry-run option to git-svn rebase

On Tue, May 20 2008, Seth Falcon wrote:
[...]
Show 9 quoted lines
> diff --git a/git-svn.perl b/git-svn.perl
> index 2c53f39..de52c12 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -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.
toby.allsopp (toby.allsopp - NAVMAN)· May 20, 2008, 00:19 UTC · re: Seth Falcon · lore

Re: [PATCH] Add a --dry-run option to git-svn rebase

[resending to correct Eric's email address]
On Tue, May 20 2008, Seth Falcon wrote:
[...]
Show 9 quoted lines
> diff --git a/git-svn.perl b/git-svn.perl
> index 2c53f39..de52c12 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -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.
Seth Falcon· May 20, 2008, 03:24 UTC · re: toby.allsopp (toby.allsopp - NAVMAN) · lore

Re: [PATCH] Add a --dry-run option to git-svn rebase

* 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.
> 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
-- 
Seth Falcon | http://userprimary.net/user/
Seth Falcon· May 20, 2008, 03:29 UTC · re: toby.allsopp (toby.allsopp - NAVMAN) · lore

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.

Signed-off-by: Seth Falcon <seth@userprimary.net>
---
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(-)
Show changes to 2 files +12 −2

Documentation/git-svn.txt, git-svn.perl

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index c6b56b4..5890028 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -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
diff --git a/git-svn.perl b/git-svn.perl
index 2c53f39..9c60ef4 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -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');
-- 
1.5.5.1.316.g377d9.dirty
Eric Wong· Jun 1, 2008, 10:13 UTC · lore

Re: [PATCH] Add a --dry-run option to git-svn rebase

Seth Falcon <seth@userprimary.net> wrote:
Show 11 quoted lines
> 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.
Acked-by: Eric Wong <normalperson@yhbt.net>
Show 13 quoted lines
> * On 2008-05-19 at 20:29 -0700 Seth Falcon wrote:
> > @@ -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');
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.

-- 
Eric Wong
Seth Falcon· Jun 2, 2008, 04:56 UTC · re: Eric Wong · lore

Re: [PATCH] Add a --dry-run option to git-svn rebase

* On 2008-06-01 at 03:13 -0700 Eric Wong wrote:
> This patch looks reasonable to me.
> Acked-by: Eric Wong <normalperson@yhbt.net>
> 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.

-- 
Seth Falcon | http://userprimary.net/user/
Junio C Hamano· Jun 2, 2008, 05:37 UTC · re: Seth Falcon · lore

Re: [PATCH] Add a --dry-run option to git-svn rebase

Seth Falcon <seth@userprimary.net> writes:
Show 10 quoted lines
> * On 2008-06-01 at 03:13 -0700 Eric Wong wrote:
>> This patch looks reasonable to me.
>> Acked-by: Eric Wong <normalperson@yhbt.net>
>
>> 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.

← back to recent threads