git-svn init/clone --stdlayout option to default-init trunk/tags/branches
PATCH 1/1 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.
--- Documentation/git-svn.txt | 6 +++++- git-svn.perl | 11 +++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-)
Documentation/git-svn.txt +5 -1
@@ -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;;
git-svn.perl +9 -2
@@ -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(@_); }
Signature · 1 line
1.5.3.rc1.9.gf029
Quoted 6 lines · martin f. krafft
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 <[email protected]>
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.
Quoted 33 lines
--- Documentation/git-svn.txt | 6 +++++- git-svn.perl | 11 +++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-)Documentation/git-svn.txt +5
-1@@ -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;;git-svn.perl +0
-0@@ -77,11 +77,12 @@ my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent, \$Git::SVN::_repack_flags, %remote_opts );
git-svn.perl my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent, · line 88
Quoted 10 lines
git-svn.perl +2
-1-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.
git-svn.perl sub init_subdir { · line 297
Quoted 7 lines
git-svn.perl +2
-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) &&
The lines above and below use spaces for alignment, so this one should, definitely be using spaces after the initial tab too.
git-svn.perl sub cmd_clone { · line 311
Quoted 12 lines
git-svn.perl +5
-0$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
Quoted 3 lines
git-svn.perl +0
-0if (defined $_trunk || defined $_branches || defined $_tags) { return cmd_multi_init(@_); }
Signature · 1 line
Eric Wong
also sprach Eric Wong <[email protected]> [2007.07.14.1250 +0200]:
Quoted 2 lines
This looks good and useful, but can I also have a shorthand "-s" for this, too? I'm lazy, thanks :)
Of course.
Quoted 4 lines
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.
Signature · 6 lines
martin; (greetings from the heart of the sun.) \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck spamtraps: [email protected] save the plankton - eat a whale.
Quoted 8 lines · martin f krafft
also sprach Eric Wong <[email protected]> [2007.07.14.1250 +0200]:
Quoted 2 lines
This looks good and useful, but can I also have a shorthand "-s" for this, too? I'm lazy, thanks :)
Of course.
Quoted 2 lines
Also, nitpicking, there's been some whitespace damage:
Quoted 7 lines
Quoted 2 lines
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.
Quoted 2 lines
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.
Signature · 1 line
Eric Wong
also sprach Eric Wong <[email protected]> [2007.07.14.1334 +0200]:
Quoted 2 lines
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
Quoted 4 lines
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.
Signature · 6 lines
martin; (greetings from the heart of the sun.) \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck spamtraps: [email protected] Most Intelligent Customers Realise Our Software Only Fools Them.
Quoted 7 lines · martin f krafft
also sprach Eric Wong <[email protected]> [2007.07.14.1334 +0200]:
Quoted 2 lines
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:-
Quoted 4 lines
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.
Quoted 8 lines
Quoted 4 lines
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.
Signature · 1 line
Eric Wong
Here's a cleaned up version of this patch with my tweaks.
Quoted 1 line
From
f5b6da6bc4e2d879ca200993f0d3806486e8fb21Mon Sep 17 00:00:00 2001
From: martin f. krafft <[email protected]>
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]
--- Documentation/git-svn.txt | 7 ++++++- git-svn.perl | 11 +++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-)
Documentation/git-svn.txt +6 -1
@@ -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;;
git-svn.perl +9 -2
@@ -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(@_); }
Signature · 1 line
Eric Wong