git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-svn init/clone --stdlayout option to default-init trunk/tags/branches
@ 2007-07-14  9:25 martin f. krafft
  2007-07-14 10:50 ` Eric Wong
  2007-08-23  6:10 ` Eric Wong
  0 siblings, 2 replies; 7+ messages in thread
From: martin f. krafft @ 2007-07-14  9:25 UTC (permalink / raw)
  To: git

The --stdlayout option to git-svn init/clone initialises the default
Subversion values of trunk,tags,branches: -T trunk -b branches -t tags.
If any of the -T/-t/-b options are given in addition, they are given
preference.

Signed-off-by: martin f. krafft <madduck@madduck.net>
---
 Documentation/git-svn.txt |    6 +++++-
 git-svn.perl              |   11 +++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 0a210e4..9e74b27 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -44,10 +44,14 @@ COMMANDS
 --tags=<tags_subdir>;;
 -b<branches_subdir>;;
 --branches=<branches_subdir>;;
+--stdlayout;;
 	These are optional command-line options for init.  Each of
 	these flags can point to a relative repository path
 	(--tags=project/tags') or a full url
-	(--tags=https://foo.org/project/tags)
+	(--tags=https://foo.org/project/tags). The option --stdlayout is
+	a shorthand way of setting trunk,tags,branches as the relative paths,
+	which is the Subversion default. If any of the other options are given
+	as well, they take precedence.
 --no-metadata;;
 	Set the 'noMetadata' option in the [svn-remote] config.
 --use-svm-props;;
diff --git a/git-svn.perl b/git-svn.perl
index b3dffcc..affba8e 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -77,11 +77,12 @@ my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent,
 		   \$Git::SVN::_repack_flags,
 		%remote_opts );
 
-my ($_trunk, $_tags, $_branches);
+my ($_trunk, $_tags, $_branches, $_stdlayout);
 my %icv;
 my %init_opts = ( 'template=s' => \$_template, 'shared:s' => \$_shared,
                   'trunk|T=s' => \$_trunk, 'tags|t=s' => \$_tags,
                   'branches|b=s' => \$_branches, 'prefix=s' => \$_prefix,
+                  'stdlayout' => \$_stdlayout,
                   'minimize-url|m' => \$Git::SVN::_minimize_url,
 		  'no-metadata' => sub { $icv{noMetadata} = 1 },
 		  'use-svm-props' => sub { $icv{useSvmProps} = 1 },
@@ -292,7 +293,8 @@ sub init_subdir {
 sub cmd_clone {
 	my ($url, $path) = @_;
 	if (!defined $path &&
-	    (defined $_trunk || defined $_branches || defined $_tags) &&
+	    (defined $_trunk || defined $_branches || defined $_tags ||
+		defined $_stdlayout) &&
 	    $url !~ m#^[a-z\+]+://#) {
 		$path = $url;
 	}
@@ -302,6 +304,11 @@ sub cmd_clone {
 }
 
 sub cmd_init {
+        if (defined $_stdlayout) {
+          $_trunk = 'trunk' if (!defined $_trunk);
+          $_tags = 'tags' if (!defined $_tags);
+          $_branches = 'branches' if (!defined $_branches);
+        }
 	if (defined $_trunk || defined $_branches || defined $_tags) {
 		return cmd_multi_init(@_);
 	}
-- 
1.5.3.rc1.9.gf029

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] git-svn init/clone --stdlayout option to default-init trunk/tags/branches
  2007-07-14  9:25 [PATCH] git-svn init/clone --stdlayout option to default-init trunk/tags/branches martin f. krafft
@ 2007-07-14 10:50 ` Eric Wong
  2007-07-14 11:04   ` martin f krafft
  2007-08-23  6:10 ` Eric Wong
  1 sibling, 1 reply; 7+ messages in thread
From: Eric Wong @ 2007-07-14 10:50 UTC (permalink / raw)
  To: martin f. krafft; +Cc: git

"martin f. krafft" <madduck@madduck.net> wrote:
> The --stdlayout option to git-svn init/clone initialises the default
> Subversion values of trunk,tags,branches: -T trunk -b branches -t tags.
> If any of the -T/-t/-b options are given in addition, they are given
> preference.
> 
> Signed-off-by: martin f. krafft <madduck@madduck.net>

Thanks.  I've been meaning to do this myself, but keep on putting it
off...

This looks good and useful, but can I also have a  shorthand "-s" for
this, too?  I'm lazy, thanks :)

Also, nitpicking, there's been some whitespace damage:

I use tab characters for indentation, and (should be using) spaces for
alignment.

> ---
>  Documentation/git-svn.txt |    6 +++++-
>  git-svn.perl              |   11 +++++++++--
>  2 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
> index 0a210e4..9e74b27 100644
> --- a/Documentation/git-svn.txt
> +++ b/Documentation/git-svn.txt
> @@ -44,10 +44,14 @@ COMMANDS
>  --tags=<tags_subdir>;;
>  -b<branches_subdir>;;
>  --branches=<branches_subdir>;;
> +--stdlayout;;
>  	These are optional command-line options for init.  Each of
>  	these flags can point to a relative repository path
>  	(--tags=project/tags') or a full url
> -	(--tags=https://foo.org/project/tags)
> +	(--tags=https://foo.org/project/tags). The option --stdlayout is
> +	a shorthand way of setting trunk,tags,branches as the relative paths,
> +	which is the Subversion default. If any of the other options are given
> +	as well, they take precedence.
>  --no-metadata;;
>  	Set the 'noMetadata' option in the [svn-remote] config.
>  --use-svm-props;;
> diff --git a/git-svn.perl b/git-svn.perl
> index b3dffcc..affba8e 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -77,11 +77,12 @@ my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent,
>  		   \$Git::SVN::_repack_flags,
>  		%remote_opts );
>  
> -my ($_trunk, $_tags, $_branches);
> +my ($_trunk, $_tags, $_branches, $_stdlayout);
>  my %icv;
>  my %init_opts = ( 'template=s' => \$_template, 'shared:s' => \$_shared,
>                    'trunk|T=s' => \$_trunk, 'tags|t=s' => \$_tags,
>                    'branches|b=s' => \$_branches, 'prefix=s' => \$_prefix,
> +                  'stdlayout' => \$_stdlayout,
>                    'minimize-url|m' => \$Git::SVN::_minimize_url,
>  		  'no-metadata' => sub { $icv{noMetadata} = 1 },
>  		  'use-svm-props' => sub { $icv{useSvmProps} = 1 },

Yes, I'm not consistent myself with using spaces for alignment :(
Thanks for using spaces here.

> @@ -292,7 +293,8 @@ sub init_subdir {
>  sub cmd_clone {
>  	my ($url, $path) = @_;
>  	if (!defined $path &&
> -	    (defined $_trunk || defined $_branches || defined $_tags) &&
> +	    (defined $_trunk || defined $_branches || defined $_tags ||
> +		defined $_stdlayout) &&

The lines above and below use spaces for alignment, so this one should,
definitely be using spaces after the initial tab too.

>  	    $url !~ m#^[a-z\+]+://#) {
>  		$path = $url;
>  	}
> @@ -302,6 +304,11 @@ sub cmd_clone {
>  }
>  
>  sub cmd_init {
> +        if (defined $_stdlayout) {
> +          $_trunk = 'trunk' if (!defined $_trunk);
> +          $_tags = 'tags' if (!defined $_tags);
> +          $_branches = 'branches' if (!defined $_branches);
> +        }

Indentation is always done in tabs in git-svn.  I *should* be using
spaces for alignment but I myself have been sloppy :x

>  	if (defined $_trunk || defined $_branches || defined $_tags) {
>  		return cmd_multi_init(@_);
>  	}

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] git-svn init/clone --stdlayout option to default-init trunk/tags/branches
  2007-07-14 10:50 ` Eric Wong
@ 2007-07-14 11:04   ` martin f krafft
  2007-07-14 11:34     ` Eric Wong
  0 siblings, 1 reply; 7+ messages in thread
From: martin f krafft @ 2007-07-14 11:04 UTC (permalink / raw)
  To: Eric Wong; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 774 bytes --]

also sprach Eric Wong <normalperson@yhbt.net> [2007.07.14.1250 +0200]:
> This looks good and useful, but can I also have a  shorthand "-s" for
> this, too?  I'm lazy, thanks :)

Of course.

> Also, nitpicking, there's been some whitespace damage:
> 
> I use tab characters for indentation, and (should be using) spaces for
> alignment.

What's the difference? Or is it simply:

  no. of tabs:   int(column / 8)
  no. of spaces: column % 8

?

I am sorry, I tried to do it right, even paid attention to the
tabs/spaces thing, but I guess I failed.

-- 
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
spamtraps: madduck.bogus@madduck.net
 
save the plankton - eat a whale.

[-- Attachment #2: Digital signature (GPG/PGP) --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] git-svn init/clone --stdlayout option to default-init trunk/tags/branches
  2007-07-14 11:04   ` martin f krafft
@ 2007-07-14 11:34     ` Eric Wong
  2007-07-14 12:04       ` martin f krafft
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Wong @ 2007-07-14 11:34 UTC (permalink / raw)
  To: git

martin f krafft <madduck@madduck.net> wrote:
> also sprach Eric Wong <normalperson@yhbt.net> [2007.07.14.1250 +0200]:
> > This looks good and useful, but can I also have a  shorthand "-s" for
> > this, too?  I'm lazy, thanks :)
> 
> Of course.
> 
> > Also, nitpicking, there's been some whitespace damage:
> > 
> > I use tab characters for indentation, and (should be using) spaces for
> > alignment.
> 
> What's the difference? Or is it simply:
> 
>   no. of tabs:   int(column / 8)
>   no. of spaces: column % 8

It's also easier/faster to navigate code with tabs since there are fewer
characters to iterate over, less granular points for indentation, making
it easier to to get to a desired indentation level.

The less granularity with tabs means I can avoid situations where where
I wonder if I'm correctly aligned with other pieces of code.  I even
have auto-indent set, but occasionally with spaces (when I work on Ruby
code) I still have problems with being off-by-one after editing
something.

There's absolutely no way I can misalign a block of code when alignment
granularity is 8 characters no matter how sleepy I get :)

I use tabs for indentation where they denote logically different code
paths / nesting.

Spaces (for alignment, not indentation) are mainly aesthetic.  I use
them in spaces when I need finer control (usually long conditionals in
if-statements that are wrapped).

Tabs can also be easily reconfigured in editors to change the amount of
screen real estate they consume.  Not really useful in git-svn since
I keep it <80 columns anyways.

> I am sorry, I tried to do it right, even paid attention to the
> tabs/spaces thing, but I guess I failed.

No worries.  The maintainers here are also very picky about trailing
whitespace and spaces that appear before tab characters, too and I
became much more disciplined about that myself the past year.

I have highlighting search set in my editor (vim :set hls)
and usually just search for spaces vs tabs to make sure I'm clean.

Of course, maintaining a consistent whitespace style helps a *lot* with
the git/Linux patch exchange development style because it avoids
needless patch application conflicts that arise from whitespace
differences.

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] git-svn init/clone --stdlayout option to default-init trunk/tags/branches
  2007-07-14 11:34     ` Eric Wong
@ 2007-07-14 12:04       ` martin f krafft
  2007-07-14 20:38         ` Eric Wong
  0 siblings, 1 reply; 7+ messages in thread
From: martin f krafft @ 2007-07-14 12:04 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]

also sprach Eric Wong <normalperson@yhbt.net> [2007.07.14.1334 +0200]:
> I have highlighting search set in my editor (vim :set hls)
> and usually just search for spaces vs tabs to make sure I'm clean.

Try:

  :se lcs=tab:>-,trail,-

  augroup listinsert
    autocmd InsertEnter * set nolist
    autocmd InsertLeave * set list
  augroup end

> Of course, maintaining a consistent whitespace style helps a *lot*
> with the git/Linux patch exchange development style because it
> avoids needless patch application conflicts that arise from
> whitespace differences.

Using tabs also makes it impossible to X-cut-paste patches from
emails; you *have* to use git-am and/or a temporary file, which
i don't like at all.

But thanks for the explanation.

-- 
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
spamtraps: madduck.bogus@madduck.net
 
Most Intelligent Customers Realise Our Software Only Fools Them.

[-- Attachment #2: Digital signature (GPG/PGP) --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] git-svn init/clone --stdlayout option to default-init trunk/tags/branches
  2007-07-14 12:04       ` martin f krafft
@ 2007-07-14 20:38         ` Eric Wong
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Wong @ 2007-07-14 20:38 UTC (permalink / raw)
  To: git

martin f krafft <madduck@madduck.net> wrote:
> also sprach Eric Wong <normalperson@yhbt.net> [2007.07.14.1334 +0200]:
> > I have highlighting search set in my editor (vim :set hls)
> > and usually just search for spaces vs tabs to make sure I'm clean.
> 
> Try:
> 
>   :se lcs=tab:>-,trail,-

That didn't work, this does:

    :se lcs=tab:>-,trail:-

>   augroup listinsert
>     autocmd InsertEnter * set nolist
>     autocmd InsertLeave * set list
>   augroup end

Eep.  Too confusing ;)  I have my hls color set to be a red underscore
(which nothing else in my syntax higlighting uses), so it's less
intrusive for me.

> > Of course, maintaining a consistent whitespace style helps a *lot*
> > with the git/Linux patch exchange development style because it
> > avoids needless patch application conflicts that arise from
> > whitespace differences.
> 
> Using tabs also makes it impossible to X-cut-paste patches from
> emails; you *have* to use git-am and/or a temporary file, which
> i don't like at all.

Ah.  I that's one of the reasons I rarely use X-cut-paste for multi-line
strings.

When I apply patches with or without git-am from email, I just start
mutt inside the working source directory I'm in, and from the mutt index
I spawn vim to edit any email (just hit 'e'), go into visual mode,
select the part I want to apply and pipe that to whatever patch
application program I want to use, and :q! out of vim.

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] git-svn init/clone --stdlayout option to default-init trunk/tags/branches
  2007-07-14  9:25 [PATCH] git-svn init/clone --stdlayout option to default-init trunk/tags/branches martin f. krafft
  2007-07-14 10:50 ` Eric Wong
@ 2007-08-23  6:10 ` Eric Wong
  1 sibling, 0 replies; 7+ messages in thread
From: Eric Wong @ 2007-08-23  6:10 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: martin f. krafft, git

Here's a cleaned up version of this patch with my tweaks.

>From f5b6da6bc4e2d879ca200993f0d3806486e8fb21 Mon Sep 17 00:00:00 2001
From: martin f. krafft <madduck@madduck.net>
Date: Sat, 14 Jul 2007 11:25:28 +0200
Subject: [PATCH] git-svn init/clone --stdlayout option to default-init trunk/tags/branches

The --stdlayout option to git-svn init/clone initialises the default
Subversion values of trunk,tags,branches: -T trunk -b branches -t tags.
If any of the -T/-t/-b options are given in addition, they are given
preference.

[ew: fixed whitespace and added "-s" shortcut]

Signed-off-by: martin f. krafft <madduck@madduck.net>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 Documentation/git-svn.txt |    7 ++++++-
 git-svn.perl              |   11 +++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index fbc5887..3e2a63b 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -44,10 +44,15 @@ COMMANDS
 --tags=<tags_subdir>;;
 -b<branches_subdir>;;
 --branches=<branches_subdir>;;
+-s;;
+--stdlayout;;
 	These are optional command-line options for init.  Each of
 	these flags can point to a relative repository path
 	(--tags=project/tags') or a full url
-	(--tags=https://foo.org/project/tags)
+	(--tags=https://foo.org/project/tags). The option --stdlayout is
+	a shorthand way of setting trunk,tags,branches as the relative paths,
+	which is the Subversion default. If any of the other options are given
+	as well, they take precedence.
 --no-metadata;;
 	Set the 'noMetadata' option in the [svn-remote] config.
 --use-svm-props;;
diff --git a/git-svn.perl b/git-svn.perl
index 7a8ffd5..4e325b7 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -77,11 +77,12 @@ my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent,
 		   \$Git::SVN::_repack_flags,
 		%remote_opts );
 
-my ($_trunk, $_tags, $_branches);
+my ($_trunk, $_tags, $_branches, $_stdlayout);
 my %icv;
 my %init_opts = ( 'template=s' => \$_template, 'shared:s' => \$_shared,
                   'trunk|T=s' => \$_trunk, 'tags|t=s' => \$_tags,
                   'branches|b=s' => \$_branches, 'prefix=s' => \$_prefix,
+                  'stdlayout|s' => \$_stdlayout,
                   'minimize-url|m' => \$Git::SVN::_minimize_url,
 		  'no-metadata' => sub { $icv{noMetadata} = 1 },
 		  'use-svm-props' => sub { $icv{useSvmProps} = 1 },
@@ -292,7 +293,8 @@ sub init_subdir {
 sub cmd_clone {
 	my ($url, $path) = @_;
 	if (!defined $path &&
-	    (defined $_trunk || defined $_branches || defined $_tags) &&
+	    (defined $_trunk || defined $_branches || defined $_tags ||
+	     defined $_stdlayout) &&
 	    $url !~ m#^[a-z\+]+://#) {
 		$path = $url;
 	}
@@ -302,6 +304,11 @@ sub cmd_clone {
 }
 
 sub cmd_init {
+	if (defined $_stdlayout) {
+		$_trunk = 'trunk' if (!defined $_trunk);
+		$_tags = 'tags' if (!defined $_tags);
+		$_branches = 'branches' if (!defined $_branches);
+	}
 	if (defined $_trunk || defined $_branches || defined $_tags) {
 		return cmd_multi_init(@_);
 	}
-- 
Eric Wong

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-08-23  6:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-14  9:25 [PATCH] git-svn init/clone --stdlayout option to default-init trunk/tags/branches martin f. krafft
2007-07-14 10:50 ` Eric Wong
2007-07-14 11:04   ` martin f krafft
2007-07-14 11:34     ` Eric Wong
2007-07-14 12:04       ` martin f krafft
2007-07-14 20:38         ` Eric Wong
2007-08-23  6:10 ` Eric Wong

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).