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