git-cvsimport.txt 7.56 KB
Newer Older
Junio C Hamano's avatar
Junio C Hamano committed
1 2
git-cvsimport(1)
================
3 4 5

NAME
----
6
git-cvsimport - Salvage your data out of another SCM people love to hate
7 8 9 10


SYNOPSIS
--------
11
[verse]
12
'git cvsimport' [-o <branch-for-HEAD>] [-h] [-v] [-d <CVSROOT>]
13 14 15
	      [-A <author-conv-file>] [-p <options-for-cvsps>] [-P <file>]
	      [-C <git_repository>] [-z <fuzz>] [-i] [-k] [-u] [-s <subst>]
	      [-a] [-m] [-M <regex>] [-S <regex>] [-L <commitlimit>]
16
	      [-r <remote>] [-R] [<CVS_module>]
17 18 19 20


DESCRIPTION
-----------
21 22 23
*WARNING:* `git cvsimport` uses cvsps version 2, which is considered
deprecated; it does not work with cvsps version 3 and later.  If you are
performing a one-shot import of a CVS repository consider using
24 25
http://cvs2svn.tigris.org/cvs2git.html[cvs2git] or
https://github.com/BartMassey/parsecvs[parsecvs].
26

27
Imports a CVS repository into Git. It will either create a new
28 29
repository, or incrementally import into an existing one.

30
Splitting the CVS log into patch sets is done by 'cvsps'.
31 32
At least version 2.1 is required.

33 34 35
*WARNING:* for certain situations the import leads to incorrect results.
Please see the section <<issues,ISSUES>> for further reference.

36
You should *never* do any work of your own on the branches that are
37
created by 'git cvsimport'.  By default initial import will create and populate a
38
"master" branch from the CVS repository's main branch which you're free
39
to work with; after that, you need to 'git merge' incremental imports, or
40 41 42
any CVS branches, yourself.  It is advisable to specify a named remote via
-r to separate and protect the incoming branches.

43 44 45 46 47 48
If you intend to set up a shared public repository that all developers can
read/write, or if you want to use linkgit:git-cvsserver[1], then you
probably want to make a bare clone of the imported repository,
and use the clone as the shared repository.
See linkgit:gitcvs-migration[7].

49

50 51
OPTIONS
-------
52 53 54
-v::
	Verbosity: let 'cvsimport' report what it is doing.

55 56
-d <CVSROOT>::
	The root of the CVS archive. May be local (a simple path) or remote;
Junio C Hamano's avatar
Junio C Hamano committed
57
	currently, only the :local:, :ext: and :pserver: access methods
58
	are supported. If not given, 'git cvsimport' will try to read it
59 60
	from `CVS/Root`. If no such file exists, it checks for the
	`CVSROOT` environment variable.
61

62 63
<CVS_module>::
	The CVS module you want to import. Relative to <CVSROOT>.
64
	If not given, 'git cvsimport' tries to read it from
65 66
	`CVS/Repository`.

67
-C <target-dir>::
68
	The Git repository to import to.  If the directory doesn't
69 70
        exist, it will be created.  Default is the current directory.

71
-r <remote>::
72
	The Git remote to import this CVS repository into.
73
	Moves all CVS branches into remotes/<remote>/<branch>
74
	akin to the way 'git clone' uses 'origin' by default.
75

76
-o <branch-for-HEAD>::
77
	When no remote is specified (via -r) the 'HEAD' branch
78 79
	from CVS is imported to the 'origin' branch within the Git
	repository, as 'HEAD' already has a special meaning for Git.
80
	When a remote is specified the 'HEAD' branch is named
81
	remotes/<remote>/master mirroring 'git clone' behaviour.
82 83
	Use this option if you want to import into a different
	branch.
84 85 86 87
+
Use '-o master' for continuing an import that was initially done by
the old cvs2git tool.

88 89
-i::
	Import-only: don't perform a checkout after importing.  This option
90
	ensures the working directory and index remain untouched and will
91 92
	not create them if they do not exist.

93
-k::
94
	Kill keywords: will extract files with '-kk' from the CVS archive
95
	to avoid noisy changesets. Highly recommended, but off by default
Junio C Hamano's avatar
Junio C Hamano committed
96
	to preserve compatibility with early imported trees.
97

98 99 100
-u::
	Convert underscores in tag and branch names to dots.

101 102
-s <subst>::
	Substitute the character "/" in branch names with <subst>
103 104 105

