##// END OF EJS Templates
configitems: register the 'convert.cvsps.logencoding' config
Boris Feld -
r34618:4876bf5a default
parent child Browse files
Show More
@@ -1,594 +1,597 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 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 '''import revisions from foreign VCS repositories into Mercurial'''
8 '''import revisions from foreign VCS repositories into Mercurial'''
9
9
10 from __future__ import absolute_import
10 from __future__ import absolute_import
11
11
12 from mercurial.i18n import _
12 from mercurial.i18n import _
13 from mercurial import (
13 from mercurial import (
14 registrar,
14 registrar,
15 )
15 )
16
16
17 from . import (
17 from . import (
18 convcmd,
18 convcmd,
19 cvsps,
19 cvsps,
20 subversion,
20 subversion,
21 )
21 )
22
22
23 cmdtable = {}
23 cmdtable = {}
24 command = registrar.command(cmdtable)
24 command = registrar.command(cmdtable)
25 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
25 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
26 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
26 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
27 # be specifying the version(s) of Mercurial they are tested with, or
27 # be specifying the version(s) of Mercurial they are tested with, or
28 # leave the attribute unspecified.
28 # leave the attribute unspecified.
29 testedwith = 'ships-with-hg-core'
29 testedwith = 'ships-with-hg-core'
30
30
31 configtable = {}
31 configtable = {}
32 configitem = registrar.configitem(configtable)
32 configitem = registrar.configitem(configtable)
33
33
34 configitem('convert', 'cvsps.cache',
34 configitem('convert', 'cvsps.cache',
35 default=True,
35 default=True,
36 )
36 )
37 configitem('convert', 'cvsps.fuzz',
37 configitem('convert', 'cvsps.fuzz',
38 default=60,
38 default=60,
39 )
39 )
40 configitem('convert', 'cvsps.logencoding',
41 default=None,
42 )
40 configitem('convert', 'cvsps.mergefrom',
43 configitem('convert', 'cvsps.mergefrom',
41 default=None,
44 default=None,
42 )
45 )
43 configitem('convert', 'cvsps.mergeto',
46 configitem('convert', 'cvsps.mergeto',
44 default=None,
47 default=None,
45 )
48 )
46 configitem('convert', 'git.committeractions',
49 configitem('convert', 'git.committeractions',
47 default=lambda: ['messagedifferent'],
50 default=lambda: ['messagedifferent'],
48 )
51 )
49 configitem('convert', 'git.extrakeys',
52 configitem('convert', 'git.extrakeys',
50 default=list,
53 default=list,
51 )
54 )
52 configitem('convert', 'git.findcopiesharder',
55 configitem('convert', 'git.findcopiesharder',
53 default=False,
56 default=False,
54 )
57 )
55 configitem('convert', 'git.remoteprefix',
58 configitem('convert', 'git.remoteprefix',
56 default='remote',
59 default='remote',
57 )
60 )
58 configitem('convert', 'git.renamelimit',
61 configitem('convert', 'git.renamelimit',
59 default=400,
62 default=400,
60 )
63 )
61 configitem('convert', 'git.saverev',
64 configitem('convert', 'git.saverev',
62 default=True,
65 default=True,
63 )
66 )
64 configitem('convert', 'git.similarity',
67 configitem('convert', 'git.similarity',
65 default=50,
68 default=50,
66 )
69 )
67 configitem('convert', 'git.skipsubmodules',
70 configitem('convert', 'git.skipsubmodules',
68 default=False,
71 default=False,
69 )
72 )
70 configitem('convert', 'hg.clonebranches',
73 configitem('convert', 'hg.clonebranches',
71 default=False,
74 default=False,
72 )
75 )
73 configitem('convert', 'hg.ignoreerrors',
76 configitem('convert', 'hg.ignoreerrors',
74 default=False,
77 default=False,
75 )
78 )
76 configitem('convert', 'hg.revs',
79 configitem('convert', 'hg.revs',
77 default=None,
80 default=None,
78 )
81 )
79 configitem('convert', 'hg.saverev',
82 configitem('convert', 'hg.saverev',
80 default=False,
83 default=False,
81 )
84 )
82 configitem('convert', 'hg.sourcename',
85 configitem('convert', 'hg.sourcename',
83 default=None,
86 default=None,
84 )
87 )
85 configitem('convert', 'hg.startrev',
88 configitem('convert', 'hg.startrev',
86 default=None,
89 default=None,
87 )
90 )
88 configitem('convert', 'hg.tagsbranch',
91 configitem('convert', 'hg.tagsbranch',
89 default='default',
92 default='default',
90 )
93 )
91 configitem('convert', 'hg.usebranchnames',
94 configitem('convert', 'hg.usebranchnames',
92 default=True,
95 default=True,
93 )
96 )
94 configitem('convert', 'ignoreancestorcheck',
97 configitem('convert', 'ignoreancestorcheck',
95 default=False,
98 default=False,
96 )
99 )
97 configitem('convert', 'localtimezone',
100 configitem('convert', 'localtimezone',
98 default=False,
101 default=False,
99 )
102 )
100 configitem('convert', 'p4.encoding',
103 configitem('convert', 'p4.encoding',
101 default=lambda: convcmd.orig_encoding,
104 default=lambda: convcmd.orig_encoding,
102 )
105 )
103 configitem('convert', 'p4.startrev',
106 configitem('convert', 'p4.startrev',
104 default=0,
107 default=0,
105 )
108 )
106 configitem('convert', 'skiptags',
109 configitem('convert', 'skiptags',
107 default=False,
110 default=False,
108 )
111 )
109 configitem('convert', 'svn.debugsvnlog',
112 configitem('convert', 'svn.debugsvnlog',
110 default=True,
113 default=True,
111 )
114 )
112 configitem('convert', 'svn.startrev',
115 configitem('convert', 'svn.startrev',
113 default=0,
116 default=0,
114 )
117 )
115
118
116 # Commands definition was moved elsewhere to ease demandload job.
119 # Commands definition was moved elsewhere to ease demandload job.
117
120
118 @command('convert',
121 @command('convert',
119 [('', 'authors', '',
122 [('', 'authors', '',
120 _('username mapping filename (DEPRECATED) (use --authormap instead)'),
123 _('username mapping filename (DEPRECATED) (use --authormap instead)'),
121 _('FILE')),
124 _('FILE')),
122 ('s', 'source-type', '', _('source repository type'), _('TYPE')),
125 ('s', 'source-type', '', _('source repository type'), _('TYPE')),
123 ('d', 'dest-type', '', _('destination repository type'), _('TYPE')),
126 ('d', 'dest-type', '', _('destination repository type'), _('TYPE')),
124 ('r', 'rev', [], _('import up to source revision REV'), _('REV')),
127 ('r', 'rev', [], _('import up to source revision REV'), _('REV')),
125 ('A', 'authormap', '', _('remap usernames using this file'), _('FILE')),
128 ('A', 'authormap', '', _('remap usernames using this file'), _('FILE')),
126 ('', 'filemap', '', _('remap file names using contents of file'),
129 ('', 'filemap', '', _('remap file names using contents of file'),
127 _('FILE')),
130 _('FILE')),
128 ('', 'full', None,
131 ('', 'full', None,
129 _('apply filemap changes by converting all files again')),
132 _('apply filemap changes by converting all files again')),
130 ('', 'splicemap', '', _('splice synthesized history into place'),
133 ('', 'splicemap', '', _('splice synthesized history into place'),
131 _('FILE')),
134 _('FILE')),
132 ('', 'branchmap', '', _('change branch names while converting'),
135 ('', 'branchmap', '', _('change branch names while converting'),
133 _('FILE')),
136 _('FILE')),
134 ('', 'branchsort', None, _('try to sort changesets by branches')),
137 ('', 'branchsort', None, _('try to sort changesets by branches')),
135 ('', 'datesort', None, _('try to sort changesets by date')),
138 ('', 'datesort', None, _('try to sort changesets by date')),
136 ('', 'sourcesort', None, _('preserve source changesets order')),
139 ('', 'sourcesort', None, _('preserve source changesets order')),
137 ('', 'closesort', None, _('try to reorder closed revisions'))],
140 ('', 'closesort', None, _('try to reorder closed revisions'))],
138 _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]'),
141 _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]'),
139 norepo=True)
142 norepo=True)
140 def convert(ui, src, dest=None, revmapfile=None, **opts):
143 def convert(ui, src, dest=None, revmapfile=None, **opts):
141 """convert a foreign SCM repository to a Mercurial one.
144 """convert a foreign SCM repository to a Mercurial one.
142
145
143 Accepted source formats [identifiers]:
146 Accepted source formats [identifiers]:
144
147
145 - Mercurial [hg]
148 - Mercurial [hg]
146 - CVS [cvs]
149 - CVS [cvs]
147 - Darcs [darcs]
150 - Darcs [darcs]
148 - git [git]
151 - git [git]
149 - Subversion [svn]
152 - Subversion [svn]
150 - Monotone [mtn]
153 - Monotone [mtn]
151 - GNU Arch [gnuarch]
154 - GNU Arch [gnuarch]
152 - Bazaar [bzr]
155 - Bazaar [bzr]
153 - Perforce [p4]
156 - Perforce [p4]
154
157
155 Accepted destination formats [identifiers]:
158 Accepted destination formats [identifiers]:
156
159
157 - Mercurial [hg]
160 - Mercurial [hg]
158 - Subversion [svn] (history on branches is not preserved)
161 - Subversion [svn] (history on branches is not preserved)
159
162
160 If no revision is given, all revisions will be converted.
163 If no revision is given, all revisions will be converted.
161 Otherwise, convert will only import up to the named revision
164 Otherwise, convert will only import up to the named revision
162 (given in a format understood by the source).
165 (given in a format understood by the source).
163
166
164 If no destination directory name is specified, it defaults to the
167 If no destination directory name is specified, it defaults to the
165 basename of the source with ``-hg`` appended. If the destination
168 basename of the source with ``-hg`` appended. If the destination
166 repository doesn't exist, it will be created.
169 repository doesn't exist, it will be created.
167
170
168 By default, all sources except Mercurial will use --branchsort.
171 By default, all sources except Mercurial will use --branchsort.
169 Mercurial uses --sourcesort to preserve original revision numbers
172 Mercurial uses --sourcesort to preserve original revision numbers
170 order. Sort modes have the following effects:
173 order. Sort modes have the following effects:
171
174
172 --branchsort convert from parent to child revision when possible,
175 --branchsort convert from parent to child revision when possible,
173 which means branches are usually converted one after
176 which means branches are usually converted one after
174 the other. It generates more compact repositories.
177 the other. It generates more compact repositories.
175
178
176 --datesort sort revisions by date. Converted repositories have
179 --datesort sort revisions by date. Converted repositories have
177 good-looking changelogs but are often an order of
180 good-looking changelogs but are often an order of
178 magnitude larger than the same ones generated by
181 magnitude larger than the same ones generated by
179 --branchsort.
182 --branchsort.
180
183
181 --sourcesort try to preserve source revisions order, only
184 --sourcesort try to preserve source revisions order, only
182 supported by Mercurial sources.
185 supported by Mercurial sources.
183
186
184 --closesort try to move closed revisions as close as possible
187 --closesort try to move closed revisions as close as possible
185 to parent branches, only supported by Mercurial
188 to parent branches, only supported by Mercurial
186 sources.
189 sources.
187
190
188 If ``REVMAP`` isn't given, it will be put in a default location
191 If ``REVMAP`` isn't given, it will be put in a default location
189 (``<dest>/.hg/shamap`` by default). The ``REVMAP`` is a simple
192 (``<dest>/.hg/shamap`` by default). The ``REVMAP`` is a simple
190 text file that maps each source commit ID to the destination ID
193 text file that maps each source commit ID to the destination ID
191 for that revision, like so::
194 for that revision, like so::
192
195
193 <source ID> <destination ID>
196 <source ID> <destination ID>
194
197
195 If the file doesn't exist, it's automatically created. It's
198 If the file doesn't exist, it's automatically created. It's
196 updated on each commit copied, so :hg:`convert` can be interrupted
199 updated on each commit copied, so :hg:`convert` can be interrupted
197 and can be run repeatedly to copy new commits.
200 and can be run repeatedly to copy new commits.
198
201
199 The authormap is a simple text file that maps each source commit
202 The authormap is a simple text file that maps each source commit
200 author to a destination commit author. It is handy for source SCMs
203 author to a destination commit author. It is handy for source SCMs
201 that use unix logins to identify authors (e.g.: CVS). One line per
204 that use unix logins to identify authors (e.g.: CVS). One line per
202 author mapping and the line format is::
205 author mapping and the line format is::
203
206
204 source author = destination author
207 source author = destination author
205
208
206 Empty lines and lines starting with a ``#`` are ignored.
209 Empty lines and lines starting with a ``#`` are ignored.
207
210
208 The filemap is a file that allows filtering and remapping of files
211 The filemap is a file that allows filtering and remapping of files
209 and directories. Each line can contain one of the following
212 and directories. Each line can contain one of the following
210 directives::
213 directives::
211
214
212 include path/to/file-or-dir
215 include path/to/file-or-dir
213
216
214 exclude path/to/file-or-dir
217 exclude path/to/file-or-dir
215
218
216 rename path/to/source path/to/destination
219 rename path/to/source path/to/destination
217
220
218 Comment lines start with ``#``. A specified path matches if it
221 Comment lines start with ``#``. A specified path matches if it
219 equals the full relative name of a file or one of its parent
222 equals the full relative name of a file or one of its parent
220 directories. The ``include`` or ``exclude`` directive with the
223 directories. The ``include`` or ``exclude`` directive with the
221 longest matching path applies, so line order does not matter.
224 longest matching path applies, so line order does not matter.
222
225
223 The ``include`` directive causes a file, or all files under a
226 The ``include`` directive causes a file, or all files under a
224 directory, to be included in the destination repository. The default
227 directory, to be included in the destination repository. The default
225 if there are no ``include`` statements is to include everything.
228 if there are no ``include`` statements is to include everything.
226 If there are any ``include`` statements, nothing else is included.
229 If there are any ``include`` statements, nothing else is included.
227 The ``exclude`` directive causes files or directories to
230 The ``exclude`` directive causes files or directories to
228 be omitted. The ``rename`` directive renames a file or directory if
231 be omitted. The ``rename`` directive renames a file or directory if
229 it is converted. To rename from a subdirectory into the root of
232 it is converted. To rename from a subdirectory into the root of
230 the repository, use ``.`` as the path to rename to.
233 the repository, use ``.`` as the path to rename to.
231
234
232 ``--full`` will make sure the converted changesets contain exactly
235 ``--full`` will make sure the converted changesets contain exactly
233 the right files with the right content. It will make a full
236 the right files with the right content. It will make a full
234 conversion of all files, not just the ones that have
237 conversion of all files, not just the ones that have
235 changed. Files that already are correct will not be changed. This
238 changed. Files that already are correct will not be changed. This
236 can be used to apply filemap changes when converting
239 can be used to apply filemap changes when converting
237 incrementally. This is currently only supported for Mercurial and
240 incrementally. This is currently only supported for Mercurial and
238 Subversion.
241 Subversion.
239
242
240 The splicemap is a file that allows insertion of synthetic
243 The splicemap is a file that allows insertion of synthetic
241 history, letting you specify the parents of a revision. This is
244 history, letting you specify the parents of a revision. This is
242 useful if you want to e.g. give a Subversion merge two parents, or
245 useful if you want to e.g. give a Subversion merge two parents, or
243 graft two disconnected series of history together. Each entry
246 graft two disconnected series of history together. Each entry
244 contains a key, followed by a space, followed by one or two
247 contains a key, followed by a space, followed by one or two
245 comma-separated values::
248 comma-separated values::
246
249
247 key parent1, parent2
250 key parent1, parent2
248
251
249 The key is the revision ID in the source
252 The key is the revision ID in the source
250 revision control system whose parents should be modified (same
253 revision control system whose parents should be modified (same
251 format as a key in .hg/shamap). The values are the revision IDs
254 format as a key in .hg/shamap). The values are the revision IDs
252 (in either the source or destination revision control system) that
255 (in either the source or destination revision control system) that
253 should be used as the new parents for that node. For example, if
256 should be used as the new parents for that node. For example, if
254 you have merged "release-1.0" into "trunk", then you should
257 you have merged "release-1.0" into "trunk", then you should
255 specify the revision on "trunk" as the first parent and the one on
258 specify the revision on "trunk" as the first parent and the one on
256 the "release-1.0" branch as the second.
259 the "release-1.0" branch as the second.
257
260
258 The branchmap is a file that allows you to rename a branch when it is
261 The branchmap is a file that allows you to rename a branch when it is
259 being brought in from whatever external repository. When used in
262 being brought in from whatever external repository. When used in
260 conjunction with a splicemap, it allows for a powerful combination
263 conjunction with a splicemap, it allows for a powerful combination
261 to help fix even the most badly mismanaged repositories and turn them
264 to help fix even the most badly mismanaged repositories and turn them
262 into nicely structured Mercurial repositories. The branchmap contains
265 into nicely structured Mercurial repositories. The branchmap contains
263 lines of the form::
266 lines of the form::
264
267
265 original_branch_name new_branch_name
268 original_branch_name new_branch_name
266
269
267 where "original_branch_name" is the name of the branch in the
270 where "original_branch_name" is the name of the branch in the
268 source repository, and "new_branch_name" is the name of the branch
271 source repository, and "new_branch_name" is the name of the branch
269 is the destination repository. No whitespace is allowed in the new
272 is the destination repository. No whitespace is allowed in the new
270 branch name. This can be used to (for instance) move code in one
273 branch name. This can be used to (for instance) move code in one
271 repository from "default" to a named branch.
274 repository from "default" to a named branch.
272
275
273 Mercurial Source
276 Mercurial Source
274 ################
277 ################
275
278
276 The Mercurial source recognizes the following configuration
279 The Mercurial source recognizes the following configuration
277 options, which you can set on the command line with ``--config``:
280 options, which you can set on the command line with ``--config``:
278
281
279 :convert.hg.ignoreerrors: ignore integrity errors when reading.
282 :convert.hg.ignoreerrors: ignore integrity errors when reading.
280 Use it to fix Mercurial repositories with missing revlogs, by
283 Use it to fix Mercurial repositories with missing revlogs, by
281 converting from and to Mercurial. Default is False.
284 converting from and to Mercurial. Default is False.
282
285
283 :convert.hg.saverev: store original revision ID in changeset
286 :convert.hg.saverev: store original revision ID in changeset
284 (forces target IDs to change). It takes a boolean argument and
287 (forces target IDs to change). It takes a boolean argument and
285 defaults to False.
288 defaults to False.
286
289
287 :convert.hg.startrev: specify the initial Mercurial revision.
290 :convert.hg.startrev: specify the initial Mercurial revision.
288 The default is 0.
291 The default is 0.
289
292
290 :convert.hg.revs: revset specifying the source revisions to convert.
293 :convert.hg.revs: revset specifying the source revisions to convert.
291
294
292 CVS Source
295 CVS Source
293 ##########
296 ##########
294
297
295 CVS source will use a sandbox (i.e. a checked-out copy) from CVS
298 CVS source will use a sandbox (i.e. a checked-out copy) from CVS
296 to indicate the starting point of what will be converted. Direct
299 to indicate the starting point of what will be converted. Direct
297 access to the repository files is not needed, unless of course the
300 access to the repository files is not needed, unless of course the
298 repository is ``:local:``. The conversion uses the top level
301 repository is ``:local:``. The conversion uses the top level
299 directory in the sandbox to find the CVS repository, and then uses
302 directory in the sandbox to find the CVS repository, and then uses
300 CVS rlog commands to find files to convert. This means that unless
303 CVS rlog commands to find files to convert. This means that unless
301 a filemap is given, all files under the starting directory will be
304 a filemap is given, all files under the starting directory will be
302 converted, and that any directory reorganization in the CVS
305 converted, and that any directory reorganization in the CVS
303 sandbox is ignored.
306 sandbox is ignored.
304
307
305 The following options can be used with ``--config``:
308 The following options can be used with ``--config``:
306
309
307 :convert.cvsps.cache: Set to False to disable remote log caching,
310 :convert.cvsps.cache: Set to False to disable remote log caching,
308 for testing and debugging purposes. Default is True.
311 for testing and debugging purposes. Default is True.
309
312
310 :convert.cvsps.fuzz: Specify the maximum time (in seconds) that is
313 :convert.cvsps.fuzz: Specify the maximum time (in seconds) that is
311 allowed between commits with identical user and log message in
314 allowed between commits with identical user and log message in
312 a single changeset. When very large files were checked in as
315 a single changeset. When very large files were checked in as
313 part of a changeset then the default may not be long enough.
316 part of a changeset then the default may not be long enough.
314 The default is 60.
317 The default is 60.
315
318
316 :convert.cvsps.logencoding: Specify encoding name to be used for
319 :convert.cvsps.logencoding: Specify encoding name to be used for
317 transcoding CVS log messages. Multiple encoding names can be
320 transcoding CVS log messages. Multiple encoding names can be
318 specified as a list (see :hg:`help config.Syntax`), but only
321 specified as a list (see :hg:`help config.Syntax`), but only
319 the first acceptable encoding in the list is used per CVS log
322 the first acceptable encoding in the list is used per CVS log
320 entries. This transcoding is executed before cvslog hook below.
323 entries. This transcoding is executed before cvslog hook below.
321
324
322 :convert.cvsps.mergeto: Specify a regular expression to which
325 :convert.cvsps.mergeto: Specify a regular expression to which
323 commit log messages are matched. If a match occurs, then the
326 commit log messages are matched. If a match occurs, then the
324 conversion process will insert a dummy revision merging the
327 conversion process will insert a dummy revision merging the
325 branch on which this log message occurs to the branch
328 branch on which this log message occurs to the branch
326 indicated in the regex. Default is ``{{mergetobranch
329 indicated in the regex. Default is ``{{mergetobranch
327 ([-\\w]+)}}``
330 ([-\\w]+)}}``
328
331
329 :convert.cvsps.mergefrom: Specify a regular expression to which
332 :convert.cvsps.mergefrom: Specify a regular expression to which
330 commit log messages are matched. If a match occurs, then the
333 commit log messages are matched. If a match occurs, then the
331 conversion process will add the most recent revision on the
334 conversion process will add the most recent revision on the
332 branch indicated in the regex as the second parent of the
335 branch indicated in the regex as the second parent of the
333 changeset. Default is ``{{mergefrombranch ([-\\w]+)}}``
336 changeset. Default is ``{{mergefrombranch ([-\\w]+)}}``
334
337
335 :convert.localtimezone: use local time (as determined by the TZ
338 :convert.localtimezone: use local time (as determined by the TZ
336 environment variable) for changeset date/times. The default
339 environment variable) for changeset date/times. The default
337 is False (use UTC).
340 is False (use UTC).
338
341
339 :hooks.cvslog: Specify a Python function to be called at the end of
342 :hooks.cvslog: Specify a Python function to be called at the end of
340 gathering the CVS log. The function is passed a list with the
343 gathering the CVS log. The function is passed a list with the
341 log entries, and can modify the entries in-place, or add or
344 log entries, and can modify the entries in-place, or add or
342 delete them.
345 delete them.
343
346
344 :hooks.cvschangesets: Specify a Python function to be called after
347 :hooks.cvschangesets: Specify a Python function to be called after
345 the changesets are calculated from the CVS log. The
348 the changesets are calculated from the CVS log. The
346 function is passed a list with the changeset entries, and can
349 function is passed a list with the changeset entries, and can
347 modify the changesets in-place, or add or delete them.
350 modify the changesets in-place, or add or delete them.
348
351
349 An additional "debugcvsps" Mercurial command allows the builtin
352 An additional "debugcvsps" Mercurial command allows the builtin
350 changeset merging code to be run without doing a conversion. Its
353 changeset merging code to be run without doing a conversion. Its
351 parameters and output are similar to that of cvsps 2.1. Please see
354 parameters and output are similar to that of cvsps 2.1. Please see
352 the command help for more details.
355 the command help for more details.
353
356
354 Subversion Source
357 Subversion Source
355 #################
358 #################
356
359
357 Subversion source detects classical trunk/branches/tags layouts.
360 Subversion source detects classical trunk/branches/tags layouts.
358 By default, the supplied ``svn://repo/path/`` source URL is
361 By default, the supplied ``svn://repo/path/`` source URL is
359 converted as a single branch. If ``svn://repo/path/trunk`` exists
362 converted as a single branch. If ``svn://repo/path/trunk`` exists
360 it replaces the default branch. If ``svn://repo/path/branches``
363 it replaces the default branch. If ``svn://repo/path/branches``
361 exists, its subdirectories are listed as possible branches. If
364 exists, its subdirectories are listed as possible branches. If
362 ``svn://repo/path/tags`` exists, it is looked for tags referencing
365 ``svn://repo/path/tags`` exists, it is looked for tags referencing
363 converted branches. Default ``trunk``, ``branches`` and ``tags``
366 converted branches. Default ``trunk``, ``branches`` and ``tags``
364 values can be overridden with following options. Set them to paths
367 values can be overridden with following options. Set them to paths
365 relative to the source URL, or leave them blank to disable auto
368 relative to the source URL, or leave them blank to disable auto
366 detection.
369 detection.
367
370
368 The following options can be set with ``--config``:
371 The following options can be set with ``--config``:
369
372
370 :convert.svn.branches: specify the directory containing branches.
373 :convert.svn.branches: specify the directory containing branches.
371 The default is ``branches``.
374 The default is ``branches``.
372
375
373 :convert.svn.tags: specify the directory containing tags. The
376 :convert.svn.tags: specify the directory containing tags. The
374 default is ``tags``.
377 default is ``tags``.
375
378
376 :convert.svn.trunk: specify the name of the trunk branch. The
379 :convert.svn.trunk: specify the name of the trunk branch. The
377 default is ``trunk``.
380 default is ``trunk``.
378
381
379 :convert.localtimezone: use local time (as determined by the TZ
382 :convert.localtimezone: use local time (as determined by the TZ
380 environment variable) for changeset date/times. The default
383 environment variable) for changeset date/times. The default
381 is False (use UTC).
384 is False (use UTC).
382
385
383 Source history can be retrieved starting at a specific revision,
386 Source history can be retrieved starting at a specific revision,
384 instead of being integrally converted. Only single branch
387 instead of being integrally converted. Only single branch
385 conversions are supported.
388 conversions are supported.
386
389
387 :convert.svn.startrev: specify start Subversion revision number.
390 :convert.svn.startrev: specify start Subversion revision number.
388 The default is 0.
391 The default is 0.
389
392
390 Git Source
393 Git Source
391 ##########
394 ##########
392
395
393 The Git importer converts commits from all reachable branches (refs
396 The Git importer converts commits from all reachable branches (refs
394 in refs/heads) and remotes (refs in refs/remotes) to Mercurial.
397 in refs/heads) and remotes (refs in refs/remotes) to Mercurial.
395 Branches are converted to bookmarks with the same name, with the
398 Branches are converted to bookmarks with the same name, with the
396 leading 'refs/heads' stripped. Git submodules are converted to Git
399 leading 'refs/heads' stripped. Git submodules are converted to Git
397 subrepos in Mercurial.
400 subrepos in Mercurial.
398
401
399 The following options can be set with ``--config``:
402 The following options can be set with ``--config``:
400
403
401 :convert.git.similarity: specify how similar files modified in a
404 :convert.git.similarity: specify how similar files modified in a
402 commit must be to be imported as renames or copies, as a
405 commit must be to be imported as renames or copies, as a
403 percentage between ``0`` (disabled) and ``100`` (files must be
406 percentage between ``0`` (disabled) and ``100`` (files must be
404 identical). For example, ``90`` means that a delete/add pair will
407 identical). For example, ``90`` means that a delete/add pair will
405 be imported as a rename if more than 90% of the file hasn't
408 be imported as a rename if more than 90% of the file hasn't
406 changed. The default is ``50``.
409 changed. The default is ``50``.
407
410
408 :convert.git.findcopiesharder: while detecting copies, look at all
411 :convert.git.findcopiesharder: while detecting copies, look at all
409 files in the working copy instead of just changed ones. This
412 files in the working copy instead of just changed ones. This
410 is very expensive for large projects, and is only effective when
413 is very expensive for large projects, and is only effective when
411 ``convert.git.similarity`` is greater than 0. The default is False.
414 ``convert.git.similarity`` is greater than 0. The default is False.
412
415
413 :convert.git.renamelimit: perform rename and copy detection up to this
416 :convert.git.renamelimit: perform rename and copy detection up to this
414 many changed files in a commit. Increasing this will make rename
417 many changed files in a commit. Increasing this will make rename
415 and copy detection more accurate but will significantly slow down
418 and copy detection more accurate but will significantly slow down
416 computation on large projects. The option is only relevant if
419 computation on large projects. The option is only relevant if
417 ``convert.git.similarity`` is greater than 0. The default is
420 ``convert.git.similarity`` is greater than 0. The default is
418 ``400``.
421 ``400``.
419
422
420 :convert.git.committeractions: list of actions to take when processing
423 :convert.git.committeractions: list of actions to take when processing
421 author and committer values.
424 author and committer values.
422
425
423 Git commits have separate author (who wrote the commit) and committer
426 Git commits have separate author (who wrote the commit) and committer
424 (who applied the commit) fields. Not all destinations support separate
427 (who applied the commit) fields. Not all destinations support separate
425 author and committer fields (including Mercurial). This config option
428 author and committer fields (including Mercurial). This config option
426 controls what to do with these author and committer fields during
429 controls what to do with these author and committer fields during
427 conversion.
430 conversion.
428
431
429 A value of ``messagedifferent`` will append a ``committer: ...``
432 A value of ``messagedifferent`` will append a ``committer: ...``
430 line to the commit message if the Git committer is different from the
433 line to the commit message if the Git committer is different from the
431 author. The prefix of that line can be specified using the syntax
434 author. The prefix of that line can be specified using the syntax
432 ``messagedifferent=<prefix>``. e.g. ``messagedifferent=git-committer:``.
435 ``messagedifferent=<prefix>``. e.g. ``messagedifferent=git-committer:``.
433 When a prefix is specified, a space will always be inserted between the
436 When a prefix is specified, a space will always be inserted between the
434 prefix and the value.
437 prefix and the value.
435
438
436 ``messagealways`` behaves like ``messagedifferent`` except it will
439 ``messagealways`` behaves like ``messagedifferent`` except it will
437 always result in a ``committer: ...`` line being appended to the commit
440 always result in a ``committer: ...`` line being appended to the commit
438 message. This value is mutually exclusive with ``messagedifferent``.
441 message. This value is mutually exclusive with ``messagedifferent``.
439
442
440 ``dropcommitter`` will remove references to the committer. Only
443 ``dropcommitter`` will remove references to the committer. Only
441 references to the author will remain. Actions that add references
444 references to the author will remain. Actions that add references
442 to the committer will have no effect when this is set.
445 to the committer will have no effect when this is set.
443
446
444 ``replaceauthor`` will replace the value of the author field with
447 ``replaceauthor`` will replace the value of the author field with
445 the committer. Other actions that add references to the committer
448 the committer. Other actions that add references to the committer
446 will still take effect when this is set.
449 will still take effect when this is set.
447
450
448 The default is ``messagedifferent``.
451 The default is ``messagedifferent``.
449
452
450 :convert.git.extrakeys: list of extra keys from commit metadata to copy to
453 :convert.git.extrakeys: list of extra keys from commit metadata to copy to
451 the destination. Some Git repositories store extra metadata in commits.
454 the destination. Some Git repositories store extra metadata in commits.
452 By default, this non-default metadata will be lost during conversion.
455 By default, this non-default metadata will be lost during conversion.
453 Setting this config option can retain that metadata. Some built-in
456 Setting this config option can retain that metadata. Some built-in
454 keys such as ``parent`` and ``branch`` are not allowed to be copied.
457 keys such as ``parent`` and ``branch`` are not allowed to be copied.
455
458
456 :convert.git.remoteprefix: remote refs are converted as bookmarks with
459 :convert.git.remoteprefix: remote refs are converted as bookmarks with
457 ``convert.git.remoteprefix`` as a prefix followed by a /. The default
460 ``convert.git.remoteprefix`` as a prefix followed by a /. The default
458 is 'remote'.
461 is 'remote'.
459
462
460 :convert.git.saverev: whether to store the original Git commit ID in the
463 :convert.git.saverev: whether to store the original Git commit ID in the
461 metadata of the destination commit. The default is True.
464 metadata of the destination commit. The default is True.
462
465
463 :convert.git.skipsubmodules: does not convert root level .gitmodules files
466 :convert.git.skipsubmodules: does not convert root level .gitmodules files
464 or files with 160000 mode indicating a submodule. Default is False.
467 or files with 160000 mode indicating a submodule. Default is False.
465
468
466 Perforce Source
469 Perforce Source
467 ###############
470 ###############
468
471
469 The Perforce (P4) importer can be given a p4 depot path or a
472 The Perforce (P4) importer can be given a p4 depot path or a
470 client specification as source. It will convert all files in the
473 client specification as source. It will convert all files in the
471 source to a flat Mercurial repository, ignoring labels, branches
474 source to a flat Mercurial repository, ignoring labels, branches
472 and integrations. Note that when a depot path is given you then
475 and integrations. Note that when a depot path is given you then
473 usually should specify a target directory, because otherwise the
476 usually should specify a target directory, because otherwise the
474 target may be named ``...-hg``.
477 target may be named ``...-hg``.
475
478
476 The following options can be set with ``--config``:
479 The following options can be set with ``--config``:
477
480
478 :convert.p4.encoding: specify the encoding to use when decoding standard
481 :convert.p4.encoding: specify the encoding to use when decoding standard
479 output of the Perforce command line tool. The default is default system
482 output of the Perforce command line tool. The default is default system
480 encoding.
483 encoding.
481
484
482 :convert.p4.startrev: specify initial Perforce revision (a
485 :convert.p4.startrev: specify initial Perforce revision (a
483 Perforce changelist number).
486 Perforce changelist number).
484
487
485 Mercurial Destination
488 Mercurial Destination
486 #####################
489 #####################
487
490
488 The Mercurial destination will recognize Mercurial subrepositories in the
491 The Mercurial destination will recognize Mercurial subrepositories in the
489 destination directory, and update the .hgsubstate file automatically if the
492 destination directory, and update the .hgsubstate file automatically if the
490 destination subrepositories contain the <dest>/<sub>/.hg/shamap file.
493 destination subrepositories contain the <dest>/<sub>/.hg/shamap file.
491 Converting a repository with subrepositories requires converting a single
494 Converting a repository with subrepositories requires converting a single
492 repository at a time, from the bottom up.
495 repository at a time, from the bottom up.
493
496
494 .. container:: verbose
497 .. container:: verbose
495
498
496 An example showing how to convert a repository with subrepositories::
499 An example showing how to convert a repository with subrepositories::
497
500
498 # so convert knows the type when it sees a non empty destination
501 # so convert knows the type when it sees a non empty destination
499 $ hg init converted
502 $ hg init converted
500
503
501 $ hg convert orig/sub1 converted/sub1
504 $ hg convert orig/sub1 converted/sub1
502 $ hg convert orig/sub2 converted/sub2
505 $ hg convert orig/sub2 converted/sub2
503 $ hg convert orig converted
506 $ hg convert orig converted
504
507
505 The following options are supported:
508 The following options are supported:
506
509
507 :convert.hg.clonebranches: dispatch source branches in separate
510 :convert.hg.clonebranches: dispatch source branches in separate
508 clones. The default is False.
511 clones. The default is False.
509
512
510 :convert.hg.tagsbranch: branch name for tag revisions, defaults to
513 :convert.hg.tagsbranch: branch name for tag revisions, defaults to
511 ``default``.
514 ``default``.
512
515
513 :convert.hg.usebranchnames: preserve branch names. The default is
516 :convert.hg.usebranchnames: preserve branch names. The default is
514 True.
517 True.
515
518
516 :convert.hg.sourcename: records the given string as a 'convert_source' extra
519 :convert.hg.sourcename: records the given string as a 'convert_source' extra
517 value on each commit made in the target repository. The default is None.
520 value on each commit made in the target repository. The default is None.
518
521
519 All Destinations
522 All Destinations
520 ################
523 ################
521
524
522 All destination types accept the following options:
525 All destination types accept the following options:
523
526
524 :convert.skiptags: does not convert tags from the source repo to the target
527 :convert.skiptags: does not convert tags from the source repo to the target
525 repo. The default is False.
528 repo. The default is False.
526 """
529 """
527 return convcmd.convert(ui, src, dest, revmapfile, **opts)
530 return convcmd.convert(ui, src, dest, revmapfile, **opts)
528
531
529 @command('debugsvnlog', [], 'hg debugsvnlog', norepo=True)
532 @command('debugsvnlog', [], 'hg debugsvnlog', norepo=True)
530 def debugsvnlog(ui, **opts):
533 def debugsvnlog(ui, **opts):
531 return subversion.debugsvnlog(ui, **opts)
534 return subversion.debugsvnlog(ui, **opts)
532
535
533 @command('debugcvsps',
536 @command('debugcvsps',
534 [
537 [
535 # Main options shared with cvsps-2.1
538 # Main options shared with cvsps-2.1
536 ('b', 'branches', [], _('only return changes on specified branches')),
539 ('b', 'branches', [], _('only return changes on specified branches')),
537 ('p', 'prefix', '', _('prefix to remove from file names')),
540 ('p', 'prefix', '', _('prefix to remove from file names')),
538 ('r', 'revisions', [],
541 ('r', 'revisions', [],
539 _('only return changes after or between specified tags')),
542 _('only return changes after or between specified tags')),
540 ('u', 'update-cache', None, _("update cvs log cache")),
543 ('u', 'update-cache', None, _("update cvs log cache")),
541 ('x', 'new-cache', None, _("create new cvs log cache")),
544 ('x', 'new-cache', None, _("create new cvs log cache")),
542 ('z', 'fuzz', 60, _('set commit time fuzz in seconds')),
545 ('z', 'fuzz', 60, _('set commit time fuzz in seconds')),
543 ('', 'root', '', _('specify cvsroot')),
546 ('', 'root', '', _('specify cvsroot')),
544 # Options specific to builtin cvsps
547 # Options specific to builtin cvsps
545 ('', 'parents', '', _('show parent changesets')),
548 ('', 'parents', '', _('show parent changesets')),
546 ('', 'ancestors', '', _('show current changeset in ancestor branches')),
549 ('', 'ancestors', '', _('show current changeset in ancestor branches')),
547 # Options that are ignored for compatibility with cvsps-2.1
550 # Options that are ignored for compatibility with cvsps-2.1
548 ('A', 'cvs-direct', None, _('ignored for compatibility')),
551 ('A', 'cvs-direct', None, _('ignored for compatibility')),
549 ],
552 ],
550 _('hg debugcvsps [OPTION]... [PATH]...'),
553 _('hg debugcvsps [OPTION]... [PATH]...'),
551 norepo=True)
554 norepo=True)
552 def debugcvsps(ui, *args, **opts):
555 def debugcvsps(ui, *args, **opts):
553 '''create changeset information from CVS
556 '''create changeset information from CVS
554
557
555 This command is intended as a debugging tool for the CVS to
558 This command is intended as a debugging tool for the CVS to
556 Mercurial converter, and can be used as a direct replacement for
559 Mercurial converter, and can be used as a direct replacement for
557 cvsps.
560 cvsps.
558
561
559 Hg debugcvsps reads the CVS rlog for current directory (or any
562 Hg debugcvsps reads the CVS rlog for current directory (or any
560 named directory) in the CVS repository, and converts the log to a
563 named directory) in the CVS repository, and converts the log to a
561 series of changesets based on matching commit log entries and
564 series of changesets based on matching commit log entries and
562 dates.'''
565 dates.'''
563 return cvsps.debugcvsps(ui, *args, **opts)
566 return cvsps.debugcvsps(ui, *args, **opts)
564
567
565 def kwconverted(ctx, name):
568 def kwconverted(ctx, name):
566 rev = ctx.extra().get('convert_revision', '')
569 rev = ctx.extra().get('convert_revision', '')
567 if rev.startswith('svn:'):
570 if rev.startswith('svn:'):
568 if name == 'svnrev':
571 if name == 'svnrev':
569 return str(subversion.revsplit(rev)[2])
572 return str(subversion.revsplit(rev)[2])
570 elif name == 'svnpath':
573 elif name == 'svnpath':
571 return subversion.revsplit(rev)[1]
574 return subversion.revsplit(rev)[1]
572 elif name == 'svnuuid':
575 elif name == 'svnuuid':
573 return subversion.revsplit(rev)[0]
576 return subversion.revsplit(rev)[0]
574 return rev
577 return rev
575
578
576 templatekeyword = registrar.templatekeyword()
579 templatekeyword = registrar.templatekeyword()
577
580
578 @templatekeyword('svnrev')
581 @templatekeyword('svnrev')
579 def kwsvnrev(repo, ctx, **args):
582 def kwsvnrev(repo, ctx, **args):
580 """String. Converted subversion revision number."""
583 """String. Converted subversion revision number."""
581 return kwconverted(ctx, 'svnrev')
584 return kwconverted(ctx, 'svnrev')
582
585
583 @templatekeyword('svnpath')
586 @templatekeyword('svnpath')
584 def kwsvnpath(repo, ctx, **args):
587 def kwsvnpath(repo, ctx, **args):
585 """String. Converted subversion revision project path."""
588 """String. Converted subversion revision project path."""
586 return kwconverted(ctx, 'svnpath')
589 return kwconverted(ctx, 'svnpath')
587
590
588 @templatekeyword('svnuuid')
591 @templatekeyword('svnuuid')
589 def kwsvnuuid(repo, ctx, **args):
592 def kwsvnuuid(repo, ctx, **args):
590 """String. Converted subversion revision repository identifier."""
593 """String. Converted subversion revision repository identifier."""
591 return kwconverted(ctx, 'svnuuid')
594 return kwconverted(ctx, 'svnuuid')
592
595
593 # tell hggettext to extract docstrings from these functions:
596 # tell hggettext to extract docstrings from these functions:
594 i18nfunctions = [kwsvnrev, kwsvnpath, kwsvnuuid]
597 i18nfunctions = [kwsvnrev, kwsvnpath, kwsvnuuid]
General Comments 0
You need to be logged in to leave comments. Login now