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