-p <options-for-cvsps>::
	Additional options for cvsps.
106
	The options '-u' and '-A' are implicit and should not be used here.
107 108
+
If you need to pass multiple options, separate them with a comma.
109

110 111 112 113
-z <fuzz>::
	Pass the timestamp fuzz factor to cvsps, in seconds. If unset,
	cvsps defaults to 300s.

114
-P <cvsps-output-file>::
115 116 117
	Instead of calling cvsps, read the provided cvsps output file. Useful
	for debugging or when cvsps is being handled outside cvsimport.

Junio C Hamano's avatar
Junio C Hamano committed
118
-m::
119
	Attempt to detect merges based on the commit message. This option
120
	will enable default regexes that try to capture the source
Junio C Hamano's avatar
Junio C Hamano committed
121
	branch name from the commit message.
122 123 124

-M <regex>::
	Attempt to detect merges based on the commit message with a custom
125 126
	regex. It can be used with '-m' to enable the default regexes
	as well. You must escape forward slashes.
127 128 129 130
+
The regex must capture the source branch name in $1.
+
This option can be used several times to provide several detection regexes.
131

132 133
-S <regex>::
	Skip paths matching the regex.
134

135 136 137
-a::
	Import all commits, including recent ones. cvsimport by default
	skips commits that have a timestamp less than 10 minutes ago.
138 139 140 141 142

-L <limit>::
	Limit the number of commits imported. Workaround for cases where
	cvsimport leaks memory.

143 144 145
-A <author-conv-file>::
	CVS by default uses the Unix username when writing its
	commit logs. Using this option and an author-conv-file
146
	maps the name recorded in CVS to author name, e-mail and
147
	optional time zone:
148 149
+
---------
150
	exon=Andreas Ericsson <[email protected]>
151
	spawn=Simon Pawn <[email protected]> America/Chicago
152

153 154
---------
+
155
'git cvsimport' will make it appear as those authors had
156
their GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL set properly
157
all along.  If a time zone is specified, GIT_AUTHOR_DATE will
158
have the corresponding offset applied.
159
+
160
For convenience, this data is saved to `$GIT_DIR/cvs-authors`
161
each time the '-A' option is provided and read from that same
162
file each time 'git cvsimport' is run.
163 164 165
+
It is not recommended to use this feature if you intend to
export changes back to CVS again later with
166
'git cvsexportcommit'.
167

168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
-R::
	Generate a `$GIT_DIR/cvs-revisions` file containing a mapping from CVS
	revision numbers to newly-created Git commit IDs.  The generated file
	will contain one line for each (filename, revision) pair imported;
	each line will look like
+
---------
src/widget.c 1.1 1d862f173cdc7325b6fa6d2ae1cfd61fd1b512b7
---------
+
The revision data is appended to the file if it already exists, for use when
doing incremental imports.
+
This option may be useful if you have CVS revision numbers stored in commit
messages, bug-tracking systems, email archives, and the like.

184 185 186
-h::
	Print a short usage message and exit.

187 188 189 190 191 192 193
OUTPUT
------
If '-v' is specified, the script reports what it is doing.

Otherwise, success is indicated the Unix way, i.e. by simply exiting with
a zero exit status.

194 195 196 197 198
[[issues]]
ISSUES
------
Problems related to timestamps:

199
 * If timestamps of commits in the CVS repository are not stable enough
200 201
   to be used for ordering commits changes may show up in the wrong
   order.
202
 * If any files were ever "cvs import"ed more than once (e.g., import of
203
   more than one vendor release) the HEAD contains the wrong content.
204
 * If the timestamp order of different files cross the revision order
205 206
   within the commit matching time window the order of commits may be
   wrong.
207 208 209

Problems related to branches:

210
 * Branches on which no commits have been made are not imported.
211
 * All files from the branching point are added to a branch even if
212
   never added in CVS.
213 214 215
 * This applies to files added to the source branch *after* a daughter
   branch was created: if previously no commit was made on the daughter
   branch they will erroneously be added to the daughter branch in git.
216 217 218

Problems related to tags:

219
* Multiple tags on the same revision are not imported.
220 221

If you suspect that any of these issues may apply to the repository you
Thomas Ackermann's avatar
Thomas Ackermann committed
222
want to import, consider using cvs2git:
223

224
* cvs2git (part of cvs2svn), `http://subversion.apache.org/`
225 226 227

GIT
---
228
Part of the linkgit:git[1] suite