{"thread":{"id":"19995","subject":"CVS <--> GIT workflow...","startedAt":"2009-07-01T18:32:33Z","lastAt":"2009-07-02T12:01:27Z","messageCount":6,"participants":["David Chanters","John Tapsell","Jakub Narebski","Nick Woolley"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"117310","messageId":"ac3d41850907011132q8e19b37ofa10813258a97555@mail.gmail.com","threadId":"19995","inReplyTo":null,"subject":"CVS <--> GIT workflow...","fromName":"David Chanters","fromEmail":"david.chanters@googlemail.com","sentAt":"2009-07-01T18:32:33Z","receivedAt":"2009-07-01T18:32:33Z","isPatch":false,"sender":{"key":"david.chanters@googlemail.com","avatar":null},"body":"Hi all,\n\n[ Please Cc me, as I am not subscribed to the list. ]\n\nI am wondering if there's any best practises/howtos on using CVS and\nGit together.  I have a project which is currently residing in CVS;\npeople actively use it to add changes, etc.  Which is fine -- and for\na variety of reasons we're unable to simply switch away from using CVS\nto Git.\n\nSo... the question is, can I use Git locally to manage all my work in\n-- create topic branches, merge them, etc., and then commit that back\nout to the CVS repository?   Likewise, I would need to keep my Git\nrepository in synch with any changes to the CVS repository -- is that\npossible?  Has anyone else done something like this?  What I am\neffectively wanting to do is Git for my entire development on this\nproject and just forget it even uses CVS.\n\nI've read up on git-cvsimport which seems to explain how to convert a\ncurrent CVS repo over to Git -- is that right?  Any information you\ncan point me to would be very welcome.  I am not adverse to reading,\nproviding it's useful to me.  :)\n\nThanks, in advance,\n\nDavid\n"},{"id":"117313","messageId":"43d8ce650907011224l52910844wb13df2ab1d87dea5@mail.gmail.com","threadId":"19995","inReplyTo":"ac3d41850907011132q8e19b37ofa10813258a97555@mail.gmail.com","subject":"Re: CVS <--> GIT workflow...","fromName":"John Tapsell","fromEmail":"johnflux@gmail.com","sentAt":"2009-07-01T19:24:30Z","receivedAt":"2009-07-01T19:24:30Z","isPatch":false,"sender":{"key":"johnflux@gmail.com","avatar":"https://gravatar.com/avatar/25f70d4c0f96396b84a2e34bcd9bdc233462c7b4be29b5fdca8266fc53f30b0c?d=mp&s=160"},"body":"2009/7/1 David Chanters <david.chanters@googlemail.com>:\n> Hi all,\n> for\n> a variety of reasons we're unable to simply switch away from using CVS\n> to Git.\n\nPerhaps you could switch from CVS to SVN?  SVN improves on CVS but\nbehaves in a very similar way.  Then you can use the mature git-svn\ntool.\n\nJOhn\n"},{"id":"117314","messageId":"ac3d41850907011229w34e9260akde8cad5f4ce0749b@mail.gmail.com","threadId":"19995","inReplyTo":"43d8ce650907011224l52910844wb13df2ab1d87dea5@mail.gmail.com","subject":"Re: CVS <--> GIT workflow...","fromName":"David Chanters","fromEmail":"david.chanters@googlemail.com","sentAt":"2009-07-01T19:29:02Z","receivedAt":"2009-07-01T19:29:02Z","isPatch":false,"sender":{"key":"david.chanters@googlemail.com","avatar":null},"body":"2009/7/1 John Tapsell <johnflux@gmail.com>:\n> 2009/7/1 David Chanters <david.chanters@googlemail.com>:\n>> Hi all,\n>> for\n>> a variety of reasons we're unable to simply switch away from using CVS\n>> to Git.\n>\n> Perhaps you could switch from CVS to SVN?  SVN improves on CVS but\n> behaves in a very similar way.  Then you can use the mature git-svn\n> tool.\n\nI wish, but this isn't feasible.  I'd rather not have to go into\ndetails as to why, but suffice it to say, I am stuck with CVS for now\n-- changing to anything else, even SVN, is not an option, alas.\n\nDavid\n"},{"id":"117315","messageId":"m3d48kw4uz.fsf@localhost.localdomain","threadId":"19995","inReplyTo":"ac3d41850907011132q8e19b37ofa10813258a97555@mail.gmail.com","subject":"Re: CVS <--> GIT workflow...","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-07-01T20:00:39Z","receivedAt":"2009-07-01T20:00:39Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"David Chanters <david.chanters@googlemail.com> writes:\n\n> I am wondering if there's any best practises/howtos on using CVS and\n> Git together.  I have a project which is currently residing in CVS;\n> people actively use it to add changes, etc.  Which is fine -- and for\n> a variety of reasons we're unable to simply switch away from using CVS\n> to Git.\n> \n> So... the question is, can I use Git locally to manage all my work in\n> -- create topic branches, merge them, etc., and then commit that back\n> out to the CVS repository?   Likewise, I would need to keep my Git\n> repository in synch with any changes to the CVS repository -- is that\n> possible?  Has anyone else done something like this?  What I am\n> effectively wanting to do is Git for my entire development on this\n> project and just forget it even uses CVS.\n> \n> I've read up on git-cvsimport which seems to explain how to convert a\n> current CVS repo over to Git -- is that right?  Any information you\n> can point me to would be very welcome.  I am not adverse to reading,\n> providing it's useful to me.  :)\n\nI think from all CVS importers (git-cvsimport, parsecvs, git mode of\ncvs2svn aka. cvs2git) only git-cvsimport has incremental mode.\n\nAs for exporting to CVS there is git-cvsexportcommit and git-cvsserver\n(which functions like cvsserver, but conects to git repository;\nalthough it has its own limitations).\n\n\nBut you should really hope that your fellow CVS committers use good\npractice; because it is quite easy to create very messy CVS repository\n(so that for example it would be hard to extract changesets).\n\nHTH\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"117320","messageId":"ac3d41850907011425x966483awe1757e24417d9da4@mail.gmail.com","threadId":"19995","inReplyTo":"m3d48kw4uz.fsf@localhost.localdomain","subject":"Re: CVS <--> GIT workflow...","fromName":"David Chanters","fromEmail":"david.chanters@googlemail.com","sentAt":"2009-07-01T21:25:15Z","receivedAt":"2009-07-01T21:25:15Z","isPatch":false,"sender":{"key":"david.chanters@googlemail.com","avatar":null},"body":"2009/7/1 Jakub Narebski <jnareb@gmail.com>:\n> David Chanters <david.chanters@googlemail.com> writes:\n>\n>> I am wondering if there's any best practises/howtos on using CVS and\n>> Git together.  I have a project which is currently residing in CVS;\n>> people actively use it to add changes, etc.  Which is fine -- and for\n>> a variety of reasons we're unable to simply switch away from using CVS\n>> to Git.\n>>\n>> So... the question is, can I use Git locally to manage all my work in\n>> -- create topic branches, merge them, etc., and then commit that back\n>> out to the CVS repository?   Likewise, I would need to keep my Git\n>> repository in synch with any changes to the CVS repository -- is that\n>> possible?  Has anyone else done something like this?  What I am\n>> effectively wanting to do is Git for my entire development on this\n>> project and just forget it even uses CVS.\n>>\n>> I've read up on git-cvsimport which seems to explain how to convert a\n>> current CVS repo over to Git -- is that right?  Any information you\n>> can point me to would be very welcome.  I am not adverse to reading,\n>> providing it's useful to me.  :)\n>\n> I think from all CVS importers (git-cvsimport, parsecvs, git mode of\n> cvs2svn aka. cvs2git) only git-cvsimport has incremental mode.\n\nExcellent.   So git-cvsimport it is then.  That's stage 1.\n\n> As for exporting to CVS there is git-cvsexportcommit and git-cvsserver\n> (which functions like cvsserver, but conects to git repository;\n> although it has its own limitations).\n\nI wouldn't need connectivity like what git-cvsserver seems to imply.\ngit-cvsexportcommit sounds about right.\n\n> But you should really hope that your fellow CVS committers use good\n> practice; because it is quite easy to create very messy CVS repository\n> (so that for example it would be hard to extract changesets).\n\nThey do -- which is about the only guaranteed thing.\n\nSo what would I do?  Something like this:\n\n1.  Use git-cvsimport to \"convert\" a snapshot of the current CVS\nproject to something Git can understand.\n2.  Checkout this git project via git clone in the usual way.\n3,  Hack away in this Git clone.\n4.  Use git-cvsexportcommit to extract commits?\n\nWhat about my workflow within the Git repository?  I assume that\n\"Master\" would be the branch I would want to merge *to* if I have\nlocal topic brances I wish to have in to CVS, and then the commits on\nMaster would be something git-cvsexportcommit would look at?\n\nIndeed, it seems git-cvsexportcommit is somewhat \"manual\" -- is there\nno way of automating that to say something like:  \"Take all commits on\nbranch $FOO in Git, which aren't in CVS, and apply them?\"   I might be\nmissing some understanding here.\n\nAny advice greatly received.  :)\n\nDavid\n"},{"id":"117358","messageId":"4A4CA197.5050202@yahoo.co.uk","threadId":"19995","inReplyTo":"ac3d41850907011425x966483awe1757e24417d9da4@mail.gmail.com","subject":"Re: CVS <--> GIT workflow...","fromName":"Nick Woolley","fromEmail":"nickwoolley@yahoo.co.uk","sentAt":"2009-07-02T12:01:27Z","receivedAt":"2009-07-02T12:01:27Z","isPatch":false,"sender":{"key":"nick@noodlefactory.co.uk","avatar":null},"body":"Hi,\n\nDavid Chanters wrote:\n> So what would I do?  Something like this:\n> \n> 1.  Use git-cvsimport to \"convert\" a snapshot of the current CVS\n> project to something Git can understand.\n> 2.  Checkout this git project via git clone in the usual way.\n> 3,  Hack away in this Git clone.\n> 4.  Use git-cvsexportcommit to extract commits?\n> \n\nI don't think step 2 is needed, since git-cvsimport imports into a local .git\nrepository that you can work with directly.  A read-only copy of all the\nimported CVS commits go into the git repository, within a \"remote\" whose name\nyou need to specify with git-cvsimport's -r parameter.  I normally use \"-r cvs\n-o cvshead\", which will import CVS's HEAD onto remotes/cvs/cvshead and BRANCHX\nonto remotes/cvs/BRANCHX.\n\n> What about my workflow within the Git repository?  I assume that\n> \"Master\" would be the branch I would want to merge *to* if I have\n> local topic brances I wish to have in to CVS, and then the commits on\n> Master would be something git-cvsexportcommit would look at?\n>\n> Indeed, it seems git-cvsexportcommit is somewhat \"manual\" -- is there\n> no way of automating that to say something like:  \"Take all commits on\n> branch $FOO in Git, which aren't in CVS, and apply them?\"   I might be\n> missing some understanding here.\n\nYes, git-cvsexportcommit has to be told explicitly which commits to export.  It\nwill only check that they seem to be sane, in that they will apply cleanly.\n\nCurrently I presume everyone has to roll their own solution to this.  In my\ncase, with the absence of any available prior art, I wrote a wrapper script, in\nan attempt to simplify the process to 'git-cvs push' and 'git-cvs pull'.  See my\nearlier post to this list:\n\n http://article.gmane.org/gmane.comp.version-control.git/120351\n\nThis works for me for basic day-to-day interaction with my CVS repository, which\nhas over a year's work in it, although there are times when I still need to\nmanually intervene.\n\nIf you do try it I'd be interested hear how  well it works, especially if it\nmeans I can improve it. Currently it doesn't have a lot of documentation besides\nwhat's in the script itself,  but if I could be encouraged to write more if\nasked nicely.\n\n\n\nNote, you probably also want a step 5 before cycling back to step 3: use\ngit-cvsimport to incrementally import your exported commits back into git.  If\nthis succeeds, git-cvsimport will also merge the remote CVS branch with your\nlocal one - like this, where c' and d' are the re-imported copies of commits c\nand d which come via CVS:\n\n a-b----c'-d'    <- e.g. remotes/cvs/cvshead\n    \\       \\\n     c-d-----e-  <- e.g. master\n\nI find that merge loops in the history like this make it hard to get the list of\nexports to commit next time.\n\ni.e. After adding some more commits to master:\n\n a-b----c'-d'      <- remotes/cvs/cvshead\n    \\       \\\n     c-d-----e-f-g <- master\n\nThen you want to commit f and g.  But:\n\n  git rev-list master..remotes/cvs/cvshead\n\nWill return c, d, e, f, g.  So instead I typically add this to step 5:\n\n  git reset --hard remotes/cvs/cvshead\n\nWhich discards c, d and e, leaving:\n\n a-b-c'-d'      <- remotes/cvs/cvshead and master\n\nThen you have a clean linear history and future commits to export.  My script\ndoesn't do this for you, currently, since in the case where there have been\nmultiple branches merged in before commit e, you might prune away those branches\nas well as the duplicate commits on the working branch (i.e. c and d).\n\n(I've just been avoiding this situation rather than fixing it, partly because\nI'd not found a better way yet, despite fiddling with various invocations of\ngit-rebase. So I'd be particularly interested if anyone can suggest one.)\n\nIn theory c' and d' should be identical to c and d - although if you haven't set\nup an author map for git-cvsimport, you may find that your commits come back\nwith the username you use in CVS, which may differ from that in git.\n\nIn this case, you need to have supplied the -A parameter to git-cvsimport in step 1.\n\n\n\nFinally, whatever you use, you'll probably want the latest release of git, since\nit has a bug fix for git-cvsexportcommit.  See:\n\n  http://article.gmane.org/gmane.comp.version-control.git/120241\n\n\nCheers,\n\nN\n"}]}