Detailed steps for merging items from CVS to Git and Fork with Github

Source: Internet
Author: User
Tags commit mkdir valid rsync

While tinkering with my gregarius, I found that I couldn't read the HTTPS RSS and traced the discovery to the HTTP client class Snoopy he was using. Want to upgrade the new version of Snoopy but found that the original author has not been updated for several years, Github is someone to get a few mirrors, which hurrycaner this also made some improvements to the README. But all mirrors have no history of SourceForge changes.

So, what I want to do is to Fork the image based on Hurrycaner, but to get the history of the changes on SourceForge.

cvs–> Git

There should be no one to use CVS now, SourceForge also support Git, but some of the older projects are still only CVS.

There are still a few tools for translating CVS into Git, but it doesn't seem to be perfect from some of the discussions. It is no wonder that CVS storage format is a bit strange, code, modify records, modify comments are stacked in a file, parsing is certainly a headache.

Fearing that Cvs2git would convert the author to a UUID like Svn2git, I tried the Parsecvs first, but the goods were not even used, and gave up. Then use the crap that the last person on the StackOverflow recommended. The same as above, are simple make to have executable file, but more than the above help, there is a very simple example.

This can be started, the SourceForge on the first download down the warehouse:

$ mkdir Snoopy.cvs

$ Rsync-av Rsync://snoopy.cvs.sourceforge.net/cvsroot/snoopy/snoopy.cvs
Receiving incremental file list
./
cvsroot/
cvsroot/. #checkoutlist
cvsroot/. #commitinfo
cvsroot/. #config
cvsroot/. #cvswrappers
cvsroot/. #editinfo
cvsroot/. #loginfo
cvsroot/. #modules
cvsroot/. #notify
cvsroot/. #rcsinfo
cvsroot/. #taginfo
cvsroot/. #verifymsg
Cvsroot/checkoutlist
Cvsroot/checkoutlist,v
Cvsroot/commitinfo
Cvsroot/commitinfo,v
Cvsroot/config
Cvsroot/config,v
Cvsroot/cvswrappers
Cvsroot/cvswrappers,v
Cvsroot/editinfo
Cvsroot/editinfo,v
Cvsroot/history
Cvsroot/loginfo
Cvsroot/loginfo,v
Cvsroot/modules
Cvsroot/modules,v
Cvsroot/notify
Cvsroot/notify,v
cvsroot/passwd
Cvsroot/rcsinfo
Cvsroot/rcsinfo,v
Cvsroot/readers
Cvsroot/taginfo
Cvsroot/taginfo,v
Cvsroot/val-tags
Cvsroot/verifymsg
Cvsroot/verifymsg,v
Cvsroot/writers
cvsroot/emptydir/
snoopy/
Snoopy/authors,v
Snoopy/copying.lib,v
Snoopy/changelog,v
Snoopy/faq,v
Snoopy/install,v
Snoopy/makefile.am,v
Snoopy/news,v
Snoopy/readme,v
Snoopy/snoopy.class.php,v
Snoopy/todo,v
Snoopy/autogen.sh,v
Snoopy/configure.in,v
snoopy/attic/
Snoopy/attic/.cvsignore,v
Snoopy/attic/copying,v
Snoopy/attic/snoopy.class.inc,v

Sent 1,066 bytes received 229,013 bytes 17,042.89 bytes/sec
Total size is 225,573 speedup is 0.98

Note that this is not the same as downloading the CVS code, which is downloaded from the Cvsroot, the warehouse's original code.

Then initialize a Git warehouse directory and start the conversion with crap:

$ mkdir Snoopy.git
$ CD Snoopy.git

$ git init

$ .. /crap/crap-clone/home/fwolf/dev/snoopy.cvs Snoopy
Valid-requests Root valid-responses valid-requests Repository Directory max-dotdot static-directory Sticky Entry kopt Che Ckin-time Modified is-modified empty-conflicts useunchanged unchanged Notify questionable Argument Argumentx Global_ Option Gzip-stream wrapper-sendme-rcsoptions Set gssapi-authenticate expand-modules ci Co update diff log Rlog Add remove Update-patches gzip-file-contents Status Rdiff tag rtag import admin export history release watch-on Watch-off Watch-add W Atch-remove Watchers editors init annotate rannotate noop version
CYCLE **********
Changeset Andrei
Empty LOG Message * * *

