Re: Efficient way to import snapshots?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mon, 30 Jul 2007, Craig Boston wrote:
> 
> So far the main snag I've found is that AFAIK there's no equivalent to
> "svk import" to load a big tree (~37000 files) into a branch and commit
> the changes.  Here's the procedure I've come up with:
> 
> cd /path/to/git/repo
> git checkout vendor_branch_X
> git rm -r .
> cp -R /path/to/cvs/checkout_X/* ./
> git add .
> git commit -m"Import yyyymmdd snapshot"

Ouch.

What you want to do should fit git very well, but doing it that way is 
quite expensive.

Might I suggest just doing the .git thing *directly* in the CVS checkout 
instead?

It should literally be as easy as doing something like

	cd /path/to/cvs/checkout_X
	export GIT_DIR=/path/to/git/repo
	git add .
	git commit -m"Import yyyymmdd snapshot"

and you never copy anything around, and git will just notice on its own 
what CVS has changed.

You'd have to make sure that you have the CVS directories ignored, of 
course, and if you don't want to change the CVS directory at all (which is 
a good idea!) you'd need to do that by using the "ignore" file in your 
GIT_DIR, and just having the CVS entry there, instead of adding a
".gitignore" file to the working tree and checking it in.

The first time you do this it will be expensive, since it will re-compute 
all the SHA1's in the .git/index file, but afterwards, it will be able to 
use the index file to speed up operation, which is what is going to make 
this all *much* cheaper than removing the old files and copying all the 
files around anew.

(You can just force the re-indexing by doing a "git status" once, ie do

	cd /path/to/cvs/checkout_X
	export GIT_DIR=/path/to/git/repo
	git status

which will do it for you, and now all the subsequent snapshot generation 
should be trivial and very fast).

The above is totally untested, of course, but I think that's the easiest 
way to do things like this. In general, it should be *trivial* to do 
snapshots with git using just about _any_ legacy SCM, exactly because you 
can keep the whole git setup away from the legacy SCM directories with 
that "GIT_DIR=.." thing. 

(Of course, you could just move the .git directory into the CVS checkout 
too - and then CVS will just ignore it. But it may be a good idea to just 
keep them explicitly separate).

			Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux