* CVS <--> GIT workflow... @ 2009-07-01 18:32 David Chanters 2009-07-01 19:24 ` John Tapsell 2009-07-01 20:00 ` Jakub Narebski 0 siblings, 2 replies; 6+ messages in thread From: David Chanters @ 2009-07-01 18:32 UTC (permalink / raw) To: git; +Cc: David Chanters Hi all, [ Please Cc me, as I am not subscribed to the list. ] I am wondering if there's any best practises/howtos on using CVS and Git together. I have a project which is currently residing in CVS; people actively use it to add changes, etc. Which is fine -- and for a variety of reasons we're unable to simply switch away from using CVS to Git. So... the question is, can I use Git locally to manage all my work in -- create topic branches, merge them, etc., and then commit that back out to the CVS repository? Likewise, I would need to keep my Git repository in synch with any changes to the CVS repository -- is that possible? Has anyone else done something like this? What I am effectively wanting to do is Git for my entire development on this project and just forget it even uses CVS. I've read up on git-cvsimport which seems to explain how to convert a current CVS repo over to Git -- is that right? Any information you can point me to would be very welcome. I am not adverse to reading, providing it's useful to me. :) Thanks, in advance, David ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: CVS <--> GIT workflow... 2009-07-01 18:32 CVS <--> GIT workflow David Chanters @ 2009-07-01 19:24 ` John Tapsell 2009-07-01 19:29 ` David Chanters 2009-07-01 20:00 ` Jakub Narebski 1 sibling, 1 reply; 6+ messages in thread From: John Tapsell @ 2009-07-01 19:24 UTC (permalink / raw) To: David Chanters; +Cc: git 2009/7/1 David Chanters <david.chanters@googlemail.com>: > Hi all, > for > a variety of reasons we're unable to simply switch away from using CVS > to Git. Perhaps you could switch from CVS to SVN? SVN improves on CVS but behaves in a very similar way. Then you can use the mature git-svn tool. JOhn ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: CVS <--> GIT workflow... 2009-07-01 19:24 ` John Tapsell @ 2009-07-01 19:29 ` David Chanters 0 siblings, 0 replies; 6+ messages in thread From: David Chanters @ 2009-07-01 19:29 UTC (permalink / raw) To: John Tapsell; +Cc: git 2009/7/1 John Tapsell <johnflux@gmail.com>: > 2009/7/1 David Chanters <david.chanters@googlemail.com>: >> Hi all, >> for >> a variety of reasons we're unable to simply switch away from using CVS >> to Git. > > Perhaps you could switch from CVS to SVN? SVN improves on CVS but > behaves in a very similar way. Then you can use the mature git-svn > tool. I wish, but this isn't feasible. I'd rather not have to go into details as to why, but suffice it to say, I am stuck with CVS for now -- changing to anything else, even SVN, is not an option, alas. David ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: CVS <--> GIT workflow... 2009-07-01 18:32 CVS <--> GIT workflow David Chanters 2009-07-01 19:24 ` John Tapsell @ 2009-07-01 20:00 ` Jakub Narebski 2009-07-01 21:25 ` David Chanters 1 sibling, 1 reply; 6+ messages in thread From: Jakub Narebski @ 2009-07-01 20:00 UTC (permalink / raw) To: David Chanters; +Cc: git David Chanters <david.chanters@googlemail.com> writes: > I am wondering if there's any best practises/howtos on using CVS and > Git together. I have a project which is currently residing in CVS; > people actively use it to add changes, etc. Which is fine -- and for > a variety of reasons we're unable to simply switch away from using CVS > to Git. > > So... the question is, can I use Git locally to manage all my work in > -- create topic branches, merge them, etc., and then commit that back > out to the CVS repository? Likewise, I would need to keep my Git > repository in synch with any changes to the CVS repository -- is that > possible? Has anyone else done something like this? What I am > effectively wanting to do is Git for my entire development on this > project and just forget it even uses CVS. > > I've read up on git-cvsimport which seems to explain how to convert a > current CVS repo over to Git -- is that right? Any information you > can point me to would be very welcome. I am not adverse to reading, > providing it's useful to me. :) I think from all CVS importers (git-cvsimport, parsecvs, git mode of cvs2svn aka. cvs2git) only git-cvsimport has incremental mode. As for exporting to CVS there is git-cvsexportcommit and git-cvsserver (which functions like cvsserver, but conects to git repository; although it has its own limitations). But you should really hope that your fellow CVS committers use good practice; because it is quite easy to create very messy CVS repository (so that for example it would be hard to extract changesets). HTH -- Jakub Narebski Poland ShadeHawk on #git ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: CVS <--> GIT workflow... 2009-07-01 20:00 ` Jakub Narebski @ 2009-07-01 21:25 ` David Chanters 2009-07-02 12:01 ` Nick Woolley 0 siblings, 1 reply; 6+ messages in thread From: David Chanters @ 2009-07-01 21:25 UTC (permalink / raw) To: Jakub Narebski; +Cc: git 2009/7/1 Jakub Narebski <jnareb@gmail.com>: > David Chanters <david.chanters@googlemail.com> writes: > >> I am wondering if there's any best practises/howtos on using CVS and >> Git together. I have a project which is currently residing in CVS; >> people actively use it to add changes, etc. Which is fine -- and for >> a variety of reasons we're unable to simply switch away from using CVS >> to Git. >> >> So... the question is, can I use Git locally to manage all my work in >> -- create topic branches, merge them, etc., and then commit that back >> out to the CVS repository? Likewise, I would need to keep my Git >> repository in synch with any changes to the CVS repository -- is that >> possible? Has anyone else done something like this? What I am >> effectively wanting to do is Git for my entire development on this >> project and just forget it even uses CVS. >> >> I've read up on git-cvsimport which seems to explain how to convert a >> current CVS repo over to Git -- is that right? Any information you >> can point me to would be very welcome. I am not adverse to reading, >> providing it's useful to me. :) > > I think from all CVS importers (git-cvsimport, parsecvs, git mode of > cvs2svn aka. cvs2git) only git-cvsimport has incremental mode. Excellent. So git-cvsimport it is then. That's stage 1. > As for exporting to CVS there is git-cvsexportcommit and git-cvsserver > (which functions like cvsserver, but conects to git repository; > although it has its own limitations). I wouldn't need connectivity like what git-cvsserver seems to imply. git-cvsexportcommit sounds about right. > But you should really hope that your fellow CVS committers use good > practice; because it is quite easy to create very messy CVS repository > (so that for example it would be hard to extract changesets). They do -- which is about the only guaranteed thing. So what would I do? Something like this: 1. Use git-cvsimport to "convert" a snapshot of the current CVS project to something Git can understand. 2. Checkout this git project via git clone in the usual way. 3, Hack away in this Git clone. 4. Use git-cvsexportcommit to extract commits? What about my workflow within the Git repository? I assume that "Master" would be the branch I would want to merge *to* if I have local topic brances I wish to have in to CVS, and then the commits on Master would be something git-cvsexportcommit would look at? Indeed, it seems git-cvsexportcommit is somewhat "manual" -- is there no way of automating that to say something like: "Take all commits on branch $FOO in Git, which aren't in CVS, and apply them?" I might be missing some understanding here. Any advice greatly received. :) David ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: CVS <--> GIT workflow... 2009-07-01 21:25 ` David Chanters @ 2009-07-02 12:01 ` Nick Woolley 0 siblings, 0 replies; 6+ messages in thread From: Nick Woolley @ 2009-07-02 12:01 UTC (permalink / raw) To: David Chanters; +Cc: Jakub Narebski, git Hi, David Chanters wrote: > So what would I do? Something like this: > > 1. Use git-cvsimport to "convert" a snapshot of the current CVS > project to something Git can understand. > 2. Checkout this git project via git clone in the usual way. > 3, Hack away in this Git clone. > 4. Use git-cvsexportcommit to extract commits? > I don't think step 2 is needed, since git-cvsimport imports into a local .git repository that you can work with directly. A read-only copy of all the imported CVS commits go into the git repository, within a "remote" whose name you need to specify with git-cvsimport's -r parameter. I normally use "-r cvs -o cvshead", which will import CVS's HEAD onto remotes/cvs/cvshead and BRANCHX onto remotes/cvs/BRANCHX. > What about my workflow within the Git repository? I assume that > "Master" would be the branch I would want to merge *to* if I have > local topic brances I wish to have in to CVS, and then the commits on > Master would be something git-cvsexportcommit would look at? > > Indeed, it seems git-cvsexportcommit is somewhat "manual" -- is there > no way of automating that to say something like: "Take all commits on > branch $FOO in Git, which aren't in CVS, and apply them?" I might be > missing some understanding here. Yes, git-cvsexportcommit has to be told explicitly which commits to export. It will only check that they seem to be sane, in that they will apply cleanly. Currently I presume everyone has to roll their own solution to this. In my case, with the absence of any available prior art, I wrote a wrapper script, in an attempt to simplify the process to 'git-cvs push' and 'git-cvs pull'. See my earlier post to this list: http://article.gmane.org/gmane.comp.version-control.git/120351 This works for me for basic day-to-day interaction with my CVS repository, which has over a year's work in it, although there are times when I still need to manually intervene. If you do try it I'd be interested hear how well it works, especially if it means I can improve it. Currently it doesn't have a lot of documentation besides what's in the script itself, but if I could be encouraged to write more if asked nicely. Note, you probably also want a step 5 before cycling back to step 3: use git-cvsimport to incrementally import your exported commits back into git. If this succeeds, git-cvsimport will also merge the remote CVS branch with your local one - like this, where c' and d' are the re-imported copies of commits c and d which come via CVS: a-b----c'-d' <- e.g. remotes/cvs/cvshead \ \ c-d-----e- <- e.g. master I find that merge loops in the history like this make it hard to get the list of exports to commit next time. i.e. After adding some more commits to master: a-b----c'-d' <- remotes/cvs/cvshead \ \ c-d-----e-f-g <- master Then you want to commit f and g. But: git rev-list master..remotes/cvs/cvshead Will return c, d, e, f, g. So instead I typically add this to step 5: git reset --hard remotes/cvs/cvshead Which discards c, d and e, leaving: a-b-c'-d' <- remotes/cvs/cvshead and master Then you have a clean linear history and future commits to export. My script doesn't do this for you, currently, since in the case where there have been multiple branches merged in before commit e, you might prune away those branches as well as the duplicate commits on the working branch (i.e. c and d). (I've just been avoiding this situation rather than fixing it, partly because I'd not found a better way yet, despite fiddling with various invocations of git-rebase. So I'd be particularly interested if anyone can suggest one.) In theory c' and d' should be identical to c and d - although if you haven't set up an author map for git-cvsimport, you may find that your commits come back with the username you use in CVS, which may differ from that in git. In this case, you need to have supplied the -A parameter to git-cvsimport in step 1. Finally, whatever you use, you'll probably want the latest release of git, since it has a bug fix for git-cvsexportcommit. See: http://article.gmane.org/gmane.comp.version-control.git/120241 Cheers, N ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-07-02 12:01 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-07-01 18:32 CVS <--> GIT workflow David Chanters 2009-07-01 19:24 ` John Tapsell 2009-07-01 19:29 ` David Chanters 2009-07-01 20:00 ` Jakub Narebski 2009-07-01 21:25 ` David Chanters 2009-07-02 12:01 ` Nick Woolley
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).