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