File: cvs2git.html

package info (click to toggle)
cvs2svn 2.3.0-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 3,528 kB
  • ctags: 2,828
  • sloc: python: 20,721; sh: 509; perl: 121; makefile: 79
file content (348 lines) | stat: -rw-r--r-- 12,147 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css"> /* <![CDATA[ */
  @import "tigris-branding/css/tigris.css";
  @import "tigris-branding/css/inst.css";
  /* ]]> */</style>
<link rel="stylesheet" type="text/css" media="print"
  href="tigris-branding/css/print.css"/>
<script type="text/javascript" src="tigris-branding/scripts/tigris.js"></script>
<title>cvs2git Documentation</title>
</head>

<body id="bodycol">
<div class="app">

<h1>cvs2git</h1>

<h2>Index</h2>

<ul>

  <li><a href="#intro">Introduction</a></li>

  <li><a href="#reqs">Requirements</a></li>

  <li><a href="#status">Development status</a></li>

  <li><a href="#docs">Documentation</a></li>

  <li><a href="#usage">Usage</a></li>

</ul>

<hr />

<h2><a name="intro">Introduction</a></h2>

<p>cvs2svn/cvs2git is a tool that can be used to migrate CVS
repositories to newer version control tools, including <a
href="http://git.or.cz/">git</a>.  git is a distributed version
control system most famous for being used for Linux kernel
development.  The program used to convert to git, called cvs2git, is
distributed as part of the cvs2svn project.</p>

<p><strong>If you are reading this documentation on the <a
href="http://cvs2svn.tigris.org">cvs2svn website</a>, then please be
aware that it describes the current trunk version of cvs2svn, which
may be different than the most recent released version.  Please refer
to the documentation that was included with your version of cvs2svn.
</strong></p>

<p>Conversion to git was added in release 2.1 of cvs2svn and has
improved significantly since then.  Please make sure you are using an
up-to-date version of cvs2svn--perhaps even the development trunk
version.</p>


<h2><a name="reqs">Requirements</a></h2>

<p>cvs2git requires the following:</p>

