{"thread":{"id":"17251","subject":"Syncing with CVS","startedAt":"2009-01-19T09:39:53Z","lastAt":"2009-01-19T22:05:36Z","messageCount":4,"participants":["Christian von Kietzell","Johan Herland","Boaz Harrosh","Robin Rosenberg"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"101118","messageId":"f31e50960901190139w65b69fd1k752973a23c40f384@mail.gmail.com","threadId":"17251","inReplyTo":null,"subject":"Syncing with CVS","fromName":"Christian von Kietzell","fromEmail":"cuboci@gmail.com","sentAt":"2009-01-19T09:39:53Z","receivedAt":"2009-01-19T09:39:53Z","isPatch":false,"sender":{"key":"cuboci@gmail.com","avatar":null},"body":"Hi,\n\nI have a project I started in git. After a while I exported that to\nCVS via git cvsexportcommit which worked quite nicely. Now, a\ncolleague made changes to the project - in CVS. What's the best way to\nget those back into my git repository so that I'll be able to sync\nback and forth between git and CVS? I had a quick look at the wiki but\ncouldn't find anything appropriate.\n\nI know of git cvsimport, of course, but that doesn't work on my\noriginal repository. Or does it? I didn't find anything on how to\nlimit what to import. After all, some of the commits are already in my\nrepository (the ones I exported).\n\nHope any of you can help. Thanks in advance.\n\n  Chris\n"},{"id":"101119","messageId":"200901191128.21230.johan@herland.net","threadId":"17251","inReplyTo":"f31e50960901190139w65b69fd1k752973a23c40f384@mail.gmail.com","subject":"Re: Syncing with CVS","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2009-01-19T10:28:21Z","receivedAt":"2009-01-19T10:28:21Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Monday 19 January 2009, Christian von Kietzell wrote:\n> Hi,\n>\n> I have a project I started in git. After a while I exported that to\n> CVS via git cvsexportcommit which worked quite nicely. Now, a\n> colleague made changes to the project - in CVS. What's the best way\n> to get those back into my git repository so that I'll be able to sync\n> back and forth between git and CVS? I had a quick look at the wiki\n> but couldn't find anything appropriate.\n>\n> I know of git cvsimport, of course, but that doesn't work on my\n> original repository. Or does it? I didn't find anything on how to\n> limit what to import. After all, some of the commits are already in\n> my repository (the ones I exported).\n>\n> Hope any of you can help. Thanks in advance.\n\nUnfortunately bidirectional syncing between CVS and Git is pretty much \nimpossible in the general case, because CVS's structure is so different \nfrom Git's. For one, it is very easy to (re)move tags and branches in \nCVS, with no record of where it was moved from. (Also, as anybody \ninvolved in proper CVS-to-Git converters (\"git cvsimport\" does _not_ \nfall into this category) will tell you, recreating history from CVS is \na highly non-trivial task in itself.) This means that even if you have \nimported some CVS state into Git, you cannot guarantee that the CVS \nstate has not changed the next time you try to import. Therefore, it is \nvery hard to determine whether you're importing a whole new branch from \nCVS, or whether you are just incrementally importing patches on top of \na previously imported branch.\n\nI have a similar situation at $dayjob, where we have a central CVS \nserver with the official version, and I use Git for working locally. In \nthis case, I use \"git cvsexportcommit\" to propagate my local changes to \nthe CVS server. I only use this approach on branches where nobody else \nis allowed to commit (of course CVS does not enforce this rule, so I \nhave to manually make sure that does not happen). If someone else were \nto commit to my branch in CVS, I would have to redo a full CVS-to-Git \nconversion, in order to get a new Git repo that is in sync with CVS. I \ncan then resume \"git cvsexportcommit\" to propagate my changes from Git \nto CVS.\n\n\nHave fun! :)\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"101120","messageId":"49745CE4.1000309@panasas.com","threadId":"17251","inReplyTo":"f31e50960901190139w65b69fd1k752973a23c40f384@mail.gmail.com","subject":"Re: Syncing with CVS","fromName":"Boaz Harrosh","fromEmail":"bharrosh@panasas.com","sentAt":"2009-01-19T10:58:44Z","receivedAt":"2009-01-19T10:58:44Z","isPatch":false,"sender":{"key":"bharrosh@panasas.com","avatar":"https://gravatar.com/avatar/347e426f8ca0409f6891ceeefd4c3c2d8769608382323057efeaa362b4c3dbf3?d=mp&s=160"},"body":"Christian von Kietzell wrote:\n> Hi,\n> \n> I have a project I started in git. After a while I exported that to\n> CVS via git cvsexportcommit which worked quite nicely. Now, a\n> colleague made changes to the project - in CVS. What's the best way to\n> get those back into my git repository so that I'll be able to sync\n> back and forth between git and CVS? I had a quick look at the wiki but\n> couldn't find anything appropriate.\n> \n> I know of git cvsimport, of course, but that doesn't work on my\n> original repository. Or does it? I didn't find anything on how to\n> limit what to import. After all, some of the commits are already in my\n> repository (the ones I exported).\n> \n> Hope any of you can help. Thanks in advance.\n> \n>   Chris\n\nI would \"git cvsimport\" into temporary new git.\nThen \"git remote add cvs_import that_temp_git\" into the main git\nThen find the point of the common base, do\n\"git tag CVS_GIT_BASE that_base_commit_uid\"\n\"git checkout -b cvs_import cvs_import/master\"\n\"git rebase --onto master CVS_GIT_BASE\"\n\nSo in fact I'm just cherry-picking the additions from CVS\nand reapplying on to original git tree. If you want it more\nautomatic you'll need to do the above in a script with some\nkind of naming conventions for your git tags and CVS's tags\nat points of sync.\n\nBoaz\n \n"},{"id":"101171","messageId":"200901192305.36577.robin.rosenberg.lists@dewire.com","threadId":"17251","inReplyTo":"f31e50960901190139w65b69fd1k752973a23c40f384@mail.gmail.com","subject":"Re: Syncing with CVS","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2009-01-19T22:05:36Z","receivedAt":"2009-01-19T22:05:36Z","isPatch":false,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"måndag 19 januari 2009 10:39:53 skrev Christian von Kietzell:\n> Hi,\n> \n> I have a project I started in git. After a while I exported that to\n> CVS via git cvsexportcommit which worked quite nicely. Now, a\n> colleague made changes to the project - in CVS. What's the best way to\n> get those back into my git repository so that I'll be able to sync\n> back and forth between git and CVS? I had a quick look at the wiki but\n> couldn't find anything appropriate.\n> \n> I know of git cvsimport, of course, but that doesn't work on my\n> original repository. Or does it? I didn't find anything on how to\n> limit what to import. After all, some of the commits are already in my\n> repository (the ones I exported).\nJust continue with cvsimport, then git rebase origin. That'll drop the\ncommits that you made when the same commit have been discovered\nin CVS.\n\nI personally do the cvs import into a separate repo using a cron job. That\nextra repo is my origin so I get up-to-date using git fetch and rebase just\nas if the CVS commits would come from a real repo.\n\n-- robin\n"}]}