install:1.1
makefile.am:1.1
news:1.1
autogen.sh:1.1
configure.in:1.1
. cvsignore:1.1
Deferring:
autogen.sh:1.2
Tag ' Snoopy ' placing on branch '
Tag ' start ' placing on branch ' Snoopy '
Opening version cache failed:no such file or directory
1970-01-01 08:00:00 CST BRANCH
2000-02-03 23:40:59 CST COMMIT
2000-02-03 23:40:59 CST BRANCH Snoopy
2000-02-03 23:40:59 CST COMMIT
2000-02-03 23:40:59 CST COMMIT
2000-02-03 23:40:59 CST TAG start
2000-02-04 00:10:54 CST COMMIT
2000-02-04 00:10:54 CST COMMIT
2000-02-04 00:28:59 CST COMMIT
2000-02-22 23:44:57 CST COMMIT
2000-03-10 04:52:59 CST COMMIT
2000-03-10 04:54:47 CST COMMIT
2000-05-18 22:50:14 CST COMMIT
2000-05-18 23:36:34 CST COMMIT
2000-05-18 23:44:00 CST COMMIT
2000-06-30 02:37:25 CST COMMIT
2000-08-23 04:36:52 CST COMMIT
2000-09-14 04:52:04 CST COMMIT
2000-09-14 22:09:58 CST COMMIT
2000-09-15 21:11:11 CST COMMIT
2000-09-16 05:57:37 CST COMMIT
2000-09-27 03:34:38 CST COMMIT
2000-09-27 04:28:45 CST COMMIT
2000-10-09 21:13:52 CST COMMIT
2001-03-25 04:15:18 CST COMMIT
2001-07-07 05:24:11 CST COMMIT
2001-08-22 23:43:24 CST COMMIT
2001-11-21 04:23:02 CST COMMIT
2002-10-03 22:38:49 CST COMMIT
2002-10-03 22:55:06 CST COMMIT
2002-10-03 22:57:39 CST COMMIT
2002-10-10 04:25:50 CST commitmissed-A-time round:changelog 1.11
Missed Round:Snoopy.class.inc 1.21

2002-10-10 04:41:24 CST Commitcvs Checkout changelog 1.14-version is duplicate
CVS Checkout Snoopy.class.inc 1.24-version is duplicate
Missed Round:changelog 1.12
Missed Round:Snoopy.class.inc 1.22

2002-10-10 04:51:57 CST Commitcvs Checkout changelog 1.14-version is duplicate
CVS Checkout Snoopy.class.inc 1.24-version is duplicate
Missed Round:changelog 1.13
Missed Round:Snoopy.class.inc 1.23

2002-10-10 04:56:14 CST COMMIT
2003-03-12 22:40:55 CST COMMIT
2003-09-15 21:58:28 CST COMMIT
2003-10-22 03:18:39 CST COMMIT
2003-11-08 03:52:58 CST COMMIT
2003-12-24 03:34:35 CST COMMIT
2004-01-08 03:16:10 CST COMMIT
2004-07-25 02:23:27 CST commitmissed-A-time round:changelog 1.19
Missed round:Snoopy.class.php 1.5

2004-07-25 02:34:28 CST Commitcvs Checkout changelog 1.22-version is duplicate
CVS Checkout Snoopy.class.php 1.8-version is duplicate
Missed Round:changelog 1.20
Missed round:Snoopy.class.php 1.6

