1

I have searched around, and I haven't understood what is the best way to do this: I want to clone an existing CVS repository (specifically, OpenSSH portable) , or a revision of it (eg v6.0p1) to a git repo, for applying personal patches. I would also like to merge changes whenever another stable OpenSSH is released. It doesn't have to be in real-time or anything special, just to be able to merge my patches to new versions.

I have previous git (and SVN experience), but no CVS experience.

Ori Shavit
  • 255
  • 2
  • 5
  • 8
  • Have you checked this? http://stackoverflow.com/questions/584522/how-to-export-revision-history-from-mercurial-or-git-to-cvs/586225#586225 – Penghe Geng Aug 18 '12 at 21:21

1 Answers1

2

You have two options: maintain a vendor branch or use git cvsimport. Which you use depends on how much history you want and how patient you are.

If you want full history and are patient, you can import the whole CVS repo into git using git cvsimport. If you're fortunate, you may find that someone else has already done this and is keeping the result up-to-date -- if you trust them, using their repo is the best options.

If you don't need full history or are impatient, you can maintain a vendor branch: this is what we used to do before we had a DVCS :). Grab a copy of the current release, put it in a branch called 'vendor' and base your work on it. When the next release is made, switch back to the vendor branch, update it to match the new release and merge/rebase as appropriate.

Note that while vendor branches are required less often when using a DVCS, they're actually much easier in git than they were with Subversion, as git doesn't require you to identify renames and (as with svn now) doesn't leave meta-data all over your working copy that gets blitzed when you unpack the latest release.

Andrew Aylett
  • 39,182
  • 5
  • 68
  • 95
  • I think I'm not completely understanding: You suggest to checkout using CVS, put the working directory under git (ignoring the CVS metadata files?), and work from that. And when a new version is released, update the CVS working directory (the 'vendor' branch) using cvs, commit it to git, and merge to the development branches. Is this right? – Ori Shavit Aug 19 '12 at 19:30
  • Close enough for a first approximation. I'd be really careful about using the same directory for both CVS and git working copies: safer to copy the files out of your CVS WC and into your git WC. You don't have to use CVS in this scheme either: if you're working from releases, you can extract the release tarball into your git working copy. Better still, though, is to use `git cvsimport` or to find someone who has already done that. – Andrew Aylett Aug 20 '12 at 12:18
  • There is no regularly updated mirror of OpenSSH that I've seen, and I don't really want to mirror a 13 year old repository just for the occasional version. And also, the release tarballs differ from the repository, and I prefer to patch from source. What I'll think I'll do is this: checkout a release into the vendor branch, excluding the CVS metadata. And when a new version comes out, I can do `cvs rdiff` between the version in my repo and the new one, and apply it to the vendor branch. Then I can merge it with my patches. – Ori Shavit Aug 20 '12 at 18:53
  • In case this is still an issue for you, it looks like GitHub has a mirror here: https://github.com/openssh/openssh-portable. I'd be interested to learn how you got on with your vendor branch :). – Andrew Aylett Jun 15 '14 at 21:59
  • The problem with these kind of mirrors is that you can't tell if the code hasn't been tampered with, it's not "official" or from some known source. And it's not trivial to check (no git hashes etc). What I did was along the lines of downloading an ssh tarball and putting it in a vendor branch, make changes on another branch, when a new version of OpenSSH comes out, download the new tarball and overwrite the vendor branch, and then merge the changes to other branches, so the other branches have the new version and your patches. You can see what I did here: https://github.com/orishavit/OpenSSH – Ori Shavit Jun 15 '14 at 22:21