git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH v3 4/4] git-svn: Note about tags.
  2012-12-05  7:36 [PATCH v3 0/4] git-svn: More docs for branch handling Sebastian Leske
@ 2012-11-23  7:29 ` Sebastian Leske
  2012-11-30  7:16 ` [PATCH v3 3/4] git-svn: Expand documentation for --follow-parent Sebastian Leske
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Sebastian Leske @ 2012-11-23  7:29 UTC (permalink / raw
  To: git; +Cc: Eric Wong, Junio C Hamano

Document that 'git svn' will import SVN tags as branches.

Signed-off-by: Sebastian Leske <sebastian.leske@sleske.name>
---
 Documentation/git-svn.txt |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 021fb0e..445b033 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -968,6 +968,12 @@ the possible corner cases (git doesn't do it, either).  Committing
 renamed and copied files is fully supported if they're similar enough
 for git to detect them.
 
+In SVN, it is possible (though discouraged) to commit changes to a tag
+(because a tag is just a directory copy, thus technically the same as a
+branch). When cloning an SVN repository, 'git svn' cannot know if such a
+commit to a tag will happen in the future. Thus it acts conservatively
+and imports all SVN tags as branches, prefixing the tag name with 'tags/'.
+
 CONFIGURATION
 -------------
 
-- 
1.7.10.4

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

* [PATCH v3 1/4] git-svn: Document branches with at-sign(@).
  2012-12-05  7:36 [PATCH v3 0/4] git-svn: More docs for branch handling Sebastian Leske
                   ` (2 preceding siblings ...)
  2012-11-30  7:16 ` [PATCH v3 2/4] git-svn: Recommend use of structure options Sebastian Leske
@ 2012-11-30  7:16 ` Sebastian Leske
  2012-12-05 19:27   ` Junio C Hamano
  3 siblings, 1 reply; 7+ messages in thread
From: Sebastian Leske @ 2012-11-30  7:16 UTC (permalink / raw
  To: git; +Cc: Eric Wong, Junio C Hamano

git svn sometimes creates branches with an at-sign in the name
(branchname@revision). These branches confuse many users and it is a FAQ
why they are created. Document when git svn creates them.

Signed-off-by: Sebastian Leske <sebastian.leske@sleske.name>
---
 Documentation/git-svn.txt |   47 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 8b0d3ad..55bed53 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -830,6 +830,53 @@ inside git back upstream to SVN users.  Therefore it is advised that
 users keep history as linear as possible inside git to ease
 compatibility with SVN (see the CAVEATS section below).
 
+HANDLING OF SVN BRANCHES
+------------------------
+If 'git svn' is configured to fetch branches (and --follow-branches
+is in effect), it will sometimes create multiple git branches for one
+SVN branch, where the addtional branches have names of the form
+'branchname@nnn' (with nnn an SVN revision number).  These additional
+branches are created if 'git svn' cannot find a parent commit for the
+first commit in an SVN branch, to connect the branch to the history of
+the other branches.
+
+Normally, the first commit in an SVN branch consists
+of a copy operation. 'git svn' will read this commit to get the SVN
+revision the branch was created (copied) from. It will then try to find the
+git commit that corresponds to this SVN revision, and use that as the
+parent of the branch. However, it is possible that there is no suitable
+git commit to serve as parent.  This will happen, among other reasons,
+if the SVN branch is a copy of a revision that was not fetched by 'git
+svn' (e.g. because it is an old revision that was skipped with
+'--revision'), or if in SVN a directory was copied that is not tracked
+by 'git svn' (such as a branch that is not tracked at all, or a
+subdirectory of a tracked branch). In these cases, 'git svn' will still
+create a git branch, but instead of using an existing git commit as the
+parent of the branch, it will read the SVN history of the directory the
+branch was copied from and create appropriate git commits (this is
+indicated by the message "Initializing parent: <branchname>").
+
+Additionally, it will create a special branch named
+'<branchname>@<SVN-Revision>', where <SVN-Revision> is the SVN revision
+number the branch was copied from.  This branch will point to the newly
+created parent commit of the branch.  If in SVN the branch was deleted
+and later recreated from a different version, there will be multiple
+such branches with an '@'.
+
+Note that this may mean that multiple git commits are created for a
+single SVN revision.
+
+An example: In an SVN repository with a standard
+trunk/tags/branches layout, a directory trunk/sub is created in r.100.
+In r.200, trunk/sub is branched by copying it to branches/. 'git svn
+clone -s' will then create a branch 'sub'. It will also create new git
+commits for r.100 through r.199 and use these as the history of branch
+'sub'. Thus there will be two git commits for each revision from r.100
+to r.199 (one containing trunk/, one containing trunk/sub/). Finally,
+it will create a branch 'sub@200' pointing to the new parent commit of
+branch 'sub' (i.e. the commit for r.200 and trunk/sub/).
+
 CAVEATS
 -------
 
-- 
1.7.10.4

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

* [PATCH v3 2/4] git-svn: Recommend use of structure options.
  2012-12-05  7:36 [PATCH v3 0/4] git-svn: More docs for branch handling Sebastian Leske
  2012-11-23  7:29 ` [PATCH v3 4/4] git-svn: Note about tags Sebastian Leske
  2012-11-30  7:16 ` [PATCH v3 3/4] git-svn: Expand documentation for --follow-parent Sebastian Leske
@ 2012-11-30  7:16 ` Sebastian Leske
  2012-11-30  7:16 ` [PATCH v3 1/4] git-svn: Document branches with at-sign(@) Sebastian Leske
  3 siblings, 0 replies; 7+ messages in thread
From: Sebastian Leske @ 2012-11-30  7:16 UTC (permalink / raw
  To: git; +Cc: Eric Wong, Junio C Hamano

Document that when using git svn, one should usually either use the
directory structure options to import branches as branches, or only
import one subdirectory. The default behaviour of cloning all branches
and tags as subdirectories in the working copy is usually not what the
user wants.

Signed-off-by: Sebastian Leske <sebastian.leske@sleske.name>
---
 Documentation/git-svn.txt |   24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 55bed53..d8e5082 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -739,7 +739,8 @@ for rewriteRoot and rewriteUUID which can be used together.
 BASIC EXAMPLES
 --------------
 
-Tracking and contributing to the trunk of a Subversion-managed project:
+Tracking and contributing to the trunk of a Subversion-managed project
+(ignoring tags and branches):
 
 ------------------------------------------------------------------------
 # Clone a repo (like git clone):
@@ -764,8 +765,10 @@ Tracking and contributing to an entire Subversion-managed project
 (complete with a trunk, tags and branches):
 
 ------------------------------------------------------------------------
-# Clone a repo (like git clone):
-	git svn clone http://svn.example.com/project -T trunk -b branches -t tags
+# Clone a repo with standard SVN directory layout (like git clone):
+	git svn clone http://svn.example.com/project --stdlayout
+# Or, if the repo uses a non-standard directory layout:
+	git svn clone http://svn.example.com/project -T tr -b branch -t tag
 # View all branches and tags you have cloned:
 	git branch -r
 # Create a new branch in SVN
@@ -918,6 +921,21 @@ already dcommitted.  It is considered bad practice to --amend commits
 you've already pushed to a remote repository for other users, and
 dcommit with SVN is analogous to that.
 
+When cloning an SVN repository, if none of the options for describing
+the repository layout is used (--trunk, --tags, --branches,
+--stdlayout), 'git svn clone' will create a git repository with
+completely linear history, where branches and tags appear as separate
+directories in the working copy.  While this is the easiest way to get a
+copy of a complete repository, for projects with many branches it will
+lead to a working copy many times larger than just the trunk. Thus for
+projects using the standard directory structure (trunk/branches/tags),
+it is recommended to clone with option '--stdlayout'. If the project
+uses a non-standard structure, and/or if branches and tags are not
+required, it is easiest to only clone one directory (typically trunk),
+without giving any repository layout options.  If the full history with
+branches and tags is required, the options '--trunk' / '--branches' /
+'--tags' must be used.
+
 When using multiple --branches or --tags, 'git svn' does not automatically
 handle name collisions (for example, if two branches from different paths have
 the same name, or if a branch and a tag have the same name).  In these cases,
-- 
1.7.10.4

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

* [PATCH v3 3/4] git-svn: Expand documentation for --follow-parent
  2012-12-05  7:36 [PATCH v3 0/4] git-svn: More docs for branch handling Sebastian Leske
  2012-11-23  7:29 ` [PATCH v3 4/4] git-svn: Note about tags Sebastian Leske
@ 2012-11-30  7:16 ` Sebastian Leske
  2012-11-30  7:16 ` [PATCH v3 2/4] git-svn: Recommend use of structure options Sebastian Leske
  2012-11-30  7:16 ` [PATCH v3 1/4] git-svn: Document branches with at-sign(@) Sebastian Leske
  3 siblings, 0 replies; 7+ messages in thread
From: Sebastian Leske @ 2012-11-30  7:16 UTC (permalink / raw
  To: git; +Cc: Eric Wong, Junio C Hamano

Describe what the option --follow-parent does, and what happens if it is
set or unset.

Signed-off-by: Sebastian Leske <sebastian.leske@sleske.name>
---
 Documentation/git-svn.txt |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index d8e5082..021fb0e 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -628,10 +628,19 @@ ADVANCED OPTIONS
 	Default: "svn"
 
 --follow-parent::
+	This option is only relevant if we are tracking branches (using
+	one of the repository layout options --trunk, --tags,
+	--branches, --stdlayout). For each tracked branch, try to find
+	out where its revision was copied from, and set
+	a suitable parent in the first git commit for the branch.
 	This is especially helpful when we're tracking a directory
-	that has been moved around within the repository, or if we
-	started tracking a branch and never tracked the trunk it was
-	descended from. This feature is enabled by default, use
+	that has been moved around within the repository.  If this
+	feature is disabled, the branches created by 'git svn' will all
+	be linear and not share any history, meaning that there will be
+	no information on where branches were branched off or merged.
+	However, following long/convoluted histories can take a long
+	time, so disabling this feature may speed up the cloning
+	process. This feature is enabled by default, use
 	--no-follow-parent to disable it.
 +
 [verse]
-- 
1.7.10.4

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

* [PATCH v3 0/4] git-svn: More docs for branch handling
@ 2012-12-05  7:36 Sebastian Leske
  2012-11-23  7:29 ` [PATCH v3 4/4] git-svn: Note about tags Sebastian Leske
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Sebastian Leske @ 2012-12-05  7:36 UTC (permalink / raw
  To: git; +Cc: Eric Wong, Junio C Hamano

Updated version of my documentation patch for git-svn. Thanks to Junio C
Hamano for pointing out improvements.

Sebastian Leske (4):
  git-svn: Document branches with at-sign(@).
  git-svn: Recommend use of structure options.
  git-svn: Expand documentation for --follow-parent
  git-svn: Note about tags.

 Documentation/git-svn.txt |   92 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 86 insertions(+), 6 deletions(-)

-- 
1.7.10.4

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

* Re: [PATCH v3 1/4] git-svn: Document branches with at-sign(@).
  2012-11-30  7:16 ` [PATCH v3 1/4] git-svn: Document branches with at-sign(@) Sebastian Leske
@ 2012-12-05 19:27   ` Junio C Hamano
  2012-12-05 21:27     ` Eric Wong
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2012-12-05 19:27 UTC (permalink / raw
  To: Sebastian Leske; +Cc: git, Eric Wong

Sebastian Leske <Sebastian.Leske@sleske.name> writes:

> git svn sometimes creates branches with an at-sign in the name
> (branchname@revision). These branches confuse many users and it is a FAQ
> why they are created. Document when git svn creates them.
>
> Signed-off-by: Sebastian Leske <sebastian.leske@sleske.name>
> ---
>  Documentation/git-svn.txt |   47 +++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 47 insertions(+)

Thanks.  Your hunk header says that there should be 53 lines in the
postimage, but there actually are only 52.  I'll hand-tweak the
message and apply.

> diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
> index 8b0d3ad..55bed53 100644
> --- a/Documentation/git-svn.txt
> +++ b/Documentation/git-svn.txt
> @@ -830,6 +830,53 @@ inside git back upstream to SVN users.  Therefore it is advised that
>  users keep history as linear as possible inside git to ease
>  compatibility with SVN (see the CAVEATS section below).
>  
> +HANDLING OF SVN BRANCHES
> +------------------------
> +If 'git svn' is configured to fetch branches (and --follow-branches
> +is in effect), it will sometimes create multiple git branches for one
> +SVN branch, where the addtional branches have names of the form
> +'branchname@nnn' (with nnn an SVN revision number).  These additional
> +branches are created if 'git svn' cannot find a parent commit for the
> +first commit in an SVN branch, to connect the branch to the history of
> +the other branches.
> +
> +Normally, the first commit in an SVN branch consists
> +of a copy operation. 'git svn' will read this commit to get the SVN
> +revision the branch was created (copied) from. It will then try to find the
> +git commit that corresponds to this SVN revision, and use that as the
> +parent of the branch. However, it is possible that there is no suitable
> +git commit to serve as parent.  This will happen, among other reasons,
> +if the SVN branch is a copy of a revision that was not fetched by 'git
> +svn' (e.g. because it is an old revision that was skipped with
> +'--revision'), or if in SVN a directory was copied that is not tracked
> +by 'git svn' (such as a branch that is not tracked at all, or a
> +subdirectory of a tracked branch). In these cases, 'git svn' will still
> +create a git branch, but instead of using an existing git commit as the
> +parent of the branch, it will read the SVN history of the directory the
> +branch was copied from and create appropriate git commits (this is
> +indicated by the message "Initializing parent: <branchname>").
> +
> +Additionally, it will create a special branch named
> +'<branchname>@<SVN-Revision>', where <SVN-Revision> is the SVN revision
> +number the branch was copied from.  This branch will point to the newly
> +created parent commit of the branch.  If in SVN the branch was deleted
> +and later recreated from a different version, there will be multiple
> +such branches with an '@'.
> +
> +Note that this may mean that multiple git commits are created for a
> +single SVN revision.
> +
> +An example: In an SVN repository with a standard
> +trunk/tags/branches layout, a directory trunk/sub is created in r.100.
> +In r.200, trunk/sub is branched by copying it to branches/. 'git svn
> +clone -s' will then create a branch 'sub'. It will also create new git
> +commits for r.100 through r.199 and use these as the history of branch
> +'sub'. Thus there will be two git commits for each revision from r.100
> +to r.199 (one containing trunk/, one containing trunk/sub/). Finally,
> +it will create a branch 'sub@200' pointing to the new parent commit of
> +branch 'sub' (i.e. the commit for r.200 and trunk/sub/).
> +
>  CAVEATS
>  -------

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

* Re: [PATCH v3 1/4] git-svn: Document branches with at-sign(@).
  2012-12-05 19:27   ` Junio C Hamano
@ 2012-12-05 21:27     ` Eric Wong
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Wong @ 2012-12-05 21:27 UTC (permalink / raw
  To: Junio C Hamano; +Cc: Sebastian Leske, git

Junio C Hamano <gitster@pobox.com> wrote:
> Sebastian Leske <Sebastian.Leske@sleske.name> writes:
> > ---
> >  Documentation/git-svn.txt |   47 +++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 47 insertions(+)
> 
> Thanks.  Your hunk header says that there should be 53 lines in the
> postimage, but there actually are only 52.  I'll hand-tweak the
> message and apply.

Thanks all, this series
Acked-by: Eric Wong <normalperson@yhbt.net>

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

end of thread, other threads:[~2012-12-05 21:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-05  7:36 [PATCH v3 0/4] git-svn: More docs for branch handling Sebastian Leske
2012-11-23  7:29 ` [PATCH v3 4/4] git-svn: Note about tags Sebastian Leske
2012-11-30  7:16 ` [PATCH v3 3/4] git-svn: Expand documentation for --follow-parent Sebastian Leske
2012-11-30  7:16 ` [PATCH v3 2/4] git-svn: Recommend use of structure options Sebastian Leske
2012-11-30  7:16 ` [PATCH v3 1/4] git-svn: Document branches with at-sign(@) Sebastian Leske
2012-12-05 19:27   ` Junio C Hamano
2012-12-05 21:27     ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).