git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Add SVN->Git conversion example to documentation
@ 2008-06-14 18:03 Heikki Orsila
  2008-06-15 13:17 ` Karl Hasselström
  0 siblings, 1 reply; 9+ messages in thread
From: Heikki Orsila @ 2008-06-14 18:03 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
---
 Documentation/git-svn.txt |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index f4cbd2f..128761e 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -11,9 +11,12 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-git-svn is a simple conduit for changesets between Subversion and git.
-It is not to be confused with linkgit:git-svnimport[1], which is
-read-only.
+git-svn is a simple bidirectional conduit for changesets between
+Subversion and git. It is used to develop projects with Git tools,
+but commit changes to a Subversion repository. It can also be used to
+convert a Subversion repository to a Git repository. It should not to
+be confused with linkgit:git-svnimport[1], which does Subversion to
+Git conversion, but not the other direction.
 
 git-svn was originally designed for an individual developer who wants a
 bidirectional flow of changesets between a single branch in Subversion
@@ -520,6 +523,26 @@ have each person clone that repository with 'git clone':
 	git-svn rebase
 ------------------------------------------------------------------------
 
+CONVERTING A SUBVERSION REPOSITORY TO A GIT REPOSITORY
+------------------------------------------------------
+
+When converting a Subversion repository to a Git repository
+--no-metadata removes "git-svn-id:" comments from the log.
+-A option is used to convert SVN pseudonyms to real names
+and email addresses. The whole repository, or a part of it can be
+converted. Two examples below show how to convert the whole repo
+with all branches, or only the SVN trunk.
+
+------------------------------------------------------------------------
+# Convert all branches of an SVN repository to a Git repository:
+
+	git svn clone --no-metadata -A authors.txt SVN_URL foo.git
+
+# Convert only the trunk of an SVN repository to a Git repository:
+
+	git svn clone --no-metadata -A authors.txt SVN_URL/trunk foo.git
+------------------------------------------------------------------------
+
 REBASE VS. PULL/MERGE
 ---------------------
 
-- 
1.5.5.1.1.ga5e5c

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

* [PATCH] Add SVN->Git conversion example to documentation
@ 2008-06-14 18:09 Heikki Orsila
  2008-06-14 19:06 ` Miklos Vajna
  0 siblings, 1 reply; 9+ messages in thread
From: Heikki Orsila @ 2008-06-14 18:09 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
---
This is a correction to the earlier patch that had a typo.

 Documentation/git-svn.txt |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index f4cbd2f..dcf1e25 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -11,9 +11,12 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-git-svn is a simple conduit for changesets between Subversion and git.
-It is not to be confused with linkgit:git-svnimport[1], which is
-read-only.
+git-svn is a simple bidirectional conduit for changesets between
+Subversion and git. It is used to develop projects with Git tools,
+but commit changes to a Subversion repository. It can also be used to
+convert a Subversion repository to a Git repository. It should not
+be confused with linkgit:git-svnimport[1], which does Subversion to
+Git conversion, but not the other direction.
 
 git-svn was originally designed for an individual developer who wants a
 bidirectional flow of changesets between a single branch in Subversion
@@ -520,6 +523,26 @@ have each person clone that repository with 'git clone':
 	git-svn rebase
 ------------------------------------------------------------------------
 
+CONVERTING A SUBVERSION REPOSITORY TO A GIT REPOSITORY
+------------------------------------------------------
+
+When converting a Subversion repository to a Git repository
+--no-metadata removes "git-svn-id:" comments from the log.
+-A option is used to convert SVN pseudonyms to real names
+and email addresses. The whole repository, or a part of it can be
+converted. Two examples below show how to convert the whole repo
+with all branches, or only the SVN trunk.
+
+------------------------------------------------------------------------
+# Convert all branches of an SVN repository to a Git repository:
+
+	git svn clone --no-metadata -A authors.txt SVN_URL foo.git
+
+# Convert only the trunk of an SVN repository to a Git repository:
+
+	git svn clone --no-metadata -A authors.txt SVN_URL/trunk foo.git
+------------------------------------------------------------------------
+
 REBASE VS. PULL/MERGE
 ---------------------
 
-- 
1.5.5.1.1.ga5e5c

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

* Re: [PATCH] Add SVN->Git conversion example to documentation
  2008-06-14 18:09 Heikki Orsila
@ 2008-06-14 19:06 ` Miklos Vajna
  2008-06-14 21:50   ` Heikki Orsila
  0 siblings, 1 reply; 9+ messages in thread