2004-07-25 08:49:02 CST COMMIT
2004-07-25 10:42:48 CST COMMIT
2004-07-25 10:46:34 CST COMMIT
2004-07-25 10:46:59 CST COMMIT
2004-07-25 11:18:32 CST COMMIT
2004-10-16 13:14:11 CST COMMIT
2004-10-16 13:17:41 CST COMMIT
2004-10-16 13:44:51 CST COMMIT
2004-10-16 14:27:09 CST COMMIT
2004-10-16 14:28:30 CST COMMIT
2004-10-16 14:40:42 CST COMMIT
2004-10-17 00:33:58 CST COMMIT
2004-10-17 00:36:18 CST COMMIT
2004-10-18 13:12:55 CST COMMIT
2004-10-18 13:18:27 CST COMMIT
2004-10-18 13:19:04 CST COMMIT
2004-10-18 13:19:28 CST COMMIT
2004-10-18 13:19:51 CST COMMIT
2004-11-18 13:51:32 CST COMMIT
2004-11-18 13:52:28 CST COMMIT
2004-11-18 14:37:05 CST COMMIT
2005-02-03 12:43:26 CST COMMIT
2005-02-03 12:57:05 CST COMMIT
2005-10-23 10:08:40 CST COMMIT
2005-10-23 10:16:26 CST COMMIT
2005-10-24 00:30:34 CST COMMIT
2005-10-24 23:34:50 CST COMMIT
2005-10-24 23:44:12 CST COMMIT
2005-10-24 23:44:59 CST COMMIT
2005-10-24 23:46:10 CST COMMIT
2005-10-30 13:33:15 CST COMMIT
2005-10-30 13:45:09 CST COMMIT
2005-10-31 02:32:42 CST COMMIT
2005-10-31 02:51:35 CST COMMIT
2005-11-08 14:53:56 CST COMMIT
2005-11-08 15:01:47 CST COMMIT
2008-10-22 23:30:41 CST COMMIT
2008-10-22 23:53:14 CST COMMIT
2008-11-09 05:09:09 CST COMMIT
emitted commits (= Total 79).
Exact 2 + 1 = 3 branches + tags.
Fixup 0 + 0 = 0 Branches + tags.
Download 147 CVS versions in transactions.
String cache:141 items, 132/1024 buckets used, mean search 1.06383
Git-fast-import Statistics:
---------------------------------------------------------------------
Alloc ' d objects:5000
Total objects:289 (8 duplicates)
blobs:134 (7 duplicates deltas of attempts)
trees:77 (0 duplicates deltas of attempts)
commits:78 (1 Duplicates 0 deltas of 0 attempts)
tags:0 (0 duplicates 0 deltas of 0 attempts)
Total Branches:3 (2 loads)
marks:1024 (Unique)
Atoms:15
Memory total:2294 KiB
pools:2098 KiB
objects:195 KiB
---------------------------------------------------------------------
Pack_report:getpagesize () = 4096
Pack_report:core.packedGitWindowSize = 33554432
Pack_report:core.packedGitLimit = 268435456
PACK_REPORT:PACK_USED_CTR = 7
Pack_report:pack_mmap_calls = 3
Pack_report:pack_open_windows = 1/1
pack_report:pack_mapped = 350104/350104
---------------------------------------------------------------------

This Git repository contains the CVS history that has already been converted and can be reset if no files are visible.

Supposedly subsequent operations can theoretically operate in this warehouse directory, but for better and Fork projects, I use the method of exporting Patch, followed by am:

$ git log--pretty=oneline |wc-l
78

$ git format-patch-78

In fact here, can also be in the target repo inside, by adding snoopy.git for git remote, and then the way of the merge remote, the effect is better, do not have to modify the submission time.

Fork Project, deceitful Act

In the Github on the Fork https://github.com/hurrycaner/snoopy, get https://github.com/fwolf/snoopy, but not to load the local, after the operation method and normal Fork project is not The same.

Create a new Git warehouse locally, which is our main repository for future maintenance of Snoopy:

$ mkdir Snoopy
$ CD Snoopy
$ git init
$ git Remote add Origin git@github.com:fwolf/snoopy.git
$ touch. Gitignore
$ git Add. Gitignore
$ git commit-a-M "Initial commit"
$ Git push-f Origin Master

And the new project method is basically the same, the difference is that our origin is Fork after the project, and carried out a push-f operation, covering up all hurrycaner submissions.

Next, create a new SourceForge branch that retains the final status of the CVS code on SourceForge, which is imported through AM,--committer-date-is-author-date the author's time as the submission time or not. Patch 0002 is empty and will cause am to fail, so delete:

$ git Branch SourceForge
$ git checkout SourceForge

$ rm.. /snoopy.git/0002-initial-check-in.patch
$ git am.. /snoopy.git/00*--committer-date-is-author-date

$ git Checkout Master
$ git merge SourceForge
$ git push

Now, the master branch is an initial submission that I made, along with the submissions from CVS, which is equivalent to CVS being fully imported into Git.

Adding only one empty. The initial submission of a Gitignore file is a habit of git, because Git's initial submission can be considered "not operable", so it is best to be empty or contain only minimal content.

Next, we will merge the changes made by Hurrycaner. Because he was modified based on Snoopy 1.2.4 Code, and the final code I imported was not very good, so the merger was smooth, with only a few conflicts:

$ git Branch Hurrycaner
$ git checkout Hurrycaner
$ git remote add upstream git@github.com:hurrycaner/snoopy.git
$ git fetch upstream
$ git Merge Upstream/master # Manual conflict Resolution

$ git Checkout Master
$ git Merge Hurrycaner
$ git push

This is basically done, retaining a complete record of changes from CVS to Hurrycaner, and continuing to work like a normal Fork project.

The change of record looks like this:



I have already pushed Pull Request to the original project author. Hurrycaner is not active in Github, do not know can see, will accept AH.

End

Git is more flexible to use, and I'm sure other distributed SCM can do it, not research it, not contrast it. In other words, does the practice in this article have a little Shing feeling?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.