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