<ul>

  <li>Direct (filesystem) access to a copy of the CVS repository that
    you want to convert.  cvs2git parses the files in the CVS
    repository directly, so it is not enough to have remote CVS
    access.  See the <a href="faq.html#repoaccess">FAQ</a> for more
    information and a possible workaround.</li>

  <li>Python 2, version 2.4 or later.  See <a
    href="http://www.python.org/">http://www.python.org/</a>.
    (cvs2git does <strong>not</strong> work with Python 3.x.)</li>

  <li>If you use the <tt>--use-rcs</tt> option, then RCS's `co'
    program is required.  The RCS home page is
    <a href="http://www.cs.purdue.edu/homes/trinkle/RCS/"
            >http://www.cs.purdue.edu/homes/trinkle/RCS/</a>.
    See the <a href="cvs2svn.html#use-rcs"><tt>--use-rcs</tt> flag</a> for more
    details.</li>

  <li>If you use the <tt>--use-cvs</tt> option, then the `cvs' command
    is required.  The CVS home page is
    <a href="http://ccvs.cvshome.org/">http://ccvs.cvshome.org/</a>.
    See the <a href="cvs2svn.html#use-cvs"><tt>--use-cvs</tt> flag</a> for more
    details.</li>

  <li>GNU sort, which is part of the coreutils package, see <a
    href="http://www.gnu.org/software/coreutils/"
         >http://www.gnu.org/software/coreutils/</a>.  Binaries for
    Win32 can be found at <a href="http://unxutils.sourceforge.net/"
                                  >http://unxutils.sourceforge.net/</a>.
    Windows <tt>sort.exe</tt> is <b>not</b> adequate.</li>

  <li> Git version 1.5.4.4 or later (earlier versions have a bug in
    "git fast-import" that prevent them from loading the files
    generated by cvs2git).</li>

</ul>


<h2><a name="status">Development status</a></h2>

<p>Most of the work of converting a repository from CVS to a more
modern version control system is inferring the most likely history
given the incomplete information that CVS records.  cvs2svn has a long
history of making sense of even the most convoluted CVS repositories,
and cvs2git uses this same machinery.  Therefore, cvs2git inherits the
robustness and many of the <a href="features.html">features of
cvs2svn</a>.  cvs2svn can convert just about every CVS repository we
have ever seen, and includes a plethora of options for customizing
your conversion.</p>

<p>The output of cvs2git is one or more dump files that can be
imported into git using the excellent <a
href="http://www.kernel.org/pub/software/scm/git/docs/git
fast-import.html">git fast-import</a> tool.</p>

<p>Although cvs2git is considerably newer than cvs2svn, and much less
well tested, it is believed that cvs2git can (cautiously) be used for
production conversions.  If you use cvs2git, please let us know how it
worked for you!</p>


<h2><a name="limitations">cvs2git limitations</a></h2>

<p>cvs2git still has many limitations compared to cvs2svn.  The main
cvs2svn developer has limited git experience and very limited time, so
<strong>help would be much appreciated!</strong> Some of these missing
features would be pretty easy to program, and I'd be happy to help you
get started.</p>

<ul>

  <li>The cvs2git documentation is still rather thin.  See <a
    href="#docs">below</a> for more references.</li>

  <li>CVS allows a branch to be created from arbitrary combinations of
    source revisions and/or source branches.  cvs2git tries to create
    a branch from a single source, but if it can't figure out how to,
    it creates the branch using "merge" from multiple sources.  In
    pathological situations, the number of merge sources for a branch
    can be arbitrarily large.</li>

  <li>If cvs2git cannot determine that a CVS tag can be created from a
    single revision, then it creates a <a
    href="http://www.kernel.org/pub/software/scm/git/docs/git-fast-import.html">tag
    fixup branch</a> named <tt>TAG.FIXUP</tt>, then tags this branch.
    (This is a necessary workaround for the fact that CVS tags are
    fundamentally different than git tags.)  The <tt>TAG.FIXUP</tt>
    branch is cleared at the end of the conversion, but not deleted.
    There are some situations when a tag <em>could</em> be created
    from a single revision, but cvs2git does not realize it and
    creates a superfluous tag fixup branch.  It is possible to delete
    all superfluous tag fixup branches after the conversion, by
    running the <tt>contrib/git-move-tags.py</tt> script within the
    resulting git repository.</li>

  <li>There are no checks that CVS branch and tag names are legal git
    names.  There are probably other git constraints that should also
    be checked.</li>

  <li>The data that should be fed to git fast-import are written to
    two files, which have to be loaded into git fast-import manually.
    These files might grow to very large size.  It would be nice to
    add an option to invoke git fast-import automatically and pipe the
    output directly into git fast-import; this should also speed up
    the conversion.</li>

  <li>Only single projects can be converted at a time.  Given the way
    git is typically used, I don't think that this is a significant
    limitation.</li>

  <li>cvs2git is not especially fast.  Among other things, it still
    uses RCS or CVS to extract the contents of the CVS revisions.
    Implementing the <tt>--internal-co</tt> option for cvs2git (using
    code that already exists in cvs2svn) might improve the conversion
    speed considerably.</li>

  <li>The cvs2svn test suite does not include meaningful tests of git
    output.</li>

  <li>cvs2git makes no attempt to convert <tt>.cvsignore</tt> files
    into <tt>.gitignore</tt> files.</li>

  <li>cvs2git, like cvs2svn, does not support incremental conversion
    (i.e., tracking a live CVS repository).  However, at least one
    person has documented a <a
    href="http://www.oak.homeunix.org/~marcel/blog/2009/06/03/tracking-cvs-with-git-using-cvs2git">possible
    workaround</a>.</li>

</ul>


<h2><a name="docs">Documentation</a></h2>

<p>There is some documentation specific to cvs2git, and much of the
cvs2svn documentation also applies fairly straightforwardly to
cvs2git.  See the following sources:</p>

<ul>

  <li>This document.</li>

  <li>The cvs2git man page and the output of <tt>cvs2git
    --help</tt>.</li>

  <li><a href="cvs2svn.html#intro">The cvs2svn documentation</a> and
    <a href="faq.html">the cvs2svn FAQ</a>, which contain much general
    discussion and describe many features that can also be used for
    cvs2git.</li>

  <li><tt>cvs2git-example.options</tt> in the cvs2svn source tree,
    which is an example of an options file that can be used to
    configure a cvs2git conversion.  The file is extensively
    documented.</li>

  <li>The cvs2svn mailing lists, IRC channel, etc., as described in <a
    href="faq.html#gettinghelp">the cvs2svn FAQ</a>.</li>

</ul>


<h2><a name="usage">Usage</a></h2>

<p>This section outlines the steps needed to convert a CVS repository
to git using cvs2git.</p>

<ol>

  <li>Be sure that you have the <a href="#reqs">requirements</a>,
    including either RCS or CVS (used to read revision contents from
    the CVS repository).</li>

  <li>Obtain a copy of cvs2svn/cvs2git version 2.1 or newer.  It is
    recommended that you use the most recent version available, or
    even the development version.

    <ul>

      <li>To install cvs2svn from a <a
        href="http://cvs2svn.tigris.org/servlets/ProjectDocumentList">tarball</a>,
        simply unpack the tarball into a directory on your conversion
        computer (cvs2git can be run directly from this
        directory).</li>

      <li>

        <p>To check out the current trunk version of cvs2svn, make
          sure that you have Subversion installed and then run:</p>

<pre>
svn co --username=guest http://cvs2svn.tigris.org/svn/cvs2svn/trunk cvs2svn-trunk
# The password is empty; i.e., just press return.
cd cvs2svn-trunk
make man # If you want to create manpages for the main programs
make check # ...optional
</pre>

        <p>Please note that the test suite includes tests that are
          marked "XFAIL" (expected failure); these are known and are
          not considered serious problems.</p>

      </li>

    </ul>

  </li>

  <li>

    Configure cvs2git for your conversion.  This can be done via
    command-line options or via an options file:

    <ul>

      <li>The command-line options for running cvs2git are documented
        in the cvs2git man page and in the output of <tt>cvs2git
        --help</tt>.</li>

      <li>

        <p>The more flexible <a
          href="cvs2svn.html#cmd-vs-options">options-file method</a>
          requires you to create an options file, then start cvs2git
          with</p>

<pre>
cvs2git --options=OPTIONS-FILE
</pre>

        <p>Use <tt>cvs2git-example.options</tt> in the cvs2svn source
          tree as your starting point; the file contains lots of
          documentation.</p>

      </li>

    </ul>

  </li>

  <li>

    <p>Run cvs2git.  This creates two output files in <a
    href="http://www.kernel.org/pub/software/scm/git/docs/git-fast-import.html">git
    fast-import</a> format.  The names of these files are specified by
    your options file or command-line arguments.  In the example,
    these files are named <tt>cvs2svn-tmp/git-blob.dat</tt> and
    <tt>cvs2svn-tmp/git-dump.dat</tt>.</p>

  </li>

  <li>

    <p>Initialize a git repository, and load the dump files using
      git fast-import:</p>

<pre>
git init
cat cvs2svn-tmp/git-blob.dat | git fast-import --export-marks=cvs2svn-tmp/git-marks.dat
cat cvs2svn-tmp/git-dump.dat | git fast-import --import-marks=cvs2svn-tmp/git-marks.dat
</pre>

    <p>This can, of course, be shortened to:</p>

<pre>
git init
cat cvs2svn-tmp/git-blob.dat cvs2svn-tmp/git-dump.dat | git fast-import
</pre>

  </li>

  <li>If you want to get rid of unnecessary tag fixup branches, then
    run the <tt>contrib/git-move-tags.py</tt> script from within the
    git repository.</li>

</ol>

<p>Feedback would be much appreciated, including reports of success
  using cvs2git.  Please send comments, bug reports, and patches to
  the <a
  href="http://cvs2svn.tigris.org/servlets/ProjectMailingListList">cvs2svn
  mailing lists</a>.</p>

</div>
</body>
</html>