##// END OF EJS Templates
convert/cvs: update debugcvsps documentation
Patrick Mezard -
r9472:a15813fa default
parent child Browse files
Show More
@@ -1,296 +1,297 b''
1 # convert.py Foreign SCM converter
1 # convert.py Foreign SCM converter
2 #
2 #
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2, incorporated herein by reference.
6 # GNU General Public License version 2, incorporated herein by reference.
7
7
8 '''import revisions from foreign VCS repositories into Mercurial'''
8 '''import revisions from foreign VCS repositories into Mercurial'''
9
9
10 import convcmd
10 import convcmd
11 import cvsps
11 import cvsps
12 import subversion
12 import subversion
13 from mercurial import commands
13 from mercurial import commands
14 from mercurial.i18n import _
14 from mercurial.i18n import _
15
15
16 # Commands definition was moved elsewhere to ease demandload job.
16 # Commands definition was moved elsewhere to ease demandload job.
17
17
18 def convert(ui, src, dest=None, revmapfile=None, **opts):
18 def convert(ui, src, dest=None, revmapfile=None, **opts):
19 """convert a foreign SCM repository to a Mercurial one.
19 """convert a foreign SCM repository to a Mercurial one.
20
20
21 Accepted source formats [identifiers]:
21 Accepted source formats [identifiers]:
22
22
23 - Mercurial [hg]
23 - Mercurial [hg]
24 - CVS [cvs]
24 - CVS [cvs]
25 - Darcs [darcs]
25 - Darcs [darcs]
26 - git [git]
26 - git [git]
27 - Subversion [svn]
27 - Subversion [svn]
28 - Monotone [mtn]
28 - Monotone [mtn]
29 - GNU Arch [gnuarch]
29 - GNU Arch [gnuarch]
30 - Bazaar [bzr]
30 - Bazaar [bzr]
31 - Perforce [p4]
31 - Perforce [p4]
32
32
33 Accepted destination formats [identifiers]:
33 Accepted destination formats [identifiers]:
34
34
35 - Mercurial [hg]
35 - Mercurial [hg]
36 - Subversion [svn] (history on branches is not preserved)
36 - Subversion [svn] (history on branches is not preserved)
37
37
38 If no revision is given, all revisions will be converted.
38 If no revision is given, all revisions will be converted.
39 Otherwise, convert will only import up to the named revision
39 Otherwise, convert will only import up to the named revision
40 (given in a format understood by the source).
40 (given in a format understood by the source).
41
41
42 If no destination directory name is specified, it defaults to the
42 If no destination directory name is specified, it defaults to the
43 basename of the source with '-hg' appended. If the destination
43 basename of the source with '-hg' appended. If the destination
44 repository doesn't exist, it will be created.
44 repository doesn't exist, it will be created.
45
45
46 By default, all sources except Mercurial will use --branchsort.
46 By default, all sources except Mercurial will use --branchsort.
47 Mercurial uses --sourcesort to preserve original revision numbers
47 Mercurial uses --sourcesort to preserve original revision numbers
48 order. Sort modes have the following effects:
48 order. Sort modes have the following effects:
49
49
50 --branchsort convert from parent to child revision when possible,
50 --branchsort convert from parent to child revision when possible,
51 which means branches are usually converted one after
51 which means branches are usually converted one after
52 the other. It generates more compact repositories.
52 the other. It generates more compact repositories.
53
53
54 --datesort sort revisions by date. Converted repositories have
54 --datesort sort revisions by date. Converted repositories have
55 good-looking changelogs but are often an order of
55 good-looking changelogs but are often an order of
56 magnitude larger than the same ones generated by
56 magnitude larger than the same ones generated by
57 --branchsort.
57 --branchsort.
58
58
59 --sourcesort try to preserve source revisions order, only
59 --sourcesort try to preserve source revisions order, only
60 supported by Mercurial sources.
60 supported by Mercurial sources.
61
61
62 If <REVMAP> isn't given, it will be put in a default location
62 If <REVMAP> isn't given, it will be put in a default location
63 (<dest>/.hg/shamap by default). The <REVMAP> is a simple text file
63 (<dest>/.hg/shamap by default). The <REVMAP> is a simple text file
64 that maps each source commit ID to the destination ID for that
64 that maps each source commit ID to the destination ID for that
65 revision, like so::
65 revision, like so::
66
66
67 <source ID> <destination ID>
67 <source ID> <destination ID>
68
68
69 If the file doesn't exist, it's automatically created. It's
69 If the file doesn't exist, it's automatically created. It's
70 updated on each commit copied, so convert-repo can be interrupted
70 updated on each commit copied, so convert-repo can be interrupted
71 and can be run repeatedly to copy new commits.
71 and can be run repeatedly to copy new commits.
72
72
73 The [username mapping] file is a simple text file that maps each
73 The [username mapping] file is a simple text file that maps each
74 source commit author to a destination commit author. It is handy
74 source commit author to a destination commit author. It is handy
75 for source SCMs that use unix logins to identify authors (eg:
75 for source SCMs that use unix logins to identify authors (eg:
76 CVS). One line per author mapping and the line format is:
76 CVS). One line per author mapping and the line format is:
77 srcauthor=whatever string you want
77 srcauthor=whatever string you want
78
78
79 The filemap is a file that allows filtering and remapping of files
79 The filemap is a file that allows filtering and remapping of files
80 and directories. Comment lines start with '#'. Each line can
80 and directories. Comment lines start with '#'. Each line can
81 contain one of the following directives::
81 contain one of the following directives::
82
82
83 include path/to/file
83 include path/to/file
84
84
85 exclude path/to/file
85 exclude path/to/file
86
86
87 rename from/file to/file
87 rename from/file to/file
88
88
89 The 'include' directive causes a file, or all files under a
89 The 'include' directive causes a file, or all files under a
90 directory, to be included in the destination repository, and the
90 directory, to be included in the destination repository, and the
91 exclusion of all other files and directories not explicitly
91 exclusion of all other files and directories not explicitly
92 included. The 'exclude' directive causes files or directories to
92 included. The 'exclude' directive causes files or directories to
93 be omitted. The 'rename' directive renames a file or directory. To
93 be omitted. The 'rename' directive renames a file or directory. To
94 rename from a subdirectory into the root of the repository, use
94 rename from a subdirectory into the root of the repository, use
95 '.' as the path to rename to.
95 '.' as the path to rename to.
96
96
97 The splicemap is a file that allows insertion of synthetic
97 The splicemap is a file that allows insertion of synthetic
98 history, letting you specify the parents of a revision. This is
98 history, letting you specify the parents of a revision. This is
99 useful if you want to e.g. give a Subversion merge two parents, or
99 useful if you want to e.g. give a Subversion merge two parents, or
100 graft two disconnected series of history together. Each entry
100 graft two disconnected series of history together. Each entry
101 contains a key, followed by a space, followed by one or two
101 contains a key, followed by a space, followed by one or two
102 comma-separated values. The key is the revision ID in the source
102 comma-separated values. The key is the revision ID in the source
103 revision control system whose parents should be modified (same
103 revision control system whose parents should be modified (same
104 format as a key in .hg/shamap). The values are the revision IDs
104 format as a key in .hg/shamap). The values are the revision IDs
105 (in either the source or destination revision control system) that
105 (in either the source or destination revision control system) that
106 should be used as the new parents for that node.
106 should be used as the new parents for that node.
107
107
108 The branchmap is a file that allows you to rename a branch when it is
108 The branchmap is a file that allows you to rename a branch when it is
109 being brought in from whatever external repository. When used in
109 being brought in from whatever external repository. When used in
110 conjunction with a splicemap, it allows for a powerful combination
110 conjunction with a splicemap, it allows for a powerful combination
111 to help fix even the most badly mismanaged repositories and turn them
111 to help fix even the most badly mismanaged repositories and turn them
112 into nicely structured Mercurial repositories. The branchmap contains
112 into nicely structured Mercurial repositories. The branchmap contains
113 lines of the form "original_branch_name new_branch_name".
113 lines of the form "original_branch_name new_branch_name".
114 "original_branch_name" is the name of the branch in the source
114 "original_branch_name" is the name of the branch in the source
115 repository, and "new_branch_name" is the name of the branch is the
115 repository, and "new_branch_name" is the name of the branch is the
116 destination repository. This can be used to (for instance) move code
116 destination repository. This can be used to (for instance) move code
117 in one repository from "default" to a named branch.
117 in one repository from "default" to a named branch.
118
118
119 Mercurial Source
119 Mercurial Source
120 ----------------
120 ----------------
121
121
122 --config convert.hg.ignoreerrors=False (boolean)
122 --config convert.hg.ignoreerrors=False (boolean)
123 ignore integrity errors when reading. Use it to fix Mercurial
123 ignore integrity errors when reading. Use it to fix Mercurial
124 repositories with missing revlogs, by converting from and to
124 repositories with missing revlogs, by converting from and to
125 Mercurial.
125 Mercurial.
126 --config convert.hg.saverev=False (boolean)
126 --config convert.hg.saverev=False (boolean)
127 store original revision ID in changeset (forces target IDs to
127 store original revision ID in changeset (forces target IDs to
128 change)
128 change)
129 --config convert.hg.startrev=0 (hg revision identifier)
129 --config convert.hg.startrev=0 (hg revision identifier)
130 convert start revision and its descendants
130 convert start revision and its descendants
131
131
132 CVS Source
132 CVS Source
133 ----------
133 ----------
134
134
135 CVS source will use a sandbox (i.e. a checked-out copy) from CVS
135 CVS source will use a sandbox (i.e. a checked-out copy) from CVS
136 to indicate the starting point of what will be converted. Direct
136 to indicate the starting point of what will be converted. Direct
137 access to the repository files is not needed, unless of course the
137 access to the repository files is not needed, unless of course the
138 repository is :local:. The conversion uses the top level directory
138 repository is :local:. The conversion uses the top level directory
139 in the sandbox to find the CVS repository, and then uses CVS rlog
139 in the sandbox to find the CVS repository, and then uses CVS rlog
140 commands to find files to convert. This means that unless a
140 commands to find files to convert. This means that unless a
141 filemap is given, all files under the starting directory will be
141 filemap is given, all files under the starting directory will be
142 converted, and that any directory reorganization in the CVS
142 converted, and that any directory reorganization in the CVS
143 sandbox is ignored.
143 sandbox is ignored.
144
144
145 Because CVS does not have changesets, it is necessary to collect
145 Because CVS does not have changesets, it is necessary to collect
146 individual commits to CVS and merge them into changesets. CVS
146 individual commits to CVS and merge them into changesets. CVS
147 source uses its internal changeset merging code by default but can
147 source uses its internal changeset merging code by default but can
148 be configured to call the external 'cvsps' program by setting::
148 be configured to call the external 'cvsps' program by setting::
149
149
150 --config convert.cvsps='cvsps -A -u --cvs-direct -q'
150 --config convert.cvsps='cvsps -A -u --cvs-direct -q'
151
151
152 This option is deprecated and will be removed in Mercurial 1.4.
152 This option is deprecated and will be removed in Mercurial 1.4.
153
153
154 The options shown are the defaults.
154 The options shown are the defaults.
155
155
156 Internal cvsps is selected by setting ::
156 Internal cvsps is selected by setting ::
157
157
158 --config convert.cvsps=builtin
158 --config convert.cvsps=builtin
159
159
160 and has a few more configurable options:
160 and has a few more configurable options:
161
161
162 --config convert.cvsps.cache=True (boolean)
162 --config convert.cvsps.cache=True (boolean)
163 Set to False to disable remote log caching, for testing and
163 Set to False to disable remote log caching, for testing and
164 debugging purposes.
164 debugging purposes.
165 --config convert.cvsps.fuzz=60 (integer)
165 --config convert.cvsps.fuzz=60 (integer)
166 Specify the maximum time (in seconds) that is allowed between
166 Specify the maximum time (in seconds) that is allowed between
167 commits with identical user and log message in a single
167 commits with identical user and log message in a single
168 changeset. When very large files were checked in as part of a
168 changeset. When very large files were checked in as part of a
169 changeset then the default may not be long enough.
169 changeset then the default may not be long enough.
170 --config convert.cvsps.mergeto='{{mergetobranch ([-\\w]+)}}'
170 --config convert.cvsps.mergeto='{{mergetobranch ([-\\w]+)}}'
171 Specify a regular expression to which commit log messages are
171 Specify a regular expression to which commit log messages are
172 matched. If a match occurs, then the conversion process will
172 matched. If a match occurs, then the conversion process will
173 insert a dummy revision merging the branch on which this log
173 insert a dummy revision merging the branch on which this log
174 message occurs to the branch indicated in the regex.
174 message occurs to the branch indicated in the regex.
175 --config convert.cvsps.mergefrom='{{mergefrombranch ([-\\w]+)}}'
175 --config convert.cvsps.mergefrom='{{mergefrombranch ([-\\w]+)}}'
176 Specify a regular expression to which commit log messages are
176 Specify a regular expression to which commit log messages are
177 matched. If a match occurs, then the conversion process will
177 matched. If a match occurs, then the conversion process will
178 add the most recent revision on the branch indicated in the
178 add the most recent revision on the branch indicated in the
179 regex as the second parent of the changeset.
179 regex as the second parent of the changeset.
180
180
181 The hgext/convert/cvsps wrapper script allows the builtin
181 An additional "debugcvsps" Mercurial command allows the builtin
182 changeset merging code to be run without doing a conversion. Its
182 changeset merging code to be run without doing a conversion. Its
183 parameters and output are similar to that of cvsps 2.1.
183 parameters and output are similar to that of cvsps 2.1. Please see
184 the command help for more details.
184
185
185 Subversion Source
186 Subversion Source
186 -----------------
187 -----------------
187
188
188 Subversion source detects classical trunk/branches/tags layouts.
189 Subversion source detects classical trunk/branches/tags layouts.
189 By default, the supplied "svn://repo/path/" source URL is
190 By default, the supplied "svn://repo/path/" source URL is
190 converted as a single branch. If "svn://repo/path/trunk" exists it
191 converted as a single branch. If "svn://repo/path/trunk" exists it
191 replaces the default branch. If "svn://repo/path/branches" exists,
192 replaces the default branch. If "svn://repo/path/branches" exists,
192 its subdirectories are listed as possible branches. If
193 its subdirectories are listed as possible branches. If
193 "svn://repo/path/tags" exists, it is looked for tags referencing
194 "svn://repo/path/tags" exists, it is looked for tags referencing
194 converted branches. Default "trunk", "branches" and "tags" values
195 converted branches. Default "trunk", "branches" and "tags" values
195 can be overridden with following options. Set them to paths
196 can be overridden with following options. Set them to paths
196 relative to the source URL, or leave them blank to disable auto
197 relative to the source URL, or leave them blank to disable auto
197 detection.
198 detection.
198
199
199 --config convert.svn.branches=branches (directory name)
200 --config convert.svn.branches=branches (directory name)
200 specify the directory containing branches
201 specify the directory containing branches
201 --config convert.svn.tags=tags (directory name)
202 --config convert.svn.tags=tags (directory name)
202 specify the directory containing tags
203 specify the directory containing tags
203 --config convert.svn.trunk=trunk (directory name)
204 --config convert.svn.trunk=trunk (directory name)
204 specify the name of the trunk branch
205 specify the name of the trunk branch
205
206
206 Source history can be retrieved starting at a specific revision,
207 Source history can be retrieved starting at a specific revision,
207 instead of being integrally converted. Only single branch
208 instead of being integrally converted. Only single branch
208 conversions are supported.
209 conversions are supported.
209
210
210 --config convert.svn.startrev=0 (svn revision number)
211 --config convert.svn.startrev=0 (svn revision number)
211 specify start Subversion revision.
212 specify start Subversion revision.
212
213
213 Perforce Source
214 Perforce Source
214 ---------------
215 ---------------
215
216
216 The Perforce (P4) importer can be given a p4 depot path or a
217 The Perforce (P4) importer can be given a p4 depot path or a
217 client specification as source. It will convert all files in the
218 client specification as source. It will convert all files in the
218 source to a flat Mercurial repository, ignoring labels, branches
219 source to a flat Mercurial repository, ignoring labels, branches
219 and integrations. Note that when a depot path is given you then
220 and integrations. Note that when a depot path is given you then
220 usually should specify a target directory, because otherwise the
221 usually should specify a target directory, because otherwise the
221 target may be named ...-hg.
222 target may be named ...-hg.
222
223
223 It is possible to limit the amount of source history to be
224 It is possible to limit the amount of source history to be
224 converted by specifying an initial Perforce revision.
225 converted by specifying an initial Perforce revision.
225
226
226 --config convert.p4.startrev=0 (perforce changelist number)
227 --config convert.p4.startrev=0 (perforce changelist number)
227 specify initial Perforce revision.
228 specify initial Perforce revision.
228
229
229 Mercurial Destination
230 Mercurial Destination
230 ---------------------
231 ---------------------
231
232
232 --config convert.hg.clonebranches=False (boolean)
233 --config convert.hg.clonebranches=False (boolean)
233 dispatch source branches in separate clones.
234 dispatch source branches in separate clones.
234 --config convert.hg.tagsbranch=default (branch name)
235 --config convert.hg.tagsbranch=default (branch name)
235 tag revisions branch name
236 tag revisions branch name
236 --config convert.hg.usebranchnames=True (boolean)
237 --config convert.hg.usebranchnames=True (boolean)
237 preserve branch names
238 preserve branch names
238
239
239 """
240 """
240 return convcmd.convert(ui, src, dest, revmapfile, **opts)
241 return convcmd.convert(ui, src, dest, revmapfile, **opts)
241
242
242 def debugsvnlog(ui, **opts):
243 def debugsvnlog(ui, **opts):
243 return subversion.debugsvnlog(ui, **opts)
244 return subversion.debugsvnlog(ui, **opts)
244
245
245 def debugcvsps(ui, *args, **opts):
246 def debugcvsps(ui, *args, **opts):
246 '''create changeset information from CVS
247 '''create changeset information from CVS
247
248
248 This command is intended as a debugging tool for the CVS to
249 This command is intended as a debugging tool for the CVS to
249 Mercurial converter, and can be used as a direct replacement for
250 Mercurial converter, and can be used as a direct replacement for
250 cvsps.
251 cvsps.
251
252
252 Hg debugcvsps reads the CVS rlog for current directory (or any
253 Hg debugcvsps reads the CVS rlog for current directory (or any
253 named directory) in the CVS repository, and converts the log to a
254 named directory) in the CVS repository, and converts the log to a
254 series of changesets based on matching commit log entries and
255 series of changesets based on matching commit log entries and
255 dates.'''
256 dates.'''
256 return cvsps.debugcvsps(ui, *args, **opts)
257 return cvsps.debugcvsps(ui, *args, **opts)
257
258
258 commands.norepo += " convert debugsvnlog debugcvsps"
259 commands.norepo += " convert debugsvnlog debugcvsps"
259
260
260 cmdtable = {
261 cmdtable = {
261 "convert":
262 "convert":
262 (convert,
263 (convert,
263 [('A', 'authors', '', _('username mapping filename')),
264 [('A', 'authors', '', _('username mapping filename')),
264 ('d', 'dest-type', '', _('destination repository type')),
265 ('d', 'dest-type', '', _('destination repository type')),
265 ('', 'filemap', '', _('remap file names using contents of file')),
266 ('', 'filemap', '', _('remap file names using contents of file')),
266 ('r', 'rev', '', _('import up to target revision REV')),
267 ('r', 'rev', '', _('import up to target revision REV')),
267 ('s', 'source-type', '', _('source repository type')),
268 ('s', 'source-type', '', _('source repository type')),
268 ('', 'splicemap', '', _('splice synthesized history into place')),
269 ('', 'splicemap', '', _('splice synthesized history into place')),
269 ('', 'branchmap', '', _('change branch names while converting')),
270 ('', 'branchmap', '', _('change branch names while converting')),
270 ('', 'branchsort', None, _('try to sort changesets by branches')),
271 ('', 'branchsort', None, _('try to sort changesets by branches')),
271 ('', 'datesort', None, _('try to sort changesets by date')),
272 ('', 'datesort', None, _('try to sort changesets by date')),
272 ('', 'sourcesort', None, _('preserve source changesets order'))],
273 ('', 'sourcesort', None, _('preserve source changesets order'))],
273 _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]')),
274 _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]')),
274 "debugsvnlog":
275 "debugsvnlog":
275 (debugsvnlog,
276 (debugsvnlog,
276 [],
277 [],
277 'hg debugsvnlog'),
278 'hg debugsvnlog'),
278 "debugcvsps":
279 "debugcvsps":
279 (debugcvsps,
280 (debugcvsps,
280 [
281 [
281 # Main options shared with cvsps-2.1
282 # Main options shared with cvsps-2.1
282 ('b', 'branches', [], _('only return changes on specified branches')),
283 ('b', 'branches', [], _('only return changes on specified branches')),
283 ('p', 'prefix', '', _('prefix to remove from file names')),
284 ('p', 'prefix', '', _('prefix to remove from file names')),
284 ('r', 'revisions', [], _('only return changes after or between specified tags')),
285 ('r', 'revisions', [], _('only return changes after or between specified tags')),
285 ('u', 'update-cache', None, _("update cvs log cache")),
286 ('u', 'update-cache', None, _("update cvs log cache")),
286 ('x', 'new-cache', None, _("create new cvs log cache")),
287 ('x', 'new-cache', None, _("create new cvs log cache")),
287 ('z', 'fuzz', 60, _('set commit time fuzz in seconds')),
288 ('z', 'fuzz', 60, _('set commit time fuzz in seconds')),
288 ('', 'root', '', _('specify cvsroot')),
289 ('', 'root', '', _('specify cvsroot')),
289 # Options specific to builtin cvsps
290 # Options specific to builtin cvsps
290 ('', 'parents', '', _('show parent changesets')),
291 ('', 'parents', '', _('show parent changesets')),
291 ('', 'ancestors', '', _('show current changeset in ancestor branches')),
292 ('', 'ancestors', '', _('show current changeset in ancestor branches')),
292 # Options that are ignored for compatibility with cvsps-2.1
293 # Options that are ignored for compatibility with cvsps-2.1
293 ('A', 'cvs-direct', None, _('ignored for compatibility')),
294 ('A', 'cvs-direct', None, _('ignored for compatibility')),
294 ],
295 ],
295 _('hg debugcvsps [OPTION]... [PATH]...')),
296 _('hg debugcvsps [OPTION]... [PATH]...')),
296 }
297 }
@@ -1,272 +1,273 b''
1 hg convert [OPTION]... SOURCE [DEST [REVMAP]]
1 hg convert [OPTION]... SOURCE [DEST [REVMAP]]
2
2
3 convert a foreign SCM repository to a Mercurial one.
3 convert a foreign SCM repository to a Mercurial one.
4
4
5 Accepted source formats [identifiers]:
5 Accepted source formats [identifiers]:
6
6
7 - Mercurial [hg]
7 - Mercurial [hg]
8 - CVS [cvs]
8 - CVS [cvs]
9 - Darcs [darcs]
9 - Darcs [darcs]
10 - git [git]
10 - git [git]
11 - Subversion [svn]
11 - Subversion [svn]
12 - Monotone [mtn]
12 - Monotone [mtn]
13 - GNU Arch [gnuarch]
13 - GNU Arch [gnuarch]
14 - Bazaar [bzr]
14 - Bazaar [bzr]
15 - Perforce [p4]
15 - Perforce [p4]
16
16
17 Accepted destination formats [identifiers]:
17 Accepted destination formats [identifiers]:
18
18
19 - Mercurial [hg]
19 - Mercurial [hg]
20 - Subversion [svn] (history on branches is not preserved)
20 - Subversion [svn] (history on branches is not preserved)
21
21
22 If no revision is given, all revisions will be converted. Otherwise,
22 If no revision is given, all revisions will be converted. Otherwise,
23 convert will only import up to the named revision (given in a format
23 convert will only import up to the named revision (given in a format
24 understood by the source).
24 understood by the source).
25
25
26 If no destination directory name is specified, it defaults to the basename
26 If no destination directory name is specified, it defaults to the basename
27 of the source with '-hg' appended. If the destination repository doesn't
27 of the source with '-hg' appended. If the destination repository doesn't
28 exist, it will be created.
28 exist, it will be created.
29
29
30 By default, all sources except Mercurial will use --branchsort. Mercurial
30 By default, all sources except Mercurial will use --branchsort. Mercurial
31 uses --sourcesort to preserve original revision numbers order. Sort modes
31 uses --sourcesort to preserve original revision numbers order. Sort modes
32 have the following effects:
32 have the following effects:
33
33
34 --branchsort convert from parent to child revision when possible, which
34 --branchsort convert from parent to child revision when possible, which
35 means branches are usually converted one after the other. It
35 means branches are usually converted one after the other. It
36 generates more compact repositories.
36 generates more compact repositories.
37 --datesort sort revisions by date. Converted repositories have good-
37 --datesort sort revisions by date. Converted repositories have good-
38 looking changelogs but are often an order of magnitude
38 looking changelogs but are often an order of magnitude
39 larger than the same ones generated by --branchsort.
39 larger than the same ones generated by --branchsort.
40 --sourcesort try to preserve source revisions order, only supported by
40 --sourcesort try to preserve source revisions order, only supported by
41 Mercurial sources.
41 Mercurial sources.
42
42
43 If <REVMAP> isn't given, it will be put in a default location
43 If <REVMAP> isn't given, it will be put in a default location
44 (<dest>/.hg/shamap by default). The <REVMAP> is a simple text file that
44 (<dest>/.hg/shamap by default). The <REVMAP> is a simple text file that
45 maps each source commit ID to the destination ID for that revision, like
45 maps each source commit ID to the destination ID for that revision, like
46 so:
46 so:
47
47
48 <source ID> <destination ID>
48 <source ID> <destination ID>
49
49
50 If the file doesn't exist, it's automatically created. It's updated on
50 If the file doesn't exist, it's automatically created. It's updated on
51 each commit copied, so convert-repo can be interrupted and can be run
51 each commit copied, so convert-repo can be interrupted and can be run
52 repeatedly to copy new commits.
52 repeatedly to copy new commits.
53
53
54 The [username mapping] file is a simple text file that maps each source
54 The [username mapping] file is a simple text file that maps each source
55 commit author to a destination commit author. It is handy for source SCMs
55 commit author to a destination commit author. It is handy for source SCMs
56 that use unix logins to identify authors (eg: CVS). One line per author
56 that use unix logins to identify authors (eg: CVS). One line per author
57 mapping and the line format is: srcauthor=whatever string you want
57 mapping and the line format is: srcauthor=whatever string you want
58
58
59 The filemap is a file that allows filtering and remapping of files and
59 The filemap is a file that allows filtering and remapping of files and
60 directories. Comment lines start with '#'. Each line can contain one of
60 directories. Comment lines start with '#'. Each line can contain one of
61 the following directives:
61 the following directives:
62
62
63 include path/to/file
63 include path/to/file
64
64
65 exclude path/to/file
65 exclude path/to/file
66
66
67 rename from/file to/file
67 rename from/file to/file
68
68
69 The 'include' directive causes a file, or all files under a directory, to
69 The 'include' directive causes a file, or all files under a directory, to
70 be included in the destination repository, and the exclusion of all other
70 be included in the destination repository, and the exclusion of all other
71 files and directories not explicitly included. The 'exclude' directive
71 files and directories not explicitly included. The 'exclude' directive
72 causes files or directories to be omitted. The 'rename' directive renames
72 causes files or directories to be omitted. The 'rename' directive renames
73 a file or directory. To rename from a subdirectory into the root of the
73 a file or directory. To rename from a subdirectory into the root of the
74 repository, use '.' as the path to rename to.
74 repository, use '.' as the path to rename to.
75
75
76 The splicemap is a file that allows insertion of synthetic history,
76 The splicemap is a file that allows insertion of synthetic history,
77 letting you specify the parents of a revision. This is useful if you want
77 letting you specify the parents of a revision. This is useful if you want
78 to e.g. give a Subversion merge two parents, or graft two disconnected
78 to e.g. give a Subversion merge two parents, or graft two disconnected
79 series of history together. Each entry contains a key, followed by a
79 series of history together. Each entry contains a key, followed by a
80 space, followed by one or two comma-separated values. The key is the
80 space, followed by one or two comma-separated values. The key is the
81 revision ID in the source revision control system whose parents should be
81 revision ID in the source revision control system whose parents should be
82 modified (same format as a key in .hg/shamap). The values are the revision
82 modified (same format as a key in .hg/shamap). The values are the revision
83 IDs (in either the source or destination revision control system) that
83 IDs (in either the source or destination revision control system) that
84 should be used as the new parents for that node.
84 should be used as the new parents for that node.
85
85
86 The branchmap is a file that allows you to rename a branch when it is
86 The branchmap is a file that allows you to rename a branch when it is
87 being brought in from whatever external repository. When used in
87 being brought in from whatever external repository. When used in
88 conjunction with a splicemap, it allows for a powerful combination to help
88 conjunction with a splicemap, it allows for a powerful combination to help
89 fix even the most badly mismanaged repositories and turn them into nicely
89 fix even the most badly mismanaged repositories and turn them into nicely
90 structured Mercurial repositories. The branchmap contains lines of the
90 structured Mercurial repositories. The branchmap contains lines of the
91 form "original_branch_name new_branch_name". "original_branch_name" is the
91 form "original_branch_name new_branch_name". "original_branch_name" is the
92 name of the branch in the source repository, and "new_branch_name" is the
92 name of the branch in the source repository, and "new_branch_name" is the
93 name of the branch is the destination repository. This can be used to (for
93 name of the branch is the destination repository. This can be used to (for
94 instance) move code in one repository from "default" to a named branch.
94 instance) move code in one repository from "default" to a named branch.
95
95
96 Mercurial Source
96 Mercurial Source
97 ----------------
97 ----------------
98
98
99 --config convert.hg.ignoreerrors=False (boolean)
99 --config convert.hg.ignoreerrors=False (boolean)
100 ignore integrity errors when reading. Use it to fix Mercurial
100 ignore integrity errors when reading. Use it to fix Mercurial
101 repositories with missing revlogs, by converting from and to
101 repositories with missing revlogs, by converting from and to
102 Mercurial.
102 Mercurial.
103 --config convert.hg.saverev=False (boolean)
103 --config convert.hg.saverev=False (boolean)
104 store original revision ID in changeset (forces target IDs to change)
104 store original revision ID in changeset (forces target IDs to change)
105 --config convert.hg.startrev=0 (hg revision identifier)
105 --config convert.hg.startrev=0 (hg revision identifier)
106 convert start revision and its descendants
106 convert start revision and its descendants
107
107
108 CVS Source
108 CVS Source
109 ----------
109 ----------
110
110
111 CVS source will use a sandbox (i.e. a checked-out copy) from CVS to
111 CVS source will use a sandbox (i.e. a checked-out copy) from CVS to
112 indicate the starting point of what will be converted. Direct access to
112 indicate the starting point of what will be converted. Direct access to
113 the repository files is not needed, unless of course the repository is
113 the repository files is not needed, unless of course the repository is
114 :local:. The conversion uses the top level directory in the sandbox to
114 :local:. The conversion uses the top level directory in the sandbox to
115 find the CVS repository, and then uses CVS rlog commands to find files to
115 find the CVS repository, and then uses CVS rlog commands to find files to
116 convert. This means that unless a filemap is given, all files under the
116 convert. This means that unless a filemap is given, all files under the
117 starting directory will be converted, and that any directory
117 starting directory will be converted, and that any directory
118 reorganization in the CVS sandbox is ignored.
118 reorganization in the CVS sandbox is ignored.
119
119
120 Because CVS does not have changesets, it is necessary to collect
120 Because CVS does not have changesets, it is necessary to collect
121 individual commits to CVS and merge them into changesets. CVS source uses
121 individual commits to CVS and merge them into changesets. CVS source uses
122 its internal changeset merging code by default but can be configured to
122 its internal changeset merging code by default but can be configured to
123 call the external 'cvsps' program by setting:
123 call the external 'cvsps' program by setting:
124
124
125 --config convert.cvsps='cvsps -A -u --cvs-direct -q'
125 --config convert.cvsps='cvsps -A -u --cvs-direct -q'
126
126
127 This option is deprecated and will be removed in Mercurial 1.4.
127 This option is deprecated and will be removed in Mercurial 1.4.
128
128
129 The options shown are the defaults.
129 The options shown are the defaults.
130
130
131 Internal cvsps is selected by setting
131 Internal cvsps is selected by setting
132
132
133 --config convert.cvsps=builtin
133 --config convert.cvsps=builtin
134
134
135 and has a few more configurable options:
135 and has a few more configurable options:
136
136
137 --config convert.cvsps.cache=True (boolean)
137 --config convert.cvsps.cache=True (boolean)
138 Set to False to disable remote log caching, for testing and debugging
138 Set to False to disable remote log caching, for testing and debugging
139 purposes.
139 purposes.
140 --config convert.cvsps.fuzz=60 (integer)
140 --config convert.cvsps.fuzz=60 (integer)
141 Specify the maximum time (in seconds) that is allowed between commits
141 Specify the maximum time (in seconds) that is allowed between commits
142 with identical user and log message in a single changeset. When very
142 with identical user and log message in a single changeset. When very
143 large files were checked in as part of a changeset then the default
143 large files were checked in as part of a changeset then the default
144 may not be long enough.
144 may not be long enough.
145 --config convert.cvsps.mergeto='{{mergetobranch ([-\w]+)}}'
145 --config convert.cvsps.mergeto='{{mergetobranch ([-\w]+)}}'
146 Specify a regular expression to which commit log messages are matched.
146 Specify a regular expression to which commit log messages are matched.
147 If a match occurs, then the conversion process will insert a dummy
147 If a match occurs, then the conversion process will insert a dummy
148 revision merging the branch on which this log message occurs to the
148 revision merging the branch on which this log message occurs to the
149 branch indicated in the regex.
149 branch indicated in the regex.
150 --config convert.cvsps.mergefrom='{{mergefrombranch ([-\w]+)}}'
150 --config convert.cvsps.mergefrom='{{mergefrombranch ([-\w]+)}}'
151 Specify a regular expression to which commit log messages are matched.
151 Specify a regular expression to which commit log messages are matched.
152 If a match occurs, then the conversion process will add the most
152 If a match occurs, then the conversion process will add the most
153 recent revision on the branch indicated in the regex as the second
153 recent revision on the branch indicated in the regex as the second
154 parent of the changeset.
154 parent of the changeset.
155
155
156 The hgext/convert/cvsps wrapper script allows the builtin changeset
156 An additional "debugcvsps" Mercurial command allows the builtin changeset
157 merging code to be run without doing a conversion. Its parameters and
157 merging code to be run without doing a conversion. Its parameters and
158 output are similar to that of cvsps 2.1.
158 output are similar to that of cvsps 2.1. Please see the command help for
159 more details.
159
160
160 Subversion Source
161 Subversion Source
161 -----------------
162 -----------------
162
163
163 Subversion source detects classical trunk/branches/tags layouts. By
164 Subversion source detects classical trunk/branches/tags layouts. By
164 default, the supplied "svn://repo/path/" source URL is converted as a
165 default, the supplied "svn://repo/path/" source URL is converted as a
165 single branch. If "svn://repo/path/trunk" exists it replaces the default
166 single branch. If "svn://repo/path/trunk" exists it replaces the default
166 branch. If "svn://repo/path/branches" exists, its subdirectories are
167 branch. If "svn://repo/path/branches" exists, its subdirectories are
167 listed as possible branches. If "svn://repo/path/tags" exists, it is
168 listed as possible branches. If "svn://repo/path/tags" exists, it is
168 looked for tags referencing converted branches. Default "trunk",
169 looked for tags referencing converted branches. Default "trunk",
169 "branches" and "tags" values can be overridden with following options. Set
170 "branches" and "tags" values can be overridden with following options. Set
170 them to paths relative to the source URL, or leave them blank to disable
171 them to paths relative to the source URL, or leave them blank to disable
171 auto detection.
172 auto detection.
172
173
173 --config convert.svn.branches=branches (directory name)
174 --config convert.svn.branches=branches (directory name)
174 specify the directory containing branches
175 specify the directory containing branches
175 --config convert.svn.tags=tags (directory name)
176 --config convert.svn.tags=tags (directory name)
176 specify the directory containing tags
177 specify the directory containing tags
177 --config convert.svn.trunk=trunk (directory name)
178 --config convert.svn.trunk=trunk (directory name)
178 specify the name of the trunk branch
179 specify the name of the trunk branch
179
180
180 Source history can be retrieved starting at a specific revision, instead
181 Source history can be retrieved starting at a specific revision, instead
181 of being integrally converted. Only single branch conversions are
182 of being integrally converted. Only single branch conversions are
182 supported.
183 supported.
183
184
184 --config convert.svn.startrev=0 (svn revision number)
185 --config convert.svn.startrev=0 (svn revision number)
185 specify start Subversion revision.
186 specify start Subversion revision.
186
187
187 Perforce Source
188 Perforce Source
188 ---------------
189 ---------------
189
190
190 The Perforce (P4) importer can be given a p4 depot path or a client
191 The Perforce (P4) importer can be given a p4 depot path or a client
191 specification as source. It will convert all files in the source to a flat
192 specification as source. It will convert all files in the source to a flat
192 Mercurial repository, ignoring labels, branches and integrations. Note
193 Mercurial repository, ignoring labels, branches and integrations. Note
193 that when a depot path is given you then usually should specify a target
194 that when a depot path is given you then usually should specify a target
194 directory, because otherwise the target may be named ...-hg.
195 directory, because otherwise the target may be named ...-hg.
195
196
196 It is possible to limit the amount of source history to be converted by
197 It is possible to limit the amount of source history to be converted by
197 specifying an initial Perforce revision.
198 specifying an initial Perforce revision.
198
199
199 --config convert.p4.startrev=0 (perforce changelist number)
200 --config convert.p4.startrev=0 (perforce changelist number)
200 specify initial Perforce revision.
201 specify initial Perforce revision.
201
202
202 Mercurial Destination
203 Mercurial Destination
203 ---------------------
204 ---------------------
204
205
205 --config convert.hg.clonebranches=False (boolean)
206 --config convert.hg.clonebranches=False (boolean)
206 dispatch source branches in separate clones.
207 dispatch source branches in separate clones.
207 --config convert.hg.tagsbranch=default (branch name)
208 --config convert.hg.tagsbranch=default (branch name)
208 tag revisions branch name
209 tag revisions branch name
209 --config convert.hg.usebranchnames=True (boolean)
210 --config convert.hg.usebranchnames=True (boolean)
210 preserve branch names
211 preserve branch names
211
212
212 options:
213 options:
213
214
214 -A --authors username mapping filename
215 -A --authors username mapping filename
215 -d --dest-type destination repository type
216 -d --dest-type destination repository type
216 --filemap remap file names using contents of file
217 --filemap remap file names using contents of file
217 -r --rev import up to target revision REV
218 -r --rev import up to target revision REV
218 -s --source-type source repository type
219 -s --source-type source repository type
219 --splicemap splice synthesized history into place
220 --splicemap splice synthesized history into place
220 --branchmap change branch names while converting
221 --branchmap change branch names while converting
221 --branchsort try to sort changesets by branches
222 --branchsort try to sort changesets by branches
222 --datesort try to sort changesets by date
223 --datesort try to sort changesets by date
223 --sourcesort preserve source changesets order
224 --sourcesort preserve source changesets order
224
225
225 use "hg -v help convert" to show global options
226 use "hg -v help convert" to show global options
226 adding a
227 adding a
227 assuming destination a-hg
228 assuming destination a-hg
228 initializing destination a-hg repository
229 initializing destination a-hg repository
229 scanning source...
230 scanning source...
230 sorting...
231 sorting...
231 converting...
232 converting...
232 4 a
233 4 a
233 3 b
234 3 b
234 2 c
235 2 c
235 1 d
236 1 d
236 0 e
237 0 e
237 pulling from ../a
238 pulling from ../a
238 searching for changes
239 searching for changes
239 no changes found
240 no changes found
240 % should fail
241 % should fail
241 initializing destination bogusfile repository
242 initializing destination bogusfile repository
242 abort: cannot create new bundle repository
243 abort: cannot create new bundle repository
243 % should fail
244 % should fail
244 abort: Permission denied: bogusdir
245 abort: Permission denied: bogusdir
245 % should succeed
246 % should succeed
246 initializing destination bogusdir repository
247 initializing destination bogusdir repository
247 scanning source...
248 scanning source...
248 sorting...
249 sorting...
249 converting...
250 converting...
250 4 a
251 4 a
251 3 b
252 3 b
252 2 c
253 2 c
253 1 d
254 1 d
254 0 e
255 0 e
255 % test pre and post conversion actions
256 % test pre and post conversion actions
256 run hg source pre-conversion action
257 run hg source pre-conversion action
257 run hg sink pre-conversion action
258 run hg sink pre-conversion action
258 run hg sink post-conversion action
259 run hg sink post-conversion action
259 run hg source post-conversion action
260 run hg source post-conversion action
260 % converting empty dir should fail nicely
261 % converting empty dir should fail nicely
261 assuming destination emptydir-hg
262 assuming destination emptydir-hg
262 initializing destination emptydir-hg repository
263 initializing destination emptydir-hg repository
263 emptydir does not look like a CVS checkout
264 emptydir does not look like a CVS checkout
264 emptydir does not look like a Git repo
265 emptydir does not look like a Git repo
265 emptydir does not look like a Subversion repo
266 emptydir does not look like a Subversion repo
266 emptydir is not a local Mercurial repo
267 emptydir is not a local Mercurial repo
267 emptydir does not look like a darcs repo
268 emptydir does not look like a darcs repo
268 emptydir does not look like a monotone repo
269 emptydir does not look like a monotone repo
269 emptydir does not look like a GNU Arch repo
270 emptydir does not look like a GNU Arch repo
270 emptydir does not look like a Bazaar repo
271 emptydir does not look like a Bazaar repo
271 cannot find required "p4" tool
272 cannot find required "p4" tool
272 abort: emptydir: missing or unsupported repository
273 abort: emptydir: missing or unsupported repository
General Comments 0
You need to be logged in to leave comments. Login now