From: Miklos Vajna @ 2008-06-14 19:06 UTC (permalink / raw)
  To: Heikki Orsila; +Cc: git, Junio C Hamano

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

On Sat, Jun 14, 2008 at 09:09:29PM +0300, Heikki Orsila <heikki.orsila@iki.fi> wrote:
> +------------------------------------------------------------------------
> +# Convert all branches of an SVN repository to a Git repository:
> +
> +	git svn clone --no-metadata -A authors.txt SVN_URL foo.git

Don't you need -s here?

Two other minor notes:

1) I would add an example on how to update such a repo in case it will
be a mirror, like 'git --bare svn fetch'.

2) I would mention that one still needs a trick if he/she wants to allow
others to clone this repo, with something like:

git config remote.origin.url .
git config remote.origin.fetch +refs/remotes/tags/*:refs/tags/*
git config --add remote.origin.fetch +refs/remotes/*:refs/heads/*
git fetch

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH] Add SVN->Git conversion example to documentation
  2008-06-14 19:06 ` Miklos Vajna
@ 2008-06-14 21:50   ` Heikki Orsila
  0 siblings, 0 replies; 9+ messages in thread
From: Heikki Orsila @ 2008-06-14 21:50 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Heikki Orsila, git, Junio C Hamano

On Sat, Jun 14, 2008 at 09:06:48PM +0200, Miklos Vajna wrote:
> On Sat, Jun 14, 2008 at 09:09:29PM +0300, Heikki Orsila <heikki.orsila@iki.fi> wrote:
> > +------------------------------------------------------------------------
> > +# Convert all branches of an SVN repository to a Git repository:
> > +
> > +	git svn clone --no-metadata -A authors.txt SVN_URL foo.git
> 
> Don't you need -s here?

It seems not.

> 2) I would mention that one still needs a trick if he/she wants to allow
> others to clone this repo, with something like:
> 
> git config remote.origin.url .
> git config remote.origin.fetch +refs/remotes/tags/*:refs/tags/*
> git config --add remote.origin.fetch +refs/remotes/*:refs/heads/*
> git fetch

Will add.

-- 
Heikki Orsila
heikki.orsila@iki.fi
http://www.iki.fi/shd

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

* [PATCH] Add SVN->Git conversion example to documentation
@ 2008-06-14 21:58 Heikki Orsila
  2008-06-14 22:47 ` Miklos Vajna
  2008-06-17 23:21 ` Junio C Hamano
  0 siblings, 2 replies; 9+ messages in thread
From: Heikki Orsila @ 2008-06-14 21:58 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Miklos Vajna

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
---
This is the third round. Added some commands to clean up the repository, 
and set fetch heads. Thanks to Miklos Vajna for feedback.

 Documentation/git-svn.txt |   41 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index f4cbd2f..26e00c5 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -11,9 +11,12 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-git-svn is a simple conduit for changesets between Subversion and git.
-It is not to be confused with linkgit:git-svnimport[1], which is
-read-only.
+git-svn is a simple bidirectional conduit for changesets between
+Subversion and git. It is used to develop projects with Git tools,
+but commit changes to a Subversion repository. It can also be used to
+convert a Subversion repository to a Git repository. It should not
+be confused with linkgit:git-svnimport[1], which does Subversion to
+Git conversion, but not the other direction.
 
 git-svn was originally designed for an individual developer who wants a
 bidirectional flow of changesets between a single branch in Subversion
@@ -520,6 +523,38 @@ have each person clone that repository with 'git clone':
 	git-svn rebase
 ------------------------------------------------------------------------
 
+CONVERTING A SUBVERSION REPOSITORY TO A GIT REPOSITORY
+------------------------------------------------------
+
+When converting a Subversion repository to a Git repository
+--no-metadata removes "git-svn-id:" comments from the log.
+-A option is used to convert SVN pseudonyms to real names
+and email addresses. The whole repository, or a part of it can be
+converted. Two examples below show how to convert the whole repo
+with all branches, or only the SVN trunk.
+
+------------------------------------------------------------------------
+# Convert all branches of an SVN repository to a Git repository:
+
+	git svn clone --no-metadata -A authors.txt SVN_URL foo.git
+
+# Convert only the trunk of an SVN repository to a Git repository:
+
+	git svn clone --no-metadata -A authors.txt SVN_URL/trunk foo.git
+------------------------------------------------------------------------
+After that, the new repository should be cleaned, and fetch heads should
+be set.
+------------------------------------------------------------------------
+	cd foo.git/.git
+	rm -rf svn
+	git config --remove-section svn-remote.svn
+	git config remote.origin.url .
+	git config remote.origin.fetch +refs/remotes/tags/*:refs/tags/*
+	git config --add remote.origin.fetch +refs/remotes/*:refs/heads/*
+	git fetch
+	git gc
+------------------------------------------------------------------------
+
 REBASE VS. PULL/MERGE
 ---------------------
 
-- 
1.5.5.1.1.ga5e5c

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

* Re: [PATCH] Add SVN->Git conversion example to documentation
  2008-06-14 21:58 Heikki Orsila
@ 2008-06-14 22:47 ` Miklos Vajna
  2008-06-17 23:21 ` Junio C Hamano
  1 sibling, 0 replies; 9+ messages in thread
From: Miklos Vajna @ 2008-06-14 22:47 UTC (permalink / raw)
  To: Heikki Orsila; +Cc: git, Junio C Hamano

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

On Sun, Jun 15, 2008 at 12:58:12AM +0300, Heikki Orsila <heikki.orsila@iki.fi> wrote:
> +After that, the new repository should be cleaned, and fetch heads should
> +be set.
> +------------------------------------------------------------------------
> +	cd foo.git/.git

Heh, I was confused. foo.git is usually a bare repo, if the repo has a
working directory as well, then just call it foo.

And then: if you convert an svn repo to a git one, don't you want to
convert it to a bare repo?

I haven't tried git-svn clone but the following will work for sure:

git --bare init
git --bare svn init -s URL
git --bare svn fetch

> +	rm -rf svn
> +	git config --remove-section svn-remote.svn
> +	git config remote.origin.url .
> +	git config remote.origin.fetch +refs/remotes/tags/*:refs/tags/*
> +	git config --add remote.origin.fetch +refs/remotes/*:refs/heads/*
> +	git fetch
> +	git gc

If you remove the svn dir, why don't you remove refs/remotes as well?
(Probably via update-ref since git svn will pack refs before it ends for
big repos, I think.)

Also I think it would be a good idea to give a hint how to do
incremental updates. Something like not deleting the svn dir and using
git --bare svn fetch; git fetch.

PS: I'm not a git-svn contributor or anything, just thought I give you
some advices, I hope it helped. :-)

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH] Add SVN->Git conversion example to documentation
  2008-06-14 18:03 [PATCH] Add SVN->Git conversion example to documentation Heikki Orsila
@ 2008-06-15 13:17 ` Karl Hasselström
  0 siblings, 0 replies; 9+ messages in thread
From: Karl Hasselström @ 2008-06-15 13:17 UTC (permalink / raw)
  To: Heikki Orsila; +Cc: git, Junio C Hamano

On 2008-06-14 21:03:34 +0300, Heikki Orsila wrote:

>  DESCRIPTION
>  -----------
> -git-svn is a simple conduit for changesets between Subversion and git.
> -It is not to be confused with linkgit:git-svnimport[1], which is
> -read-only.
> +git-svn is a simple bidirectional conduit for changesets between
> +Subversion and git. It is used to develop projects with Git tools,
> +but commit changes to a Subversion repository. It can also be used to
> +convert a Subversion repository to a Git repository. It should not to
> +be confused with linkgit:git-svnimport[1], which does Subversion to
> +Git conversion, but not the other direction.

I don't know if it's such a good idea to mention git-svnimport at all;
but if you do, please also mention that it's no longer supported. (But
really, since it is no longer supported, I doubt mentioning it is a
good idea.)

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

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

* Re: [PATCH] Add SVN->Git conversion example to documentation
  2008-06-14 21:58 Heikki Orsila
  2008-06-14 22:47 ` Miklos Vajna
@ 2008-06-17 23:21 ` Junio C Hamano
  2008-06-18  0:55   ` Heikki Orsila
  1 sibling, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2008-06-17 23:21 UTC (permalink / raw)
  To: Heikki Orsila; +Cc: git, Miklos Vajna

Heikki Orsila <heikki.orsila@iki.fi> writes:

> Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
> ---
> This is the third round. Added some commands to clean up the repository, 
> and set fetch heads. Thanks to Miklos Vajna for feedback.
>
>  Documentation/git-svn.txt |   41 ++++++++++++++++++++++++++++++++++++++---
>  1 files changed, 38 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
> index f4cbd2f..26e00c5 100644
> --- a/Documentation/git-svn.txt
> +++ b/Documentation/git-svn.txt
> @@ -11,9 +11,12 @@ SYNOPSIS
>  
>  DESCRIPTION
>  -----------
> -git-svn is a simple conduit for changesets between Subversion and git.
> -It is not to be confused with linkgit:git-svnimport[1], which is
> -read-only.
> +git-svn is a simple bidirectional conduit for changesets between
> +Subversion and git. It is used to develop projects with Git tools,
> +but commit changes to a Subversion repository. It can also be used to

That is correct but doesn't the above give a false impression that commits
are only made on subversion side and never on git side?

> +convert a Subversion repository to a Git repository. It should not
> +be confused with linkgit:git-svnimport[1], which does Subversion to
> +Git conversion, but not the other direction.

We do not ship nor document svnimport anymore and linkgit: there is
actively wrong.  People seem to be confused with ancient documents still
floating on the Web that talk about svnimport, and I think it is a good
idea to try to clear the confusion here, but perhaps...

	... with the deprecated `git-svnimport`, which was used for
	one-way conversion from Subversion to git.

> @@ -520,6 +523,38 @@ have each person clone that repository with 'git clone':
>  	git-svn rebase
>  ------------------------------------------------------------------------
>  
> +CONVERTING A SUBVERSION REPOSITORY TO A GIT REPOSITORY
> +------------------------------------------------------
> +
> +When converting a Subversion repository to a Git repository
> +--no-metadata removes "git-svn-id:" comments from the log.
> +-A option is used to convert SVN pseudonyms to real names

Anything that user usually would type on the command line it is preferred
to typeset with `quoted like this`, so "`--no-metadata`" and "`-A` option".

It is not `--no-metadata` "removes".  git-svn adds cruft because it wants
to use it for bidi operation, but --no-metadata prevents it from doing
so.

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

* Re: [PATCH] Add SVN->Git conversion example to documentation
  2008-06-17 23:21 ` Junio C Hamano
@ 2008-06-18  0:55   ` Heikki Orsila
  0 siblings, 0 replies; 9+ messages in thread
From: Heikki Orsila @ 2008-06-18  0:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Heikki Orsila, git, Miklos Vajna

On Tue, Jun 17, 2008 at 04:21:36PM -0700, Junio C Hamano wrote:
> > -git-svn is a simple conduit for changesets between Subversion and git.
> > -It is not to be confused with linkgit:git-svnimport[1], which is
> > -read-only.
> > +git-svn is a simple bidirectional conduit for changesets between
> > +Subversion and git. It is used to develop projects with Git tools,
> > +but commit changes to a Subversion repository. It can also be used to
> 
> That is correct but doesn't the above give a false impression that commits
> are only made on subversion side and never on git side?

Hmm.. I'll try to make it more explicity. Will send another patch soon.

> > +convert a Subversion repository to a Git repository. It should not
> > +be confused with linkgit:git-svnimport[1], which does Subversion to
> > +Git conversion, but not the other direction.
> 
> We do not ship nor document svnimport anymore and linkgit: there is
> actively wrong.  People seem to be confused with ancient documents still
> floating on the Web that talk about svnimport, and I think it is a good
> idea to try to clear the confusion here, but perhaps...

OK, I will not mention svnimport in the next patch.

> 	... with the deprecated `git-svnimport`, which was used for
> 	one-way conversion from Subversion to git.
> 
> > @@ -520,6 +523,38 @@ have each person clone that repository with 'git clone':
> >  	git-svn rebase
> >  ------------------------------------------------------------------------
> >  
> > +CONVERTING A SUBVERSION REPOSITORY TO A GIT REPOSITORY
> > +------------------------------------------------------
> > +
> > +When converting a Subversion repository to a Git repository
> > +--no-metadata removes "git-svn-id:" comments from the log.
> > +-A option is used to convert SVN pseudonyms to real names
> 
> Anything that user usually would type on the command line it is preferred
> to typeset with `quoted like this`, so "`--no-metadata`" and "`-A` option".
> 
> It is not `--no-metadata` "removes".  git-svn adds cruft because it wants
> to use it for bidi operation, but --no-metadata prevents it from doing
> so.

OK

-- 
Heikki Orsila
heikki.orsila@iki.fi
http://www.iki.fi/shd

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

end of thread, other threads:[~2008-06-18  0:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-14 18:03 [PATCH] Add SVN->Git conversion example to documentation Heikki Orsila
2008-06-15 13:17 ` Karl Hasselström
  -- strict thread matches above, loose matches on Subject: below --
2008-06-14 18:09 Heikki Orsila
2008-06-14 19:06 ` Miklos Vajna
2008-06-14 21:50   ` Heikki Orsila
2008-06-14 21:58 Heikki Orsila
2008-06-14 22:47 ` Miklos Vajna
2008-06-17 23:21 ` Junio C Hamano
2008-06-18  0:55   ` Heikki Orsila

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