git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* (unknown), 
@ 2007-10-13  4:01 Michael Witten
  2007-10-13  4:07 ` your mail Jeff King
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Witten @ 2007-10-13  4:01 UTC (permalink / raw)
  To: git; +Cc: Jeff King

I apologize if this is received twice.
I did add some comments, though!



On 12 Oct 2007, at 10:49:10 PM, Jeff King wrote:
> You are presumably doing a 'git-pull' on the cvsimport-ed commits. Try
> doing a git-rebase, which will filter out commits which make the same
> changes. Yes, it means throwing away your original commits, but the  
> new
> ones should be morally equivalent (and are now the "official" upstream
> of the CVS repository).

Now that you mention it, I think the best approach would be to:
	
	(1) cvsexportcommit
	(2) git reset --hard LAST_CVS_IMPORT_AND_MERGE
	(3) git cvsimport ..... # and merge

I think this is what you mean; it seems to me that rebasing isn't  
quite that.

However, this will not preserve more complicated history such as merges
from another git repository.

Basically, I want to treat my git repository as the official  
repository; the CVS
repo is just their for the old farts to get the latest stuff ;-P

Thanks!

Michael

PS
Please send me other opinions.

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Imports without Tariffs
@ 2007-10-12 20:36 mfwitten
  2007-10-13  2:49 ` Jeff King
       [not found] ` <3B7796D6-5901-40B0-B3FC-70642AC50B08@mit.edu>
  0 siblings, 2 replies; 10+ messages in thread
From: mfwitten @ 2007-10-12 20:36 UTC (permalink / raw)
  To: git

[INTRO]

	Hello,
	
	I have come across a problem that could be easily addressed
	in order to improve interoperability between CVS and git.
	
	
	I'm new to using git (and a novice with SCMs in general),
	and I really enjoy the way that git allows me to think.
	
	Unfortunately, I am forced to deal with CVS (for one of
	my classes), but I have been courageously trying to use
	git behind the scenes, as I can already tell CVS is a
	nightmare.
	

[SCENARIO]
	
	I would like to do the following sequence:
		
		(1) Checkout a CVS repository as a git working tree.
				
			=> git cvsimport -A /path -a -k -v -r cvs -C work module
			
		(2) Edit the git working tree and make commits there.
				
			=> cd work
			=> vim ... # emacs can go live with CVS ;-P
			=> git commit -a -m ...
				
		(3) Export my git working tree commits back to CVS.
			
			=> cd ..; cvs co modules; cd modules
			
			=> for each pertinent git commit hash, HASH:
				GIT_DIR=../work/.git git-cvsexportcommit -vc HASH
				
		(4) Update my git working tree from CVS (at some later time).
			
			=> cd ../work
			=> git cvsimport -a -k -v -r cvs -C . module
		
[PROBLEM]
	
	git-cvsimport creates new hash IDs for the same ol' commits.
	
	
	Running git-cvsimport does indeed do an incremental update of
	the 'cvs' remote in the 'work' git repository.
	
	However, the updates are brought in as brand new git commits
	with the CVS dates in the log (though changed to UTC +0000!!).
	
	Therefore, when the updated 'cvs' remote branches are merged into
	my local branches, git treats the commits I made with cvsexportcommit
	as separate history; thus, history is duplicated and merge commits
	appear where they shouldn't.

[PARTIAL SOLUTION]
	
	The trick is to populate the 'cvs' remote branches with commits that
	have the right hash IDs.
	
	I thought I could do this by hand.
	
	I updated the cvsexportcommit/cvsimport sequence by pushing
	my local branches into their respective 'cvs' remote branches,
	before running that last cvsimport:
		
		=> for each pertinent git commit hash, HASH:
			GIT_DIR=../work/.git git-cvsexportcommit -vc HASH
		
		=>=>=> git push . refs/heads/master:refs/remotes/cvs/master
		
		=> git cvsimport -a -k -v -r cvs -C . module
	
	Of course, git-cvsimport still adds the commits to the 'cvs'
	remote branches, duplicating (log) histories.
	
	The difference is that the 'cvs' remote branches become descendants
	of the local branches, causing a fast-forward merge with the local
	branches; this removes the split histories, but still duplicates
	information in an even dumber way, as changes are undone and then
	redone.

[SOLUTION]
	
	The trick is to make both git-cvsimport and the user smarter
		---- A TALL ORDER!
	
	
	To make things simple, I think all of the necessary machinery
	should be put into git-cvsimport.
	
	The user should first git-cvsexportcommit as necessary.
	
	Then the user should tell git-cvsimport to push from the pertinent git
	branches into the pertinent cvsimport branch. To make things even  
simpler,
	I think that git-cvsimport should make the -r option mandatory; then
	git-cvsimport would simply do the pushing as I did:
		
		git push . refs/heads/<branch1>:refs/remotes/<remote>/<branch2>
	
	Then git-cvsimport would mark for each pushed-into branch the timestamp
	for when the push occurred. These marks could be put in some special  
file,
	say .git/CVSIMPORT.
	
	The next time git-cvsimport is used as normal, it can consult this  
file for
	timestamps, rather than relying on git log timestamps, to determine  
if creat-
	ing a new commit is necessary.

[CONCLUSION]
	
	I feel that not much is being put into converting between git and  
CVS, which
	is unfortunate, because a lot of stuff is in CVS out there; here at  
MIT,
	*all* CS students have to use CVS for at least one semester of  
grueling programming
	labs.
	
	If conversion between git and CVS is hard, many students will just  
learn
	what seems easiest---CVS---and they'll decide to use CVS for their  
projects
	later on (I've already seen this happen); that's not a future I want  
to have!
	
	Sincerely,
	Michael Witten
	
[OTHER PROBLEMS]
	
	(1) git-cvsimport creates log entries with UTC times; maybe that's  
correct.
	(2) git-cvsimport's -A argument must be a full path.
	(3) git-cvsexportcommit should automatically handle contiguous commits.
	(4) git-cvsimport is written in the most unmaintainable perl ever!

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

end of thread, other threads:[~2007-10-14 22:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-13  4:01 (unknown), Michael Witten
2007-10-13  4:07 ` your mail Jeff King
     [not found]   ` <1240801C-F4CC-4290-8C3D-2038F1957DF3@MIT.EDU>
2007-10-13  4:39     ` Imports without Tariffs Michael Witten
2007-10-13  7:57     ` Jeff King
2007-10-13 23:04       ` Michael Witten
2007-10-14 16:40         ` Jeff King
2007-10-14 22:10           ` Michael Witten
  -- strict thread matches above, loose matches on Subject: below --
2007-10-12 20:36 mfwitten
2007-10-13  2:49 ` Jeff King
     [not found] ` <3B7796D6-5901-40B0-B3FC-70642AC50B08@mit.edu>
2007-10-13  4:44   ` Michael Witten

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