* Converting from svn to git @ 2008-08-10 13:11 David Neu 2008-08-10 13:24 ` Miklos Vajna 0 siblings, 1 reply; 8+ messages in thread From: David Neu @ 2008-08-10 13:11 UTC (permalink / raw) To: git Hi, I'm trying to move an svn repo to git. I'm not going to be committing back to the svn repo, but will simply retire it and use git. The issue I'm having is that the svn repo has sub directories that I'd like to be separate git repos. I can easily accomplish this for the sub directories like this: git-svn clone svn-url/subdir1 git-svn clone svn-url/subdir2 etc. but for the files in the base directory git-svn clone svn-url pulls the entire directory tree. Is there a git-svn strategy similar to git-svnimport -P that would do the trick? My git version 1.5.6.4 doesn't include git-svnimport, and I'm getting the impression it's be deprecated. Many thanks for any help! Cheers, David ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Converting from svn to git 2008-08-10 13:11 Converting from svn to git David Neu @ 2008-08-10 13:24 ` Miklos Vajna 2008-08-10 14:54 ` David Neu 0 siblings, 1 reply; 8+ messages in thread From: Miklos Vajna @ 2008-08-10 13:24 UTC (permalink / raw) To: David Neu; +Cc: git [-- Attachment #1: Type: text/plain, Size: 563 bytes --] On Sun, Aug 10, 2008 at 09:11:43AM -0400, David Neu <david@davidneu.com> wrote: > Is there a git-svn strategy similar to git-svnimport -P that would do the trick? > My git version 1.5.6.4 doesn't include git-svnimport, and I'm getting > the impression > it's be deprecated. Sure, it is. Though if you _really_ need it, it's still under /contrib/examples. Anyway, if you do a single conversion, then probably speed does not matter a lot; I would do a full import then use the subdirectory-filter of git filter-branch do drop everything outside the subdirectory. [-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Converting from svn to git 2008-08-10 13:24 ` Miklos Vajna @ 2008-08-10 14:54 ` David Neu 2008-08-10 15:32 ` Michael J Gruber 0 siblings, 1 reply; 8+ messages in thread From: David Neu @ 2008-08-10 14:54 UTC (permalink / raw) To: Miklos Vajna; +Cc: git Thanks for the reply - this looks like what I'd need, but I can't see how to keep the contents of the base dir and lose the subdirs, e.g. $ git-filter-branch --subdirectory-filter . HEAD removes all subdirs and the contents of the base dir. So, I figure I'd remove each subdir, using $ git-filter-branch --tree-filter 'rm -rf subdir1/' HEAD but this complains if subdir1 contains subdirectories, it says: Namespace refs/original/ not empty Many thanks! Cheers, David On Sun, Aug 10, 2008 at 9:24 AM, Miklos Vajna <vmiklos@frugalware.org> wrote: > > On Sun, Aug 10, 2008 at 09:11:43AM -0400, David Neu <david@davidneu.com> wrote: > > Is there a git-svn strategy similar to git-svnimport -P that would do the trick? > > My git version 1.5.6.4 doesn't include git-svnimport, and I'm getting > > the impression > > it's be deprecated. > > Sure, it is. Though if you _really_ need it, it's still under > /contrib/examples. > > Anyway, if you do a single conversion, then probably speed does not > matter a lot; I would do a full import then use the subdirectory-filter > of git filter-branch do drop everything outside the subdirectory. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Converting from svn to git 2008-08-10 14:54 ` David Neu @ 2008-08-10 15:32 ` Michael J Gruber 2008-08-10 15:48 ` David Neu 0 siblings, 1 reply; 8+ messages in thread From: Michael J Gruber @ 2008-08-10 15:32 UTC (permalink / raw) To: git David Neu venit, vidit, dixit 10.08.2008 16:54: > Thanks for the reply - this looks like what I'd need, but > I can't see how to keep the contents of the base dir and > lose the subdirs, e.g. > > $ git-filter-branch --subdirectory-filter . HEAD > > removes all subdirs and the contents of the base dir. > > So, I figure I'd remove each subdir, using > > $ git-filter-branch --tree-filter 'rm -rf subdir1/' HEAD > > but this complains if subdir1 contains subdirectories, it > says: Namespace refs/original/ not empty It complains because filter-branch stores the original refs in that namespace, and on the second filter-branch run it wants to do this again. You can avoid this by using the "-f" option to filter-branch, or by removing all subsirs in one go ("rm -rf subdir1 subdir2..."). Also, you might want to rewrite all refs ("--all"), not just HEAD. Michael ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Converting from svn to git 2008-08-10 15:32 ` Michael J Gruber @ 2008-08-10 15:48 ` David Neu 2008-08-11 17:46 ` David Neu 0 siblings, 1 reply; 8+ messages in thread From: David Neu @ 2008-08-10 15:48 UTC (permalink / raw) To: Michael J Gruber; +Cc: git That's great - thanks to everyone! On Sun, Aug 10, 2008 at 11:32 AM, Michael J Gruber <michaeljgruber+gmane@fastmail.fm> wrote: > David Neu venit, vidit, dixit 10.08.2008 16:54: >> >> Thanks for the reply - this looks like what I'd need, but >> I can't see how to keep the contents of the base dir and >> lose the subdirs, e.g. >> >> $ git-filter-branch --subdirectory-filter . HEAD >> >> removes all subdirs and the contents of the base dir. >> >> So, I figure I'd remove each subdir, using >> >> $ git-filter-branch --tree-filter 'rm -rf subdir1/' HEAD >> >> but this complains if subdir1 contains subdirectories, it >> says: Namespace refs/original/ not empty > > It complains because filter-branch stores the original refs in that > namespace, and on the second filter-branch run it wants to do this again. > You can avoid this by using the "-f" option to filter-branch, or by removing > all subsirs in one go ("rm -rf subdir1 subdir2..."). Also, you might want to > rewrite all refs ("--all"), not just HEAD. > > Michael > > -- > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Converting from svn to git 2008-08-10 15:48 ` David Neu @ 2008-08-11 17:46 ` David Neu 2008-08-15 13:58 ` Michael J Gruber 0 siblings, 1 reply; 8+ messages in thread From: David Neu @ 2008-08-11 17:46 UTC (permalink / raw) To: Michael J Gruber; +Cc: git OK, I did $ git-filter-branch --tree-filter 'rm -rf subdir1/ subdir2/ subdir3/' -- --all which looks good, except when I open gitk, I still see "empty" commits that correspond to subdir1/, subdir2/ and subdir3/. Is there anyway to remove those? Many thanks! Cheers, David On Sun, Aug 10, 2008 at 11:48 AM, David Neu <david@davidneu.com> wrote: > That's great - thanks to everyone! > > On Sun, Aug 10, 2008 at 11:32 AM, Michael J Gruber > <michaeljgruber+gmane@fastmail.fm> wrote: >> David Neu venit, vidit, dixit 10.08.2008 16:54: >>> >>> Thanks for the reply - this looks like what I'd need, but >>> I can't see how to keep the contents of the base dir and >>> lose the subdirs, e.g. >>> >>> $ git-filter-branch --subdirectory-filter . HEAD >>> >>> removes all subdirs and the contents of the base dir. >>> >>> So, I figure I'd remove each subdir, using >>> >>> $ git-filter-branch --tree-filter 'rm -rf subdir1/' HEAD >>> >>> but this complains if subdir1 contains subdirectories, it >>> says: Namespace refs/original/ not empty >> >> It complains because filter-branch stores the original refs in that >> namespace, and on the second filter-branch run it wants to do this again. >> You can avoid this by using the "-f" option to filter-branch, or by removing >> all subsirs in one go ("rm -rf subdir1 subdir2..."). Also, you might want to >> rewrite all refs ("--all"), not just HEAD. >> >> Michael >> >> -- >> To unsubscribe from this list: send the line "unsubscribe git" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html >> > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Converting from svn to git 2008-08-11 17:46 ` David Neu @ 2008-08-15 13:58 ` Michael J Gruber 2008-08-17 9:11 ` Sam Vilain 0 siblings, 1 reply; 8+ messages in thread From: Michael J Gruber @ 2008-08-15 13:58 UTC (permalink / raw) To: git David Neu venit, vidit, dixit 11.08.2008 19:46: > OK, I did > > $ git-filter-branch --tree-filter 'rm -rf subdir1/ subdir2/ subdir3/' -- --all > > which looks good, except when I open gitk, I still see "empty" commits > that correspond to subdir1/, subdir2/ and subdir3/. > > Is there anyway to remove those? A while ago I "complained" that rebase would skip empty commits. You might experiment with that. Alternatively, the following works for me: git filter-branch --commit-filter 'cmd="git commit-tree"; test `git show --pretty=oneline $GIT_COMMIT|wc -l` = 1 && cmd="skip_commit"; $cmd "$@"' -- --all This skips all commits which introduce no diff. It will not remove branches or tags which are related only to those subdirs. I am sure there will be more elegant ways to do that (esp. the test with wc). Michael ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Converting from svn to git 2008-08-15 13:58 ` Michael J Gruber @ 2008-08-17 9:11 ` Sam Vilain 0 siblings, 0 replies; 8+ messages in thread From: Sam Vilain @ 2008-08-17 9:11 UTC (permalink / raw) To: Michael J Gruber; +Cc: git On Fri, 2008-08-15 at 15:58 +0200, Michael J Gruber wrote: > A while ago I "complained" that rebase would skip empty commits. You > might experiment with that. Alternatively, the following works for me: > > git filter-branch --commit-filter 'cmd="git commit-tree"; test `git show > --pretty=oneline $GIT_COMMIT|wc -l` = 1 && cmd="skip_commit"; $cmd "$@"' > -- --all > > This skips all commits which introduce no diff. It will not remove > branches or tags which are related only to those subdirs. > > I am sure there will be more elegant ways to do that (esp. the test with > wc). something like this should work: --commit-filter 'if [ "$1" = `git rev-parse HEAD^{tree}` ]; then skip_commit "$@"; else git commit-tree "$@"; fi' Sam. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-08-17 9:13 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-08-10 13:11 Converting from svn to git David Neu 2008-08-10 13:24 ` Miklos Vajna 2008-08-10 14:54 ` David Neu 2008-08-10 15:32 ` Michael J Gruber 2008-08-10 15:48 ` David Neu 2008-08-11 17:46 ` David Neu 2008-08-15 13:58 ` Michael J Gruber 2008-08-17 9:11 ` Sam Vilain
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).