##// END OF EJS Templates
convert: more clear documentation of the 'include' default of a 'include .'...
Mads Kiilerich -
r20784:7f4cf938 stable
parent child Browse files
Show More
@@ -1,382 +1,383 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 import convcmd
10 import convcmd
11 import cvsps
11 import cvsps
12 import subversion
12 import subversion
13 from mercurial import commands, templatekw
13 from mercurial import commands, templatekw
14 from mercurial.i18n import _
14 from mercurial.i18n import _
15
15
16 testedwith = 'internal'
16 testedwith = 'internal'
17
17
18 # Commands definition was moved elsewhere to ease demandload job.
18 # Commands definition was moved elsewhere to ease demandload job.
19
19
20 def convert(ui, src, dest=None, revmapfile=None, **opts):
20 def convert(ui, src, dest=None, revmapfile=None, **opts):
21 """convert a foreign SCM repository to a Mercurial one.
21 """convert a foreign SCM repository to a Mercurial one.
22
22
23 Accepted source formats [identifiers]:
23 Accepted source formats [identifiers]:
24
24
25 - Mercurial [hg]
25 - Mercurial [hg]
26 - CVS [cvs]
26 - CVS [cvs]
27 - Darcs [darcs]
27 - Darcs [darcs]
28 - git [git]
28 - git [git]
29 - Subversion [svn]
29 - Subversion [svn]
30 - Monotone [mtn]
30 - Monotone [mtn]
31 - GNU Arch [gnuarch]
31 - GNU Arch [gnuarch]
32 - Bazaar [bzr]
32 - Bazaar [bzr]
33 - Perforce [p4]
33 - Perforce [p4]
34
34
35 Accepted destination formats [identifiers]:
35 Accepted destination formats [identifiers]:
36
36
37 - Mercurial [hg]
37 - Mercurial [hg]
38 - Subversion [svn] (history on branches is not preserved)
38 - Subversion [svn] (history on branches is not preserved)
39
39
40 If no revision is given, all revisions will be converted.
40 If no revision is given, all revisions will be converted.
41 Otherwise, convert will only import up to the named revision
41 Otherwise, convert will only import up to the named revision
42 (given in a format understood by the source).
42 (given in a format understood by the source).
43
43
44 If no destination directory name is specified, it defaults to the
44 If no destination directory name is specified, it defaults to the
45 basename of the source with ``-hg`` appended. If the destination
45 basename of the source with ``-hg`` appended. If the destination
46 repository doesn't exist, it will be created.
46 repository doesn't exist, it will be created.
47
47
48 By default, all sources except Mercurial will use --branchsort.
48 By default, all sources except Mercurial will use --branchsort.
49 Mercurial uses --sourcesort to preserve original revision numbers
49 Mercurial uses --sourcesort to preserve original revision numbers
50 order. Sort modes have the following effects:
50 order. Sort modes have the following effects:
51
51
52 --branchsort convert from parent to child revision when possible,
52 --branchsort convert from parent to child revision when possible,
53 which means branches are usually converted one after
53 which means branches are usually converted one after
54 the other. It generates more compact repositories.
54 the other. It generates more compact repositories.
55
55
56 --datesort sort revisions by date. Converted repositories have
56 --datesort sort revisions by date. Converted repositories have
57 good-looking changelogs but are often an order of
57 good-looking changelogs but are often an order of
58 magnitude larger than the same ones generated by
58 magnitude larger than the same ones generated by
59 --branchsort.
59 --branchsort.
60
60
61 --sourcesort try to preserve source revisions order, only
61 --sourcesort try to preserve source revisions order, only
62 supported by Mercurial sources.
62 supported by Mercurial sources.
63
63
64 --closesort try to move closed revisions as close as possible
64 --closesort try to move closed revisions as close as possible
65 to parent branches, only supported by Mercurial
65 to parent branches, only supported by Mercurial
66 sources.
66 sources.
67
67
68 If ``REVMAP`` isn't given, it will be put in a default location
68 If ``REVMAP`` isn't given, it will be put in a default location
69 (``<dest>/.hg/shamap`` by default). The ``REVMAP`` is a simple
69 (``<dest>/.hg/shamap`` by default). The ``REVMAP`` is a simple
70 text file that maps each source commit ID to the destination ID
70 text file that maps each source commit ID to the destination ID
71 for that revision, like so::
71 for that revision, like so::
72
72
73 <source ID> <destination ID>
73 <source ID> <destination ID>
74
74
75 If the file doesn't exist, it's automatically created. It's
75 If the file doesn't exist, it's automatically created. It's
76 updated on each commit copied, so :hg:`convert` can be interrupted
76 updated on each commit copied, so :hg:`convert` can be interrupted
77 and can be run repeatedly to copy new commits.
77 and can be run repeatedly to copy new commits.
78
78
79 The authormap is a simple text file that maps each source commit
79 The authormap is a simple text file that maps each source commit
80 author to a destination commit author. It is handy for source SCMs
80 author to a destination commit author. It is handy for source SCMs
81 that use unix logins to identify authors (e.g.: CVS). One line per
81 that use unix logins to identify authors (e.g.: CVS). One line per
82 author mapping and the line format is::
82 author mapping and the line format is::
83
83
84 source author = destination author
84 source author = destination author
85
85
86 Empty lines and lines starting with a ``#`` are ignored.
86 Empty lines and lines starting with a ``#`` are ignored.
87
87
88 The filemap is a file that allows filtering and remapping of files
88 The filemap is a file that allows filtering and remapping of files
89 and directories. Each line can contain one of the following
89 and directories. Each line can contain one of the following
90 directives::
90 directives::
91
91
92 include path/to/file-or-dir
92 include path/to/file-or-dir
93
93
94 exclude path/to/file-or-dir
94 exclude path/to/file-or-dir
95
95
96 rename path/to/source path/to/destination
96 rename path/to/source path/to/destination
97
97
98 Comment lines start with ``#``. A specified path matches if it
98 Comment lines start with ``#``. A specified path matches if it
99 equals the full relative name of a file or one of its parent
99 equals the full relative name of a file or one of its parent
100 directories. The ``include`` or ``exclude`` directive with the
100 directories. The ``include`` or ``exclude`` directive with the
101 longest matching path applies, so line order does not matter.
101 longest matching path applies, so line order does not matter.
102
102
103 The ``include`` directive causes a file, or all files under a
103 The ``include`` directive causes a file, or all files under a
104 directory, to be included in the destination repository, and the
104 directory, to be included in the destination repository. The default
105 exclusion of all other files and directories not explicitly
105 if there are no ``include`` statements is to include everything.
106 included. The ``exclude`` directive causes files or directories to
106 If there are any ``include`` statements, nothing else is included.
107 The ``exclude`` directive causes files or directories to
107 be omitted. The ``rename`` directive renames a file or directory if
108 be omitted. The ``rename`` directive renames a file or directory if
108 it is converted. To rename from a subdirectory into the root of
109 it is converted. To rename from a subdirectory into the root of
109 the repository, use ``.`` as the path to rename to.
110 the repository, use ``.`` as the path to rename to.
110
111
111 The splicemap is a file that allows insertion of synthetic
112 The splicemap is a file that allows insertion of synthetic
112 history, letting you specify the parents of a revision. This is
113 history, letting you specify the parents of a revision. This is
113 useful if you want to e.g. give a Subversion merge two parents, or
114 useful if you want to e.g. give a Subversion merge two parents, or
114 graft two disconnected series of history together. Each entry
115 graft two disconnected series of history together. Each entry
115 contains a key, followed by a space, followed by one or two
116 contains a key, followed by a space, followed by one or two
116 comma-separated values::
117 comma-separated values::
117
118
118 key parent1, parent2
119 key parent1, parent2
119
120
120 The key is the revision ID in the source
121 The key is the revision ID in the source
121 revision control system whose parents should be modified (same
122 revision control system whose parents should be modified (same
122 format as a key in .hg/shamap). The values are the revision IDs
123 format as a key in .hg/shamap). The values are the revision IDs
123 (in either the source or destination revision control system) that
124 (in either the source or destination revision control system) that
124 should be used as the new parents for that node. For example, if
125 should be used as the new parents for that node. For example, if
125 you have merged "release-1.0" into "trunk", then you should
126 you have merged "release-1.0" into "trunk", then you should
126 specify the revision on "trunk" as the first parent and the one on
127 specify the revision on "trunk" as the first parent and the one on
127 the "release-1.0" branch as the second.
128 the "release-1.0" branch as the second.
128
129
129 The branchmap is a file that allows you to rename a branch when it is
130 The branchmap is a file that allows you to rename a branch when it is
130 being brought in from whatever external repository. When used in
131 being brought in from whatever external repository. When used in
131 conjunction with a splicemap, it allows for a powerful combination
132 conjunction with a splicemap, it allows for a powerful combination
132 to help fix even the most badly mismanaged repositories and turn them
133 to help fix even the most badly mismanaged repositories and turn them
133 into nicely structured Mercurial repositories. The branchmap contains
134 into nicely structured Mercurial repositories. The branchmap contains
134 lines of the form::
135 lines of the form::
135
136
136 original_branch_name new_branch_name
137 original_branch_name new_branch_name
137
138
138 where "original_branch_name" is the name of the branch in the
139 where "original_branch_name" is the name of the branch in the
139 source repository, and "new_branch_name" is the name of the branch
140 source repository, and "new_branch_name" is the name of the branch
140 is the destination repository. No whitespace is allowed in the
141 is the destination repository. No whitespace is allowed in the
141 branch names. This can be used to (for instance) move code in one
142 branch names. This can be used to (for instance) move code in one
142 repository from "default" to a named branch.
143 repository from "default" to a named branch.
143
144
144 Mercurial Source
145 Mercurial Source
145 ################
146 ################
146
147
147 The Mercurial source recognizes the following configuration
148 The Mercurial source recognizes the following configuration
148 options, which you can set on the command line with ``--config``:
149 options, which you can set on the command line with ``--config``:
149
150
150 :convert.hg.ignoreerrors: ignore integrity errors when reading.
151 :convert.hg.ignoreerrors: ignore integrity errors when reading.
151 Use it to fix Mercurial repositories with missing revlogs, by
152 Use it to fix Mercurial repositories with missing revlogs, by
152 converting from and to Mercurial. Default is False.
153 converting from and to Mercurial. Default is False.
153
154
154 :convert.hg.saverev: store original revision ID in changeset
155 :convert.hg.saverev: store original revision ID in changeset
155 (forces target IDs to change). It takes a boolean argument and
156 (forces target IDs to change). It takes a boolean argument and
156 defaults to False.
157 defaults to False.
157
158
158 :convert.hg.revs: revset specifying the source revisions to convert.
159 :convert.hg.revs: revset specifying the source revisions to convert.
159
160
160 CVS Source
161 CVS Source
161 ##########
162 ##########
162
163
163 CVS source will use a sandbox (i.e. a checked-out copy) from CVS
164 CVS source will use a sandbox (i.e. a checked-out copy) from CVS
164 to indicate the starting point of what will be converted. Direct
165 to indicate the starting point of what will be converted. Direct
165 access to the repository files is not needed, unless of course the
166 access to the repository files is not needed, unless of course the
166 repository is ``:local:``. The conversion uses the top level
167 repository is ``:local:``. The conversion uses the top level
167 directory in the sandbox to find the CVS repository, and then uses
168 directory in the sandbox to find the CVS repository, and then uses
168 CVS rlog commands to find files to convert. This means that unless
169 CVS rlog commands to find files to convert. This means that unless
169 a filemap is given, all files under the starting directory will be
170 a filemap is given, all files under the starting directory will be
170 converted, and that any directory reorganization in the CVS
171 converted, and that any directory reorganization in the CVS
171 sandbox is ignored.
172 sandbox is ignored.
172
173
173 The following options can be used with ``--config``:
174 The following options can be used with ``--config``:
174
175
175 :convert.cvsps.cache: Set to False to disable remote log caching,
176 :convert.cvsps.cache: Set to False to disable remote log caching,
176 for testing and debugging purposes. Default is True.
177 for testing and debugging purposes. Default is True.
177
178
178 :convert.cvsps.fuzz: Specify the maximum time (in seconds) that is
179 :convert.cvsps.fuzz: Specify the maximum time (in seconds) that is
179 allowed between commits with identical user and log message in
180 allowed between commits with identical user and log message in
180 a single changeset. When very large files were checked in as
181 a single changeset. When very large files were checked in as
181 part of a changeset then the default may not be long enough.
182 part of a changeset then the default may not be long enough.
182 The default is 60.
183 The default is 60.
183
184
184 :convert.cvsps.mergeto: Specify a regular expression to which
185 :convert.cvsps.mergeto: Specify a regular expression to which
185 commit log messages are matched. If a match occurs, then the
186 commit log messages are matched. If a match occurs, then the
186 conversion process will insert a dummy revision merging the
187 conversion process will insert a dummy revision merging the
187 branch on which this log message occurs to the branch
188 branch on which this log message occurs to the branch
188 indicated in the regex. Default is ``{{mergetobranch
189 indicated in the regex. Default is ``{{mergetobranch
189 ([-\\w]+)}}``
190 ([-\\w]+)}}``
190
191
191 :convert.cvsps.mergefrom: Specify a regular expression to which
192 :convert.cvsps.mergefrom: Specify a regular expression to which
192 commit log messages are matched. If a match occurs, then the
193 commit log messages are matched. If a match occurs, then the
193 conversion process will add the most recent revision on the
194 conversion process will add the most recent revision on the
194 branch indicated in the regex as the second parent of the
195 branch indicated in the regex as the second parent of the
195 changeset. Default is ``{{mergefrombranch ([-\\w]+)}}``
196 changeset. Default is ``{{mergefrombranch ([-\\w]+)}}``
196
197
197 :convert.localtimezone: use local time (as determined by the TZ
198 :convert.localtimezone: use local time (as determined by the TZ
198 environment variable) for changeset date/times. The default
199 environment variable) for changeset date/times. The default
199 is False (use UTC).
200 is False (use UTC).
200
201
201 :hooks.cvslog: Specify a Python function to be called at the end of
202 :hooks.cvslog: Specify a Python function to be called at the end of
202 gathering the CVS log. The function is passed a list with the
203 gathering the CVS log. The function is passed a list with the
203 log entries, and can modify the entries in-place, or add or
204 log entries, and can modify the entries in-place, or add or
204 delete them.
205 delete them.
205
206
206 :hooks.cvschangesets: Specify a Python function to be called after
207 :hooks.cvschangesets: Specify a Python function to be called after
207 the changesets are calculated from the CVS log. The
208 the changesets are calculated from the CVS log. The
208 function is passed a list with the changeset entries, and can
209 function is passed a list with the changeset entries, and can
209 modify the changesets in-place, or add or delete them.
210 modify the changesets in-place, or add or delete them.
210
211
211 An additional "debugcvsps" Mercurial command allows the builtin
212 An additional "debugcvsps" Mercurial command allows the builtin
212 changeset merging code to be run without doing a conversion. Its
213 changeset merging code to be run without doing a conversion. Its
213 parameters and output are similar to that of cvsps 2.1. Please see
214 parameters and output are similar to that of cvsps 2.1. Please see
214 the command help for more details.
215 the command help for more details.
215
216
216 Subversion Source
217 Subversion Source
217 #################
218 #################
218
219
219 Subversion source detects classical trunk/branches/tags layouts.
220 Subversion source detects classical trunk/branches/tags layouts.
220 By default, the supplied ``svn://repo/path/`` source URL is
221 By default, the supplied ``svn://repo/path/`` source URL is
221 converted as a single branch. If ``svn://repo/path/trunk`` exists
222 converted as a single branch. If ``svn://repo/path/trunk`` exists
222 it replaces the default branch. If ``svn://repo/path/branches``
223 it replaces the default branch. If ``svn://repo/path/branches``
223 exists, its subdirectories are listed as possible branches. If
224 exists, its subdirectories are listed as possible branches. If
224 ``svn://repo/path/tags`` exists, it is looked for tags referencing
225 ``svn://repo/path/tags`` exists, it is looked for tags referencing
225 converted branches. Default ``trunk``, ``branches`` and ``tags``
226 converted branches. Default ``trunk``, ``branches`` and ``tags``
226 values can be overridden with following options. Set them to paths
227 values can be overridden with following options. Set them to paths
227 relative to the source URL, or leave them blank to disable auto
228 relative to the source URL, or leave them blank to disable auto
228 detection.
229 detection.
229
230
230 The following options can be set with ``--config``:
231 The following options can be set with ``--config``:
231
232
232 :convert.svn.branches: specify the directory containing branches.
233 :convert.svn.branches: specify the directory containing branches.
233 The default is ``branches``.
234 The default is ``branches``.
234
235
235 :convert.svn.tags: specify the directory containing tags. The
236 :convert.svn.tags: specify the directory containing tags. The
236 default is ``tags``.
237 default is ``tags``.
237
238
238 :convert.svn.trunk: specify the name of the trunk branch. The
239 :convert.svn.trunk: specify the name of the trunk branch. The
239 default is ``trunk``.
240 default is ``trunk``.
240
241
241 :convert.localtimezone: use local time (as determined by the TZ
242 :convert.localtimezone: use local time (as determined by the TZ
242 environment variable) for changeset date/times. The default
243 environment variable) for changeset date/times. The default
243 is False (use UTC).
244 is False (use UTC).
244
245
245 Source history can be retrieved starting at a specific revision,
246 Source history can be retrieved starting at a specific revision,
246 instead of being integrally converted. Only single branch
247 instead of being integrally converted. Only single branch
247 conversions are supported.
248 conversions are supported.
248
249
249 :convert.svn.startrev: specify start Subversion revision number.
250 :convert.svn.startrev: specify start Subversion revision number.
250 The default is 0.
251 The default is 0.
251
252
252 Perforce Source
253 Perforce Source
253 ###############
254 ###############
254
255
255 The Perforce (P4) importer can be given a p4 depot path or a
256 The Perforce (P4) importer can be given a p4 depot path or a
256 client specification as source. It will convert all files in the
257 client specification as source. It will convert all files in the
257 source to a flat Mercurial repository, ignoring labels, branches
258 source to a flat Mercurial repository, ignoring labels, branches
258 and integrations. Note that when a depot path is given you then
259 and integrations. Note that when a depot path is given you then
259 usually should specify a target directory, because otherwise the
260 usually should specify a target directory, because otherwise the
260 target may be named ``...-hg``.
261 target may be named ``...-hg``.
261
262
262 It is possible to limit the amount of source history to be
263 It is possible to limit the amount of source history to be
263 converted by specifying an initial Perforce revision:
264 converted by specifying an initial Perforce revision:
264
265
265 :convert.p4.startrev: specify initial Perforce revision (a
266 :convert.p4.startrev: specify initial Perforce revision (a
266 Perforce changelist number).
267 Perforce changelist number).
267
268
268 Mercurial Destination
269 Mercurial Destination
269 #####################
270 #####################
270
271
271 The following options are supported:
272 The following options are supported:
272
273
273 :convert.hg.clonebranches: dispatch source branches in separate
274 :convert.hg.clonebranches: dispatch source branches in separate
274 clones. The default is False.
275 clones. The default is False.
275
276
276 :convert.hg.tagsbranch: branch name for tag revisions, defaults to
277 :convert.hg.tagsbranch: branch name for tag revisions, defaults to
277 ``default``.
278 ``default``.
278
279
279 :convert.hg.usebranchnames: preserve branch names. The default is
280 :convert.hg.usebranchnames: preserve branch names. The default is
280 True.
281 True.
281 """
282 """
282 return convcmd.convert(ui, src, dest, revmapfile, **opts)
283 return convcmd.convert(ui, src, dest, revmapfile, **opts)
283
284
284 def debugsvnlog(ui, **opts):
285 def debugsvnlog(ui, **opts):
285 return subversion.debugsvnlog(ui, **opts)
286 return subversion.debugsvnlog(ui, **opts)
286
287
287 def debugcvsps(ui, *args, **opts):
288 def debugcvsps(ui, *args, **opts):
288 '''create changeset information from CVS
289 '''create changeset information from CVS
289
290
290 This command is intended as a debugging tool for the CVS to
291 This command is intended as a debugging tool for the CVS to
291 Mercurial converter, and can be used as a direct replacement for
292 Mercurial converter, and can be used as a direct replacement for
292 cvsps.
293 cvsps.
293
294
294 Hg debugcvsps reads the CVS rlog for current directory (or any
295 Hg debugcvsps reads the CVS rlog for current directory (or any
295 named directory) in the CVS repository, and converts the log to a
296 named directory) in the CVS repository, and converts the log to a
296 series of changesets based on matching commit log entries and
297 series of changesets based on matching commit log entries and
297 dates.'''
298 dates.'''
298 return cvsps.debugcvsps(ui, *args, **opts)
299 return cvsps.debugcvsps(ui, *args, **opts)
299
300
300 commands.norepo += " convert debugsvnlog debugcvsps"
301 commands.norepo += " convert debugsvnlog debugcvsps"
301
302
302 cmdtable = {
303 cmdtable = {
303 "convert":
304 "convert":
304 (convert,
305 (convert,
305 [('', 'authors', '',
306 [('', 'authors', '',
306 _('username mapping filename (DEPRECATED, use --authormap instead)'),
307 _('username mapping filename (DEPRECATED, use --authormap instead)'),
307 _('FILE')),
308 _('FILE')),
308 ('s', 'source-type', '',
309 ('s', 'source-type', '',
309 _('source repository type'), _('TYPE')),
310 _('source repository type'), _('TYPE')),
310 ('d', 'dest-type', '',
311 ('d', 'dest-type', '',
311 _('destination repository type'), _('TYPE')),
312 _('destination repository type'), _('TYPE')),
312 ('r', 'rev', '',
313 ('r', 'rev', '',
313 _('import up to source revision REV'), _('REV')),
314 _('import up to source revision REV'), _('REV')),
314 ('A', 'authormap', '',
315 ('A', 'authormap', '',
315 _('remap usernames using this file'), _('FILE')),
316 _('remap usernames using this file'), _('FILE')),
316 ('', 'filemap', '',
317 ('', 'filemap', '',
317 _('remap file names using contents of file'), _('FILE')),
318 _('remap file names using contents of file'), _('FILE')),
318 ('', 'splicemap', '',
319 ('', 'splicemap', '',
319 _('splice synthesized history into place'), _('FILE')),
320 _('splice synthesized history into place'), _('FILE')),
320 ('', 'branchmap', '',
321 ('', 'branchmap', '',
321 _('change branch names while converting'), _('FILE')),
322 _('change branch names while converting'), _('FILE')),
322 ('', 'branchsort', None, _('try to sort changesets by branches')),
323 ('', 'branchsort', None, _('try to sort changesets by branches')),
323 ('', 'datesort', None, _('try to sort changesets by date')),
324 ('', 'datesort', None, _('try to sort changesets by date')),
324 ('', 'sourcesort', None, _('preserve source changesets order')),
325 ('', 'sourcesort', None, _('preserve source changesets order')),
325 ('', 'closesort', None, _('try to reorder closed revisions'))],
326 ('', 'closesort', None, _('try to reorder closed revisions'))],
326 _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]')),
327 _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]')),
327 "debugsvnlog":
328 "debugsvnlog":
328 (debugsvnlog,
329 (debugsvnlog,
329 [],
330 [],
330 'hg debugsvnlog'),
331 'hg debugsvnlog'),
331 "debugcvsps":
332 "debugcvsps":
332 (debugcvsps,
333 (debugcvsps,
333 [
334 [
334 # Main options shared with cvsps-2.1
335 # Main options shared with cvsps-2.1
335 ('b', 'branches', [], _('only return changes on specified branches')),
336 ('b', 'branches', [], _('only return changes on specified branches')),
336 ('p', 'prefix', '', _('prefix to remove from file names')),
337 ('p', 'prefix', '', _('prefix to remove from file names')),
337 ('r', 'revisions', [],
338 ('r', 'revisions', [],
338 _('only return changes after or between specified tags')),
339 _('only return changes after or between specified tags')),
339 ('u', 'update-cache', None, _("update cvs log cache")),
340 ('u', 'update-cache', None, _("update cvs log cache")),
340 ('x', 'new-cache', None, _("create new cvs log cache")),
341 ('x', 'new-cache', None, _("create new cvs log cache")),
341 ('z', 'fuzz', 60, _('set commit time fuzz in seconds')),
342 ('z', 'fuzz', 60, _('set commit time fuzz in seconds')),
342 ('', 'root', '', _('specify cvsroot')),
343 ('', 'root', '', _('specify cvsroot')),
343 # Options specific to builtin cvsps
344 # Options specific to builtin cvsps
344 ('', 'parents', '', _('show parent changesets')),
345 ('', 'parents', '', _('show parent changesets')),
345 ('', 'ancestors', '',
346 ('', 'ancestors', '',
346 _('show current changeset in ancestor branches')),
347 _('show current changeset in ancestor branches')),
347 # Options that are ignored for compatibility with cvsps-2.1
348 # Options that are ignored for compatibility with cvsps-2.1
348 ('A', 'cvs-direct', None, _('ignored for compatibility')),
349 ('A', 'cvs-direct', None, _('ignored for compatibility')),
349 ],
350 ],
350 _('hg debugcvsps [OPTION]... [PATH]...')),
351 _('hg debugcvsps [OPTION]... [PATH]...')),
351 }
352 }
352
353
353 def kwconverted(ctx, name):
354 def kwconverted(ctx, name):
354 rev = ctx.extra().get('convert_revision', '')
355 rev = ctx.extra().get('convert_revision', '')
355 if rev.startswith('svn:'):
356 if rev.startswith('svn:'):
356 if name == 'svnrev':
357 if name == 'svnrev':
357 return str(subversion.revsplit(rev)[2])
358 return str(subversion.revsplit(rev)[2])
358 elif name == 'svnpath':
359 elif name == 'svnpath':
359 return subversion.revsplit(rev)[1]
360 return subversion.revsplit(rev)[1]
360 elif name == 'svnuuid':
361 elif name == 'svnuuid':
361 return subversion.revsplit(rev)[0]
362 return subversion.revsplit(rev)[0]
362 return rev
363 return rev
363
364
364 def kwsvnrev(repo, ctx, **args):
365 def kwsvnrev(repo, ctx, **args):
365 """:svnrev: String. Converted subversion revision number."""
366 """:svnrev: String. Converted subversion revision number."""
366 return kwconverted(ctx, 'svnrev')
367 return kwconverted(ctx, 'svnrev')
367
368
368 def kwsvnpath(repo, ctx, **args):
369 def kwsvnpath(repo, ctx, **args):
369 """:svnpath: String. Converted subversion revision project path."""
370 """:svnpath: String. Converted subversion revision project path."""
370 return kwconverted(ctx, 'svnpath')
371 return kwconverted(ctx, 'svnpath')
371
372
372 def kwsvnuuid(repo, ctx, **args):
373 def kwsvnuuid(repo, ctx, **args):
373 """:svnuuid: String. Converted subversion revision repository identifier."""
374 """:svnuuid: String. Converted subversion revision repository identifier."""
374 return kwconverted(ctx, 'svnuuid')
375 return kwconverted(ctx, 'svnuuid')
375
376
376 def extsetup(ui):
377 def extsetup(ui):
377 templatekw.keywords['svnrev'] = kwsvnrev
378 templatekw.keywords['svnrev'] = kwsvnrev
378 templatekw.keywords['svnpath'] = kwsvnpath
379 templatekw.keywords['svnpath'] = kwsvnpath
379 templatekw.keywords['svnuuid'] = kwsvnuuid
380 templatekw.keywords['svnuuid'] = kwsvnuuid
380
381
381 # tell hggettext to extract docstrings from these functions:
382 # tell hggettext to extract docstrings from these functions:
382 i18nfunctions = [kwsvnrev, kwsvnpath, kwsvnuuid]
383 i18nfunctions = [kwsvnrev, kwsvnpath, kwsvnuuid]
@@ -1,457 +1,458 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > convert=
3 > convert=
4 > [convert]
4 > [convert]
5 > hg.saverev=False
5 > hg.saverev=False
6 > EOF
6 > EOF
7 $ hg help convert
7 $ hg help convert
8 hg convert [OPTION]... SOURCE [DEST [REVMAP]]
8 hg convert [OPTION]... SOURCE [DEST [REVMAP]]
9
9
10 convert a foreign SCM repository to a Mercurial one.
10 convert a foreign SCM repository to a Mercurial one.
11
11
12 Accepted source formats [identifiers]:
12 Accepted source formats [identifiers]:
13
13
14 - Mercurial [hg]
14 - Mercurial [hg]
15 - CVS [cvs]
15 - CVS [cvs]
16 - Darcs [darcs]
16 - Darcs [darcs]
17 - git [git]
17 - git [git]
18 - Subversion [svn]
18 - Subversion [svn]
19 - Monotone [mtn]
19 - Monotone [mtn]
20 - GNU Arch [gnuarch]
20 - GNU Arch [gnuarch]
21 - Bazaar [bzr]
21 - Bazaar [bzr]
22 - Perforce [p4]
22 - Perforce [p4]
23
23
24 Accepted destination formats [identifiers]:
24 Accepted destination formats [identifiers]:
25
25
26 - Mercurial [hg]
26 - Mercurial [hg]
27 - Subversion [svn] (history on branches is not preserved)
27 - Subversion [svn] (history on branches is not preserved)
28
28
29 If no revision is given, all revisions will be converted. Otherwise,
29 If no revision is given, all revisions will be converted. Otherwise,
30 convert will only import up to the named revision (given in a format
30 convert will only import up to the named revision (given in a format
31 understood by the source).
31 understood by the source).
32
32
33 If no destination directory name is specified, it defaults to the basename
33 If no destination directory name is specified, it defaults to the basename
34 of the source with "-hg" appended. If the destination repository doesn't
34 of the source with "-hg" appended. If the destination repository doesn't
35 exist, it will be created.
35 exist, it will be created.
36
36
37 By default, all sources except Mercurial will use --branchsort. Mercurial
37 By default, all sources except Mercurial will use --branchsort. Mercurial
38 uses --sourcesort to preserve original revision numbers order. Sort modes
38 uses --sourcesort to preserve original revision numbers order. Sort modes
39 have the following effects:
39 have the following effects:
40
40
41 --branchsort convert from parent to child revision when possible, which
41 --branchsort convert from parent to child revision when possible, which
42 means branches are usually converted one after the other.
42 means branches are usually converted one after the other.
43 It generates more compact repositories.
43 It generates more compact repositories.
44 --datesort sort revisions by date. Converted repositories have good-
44 --datesort sort revisions by date. Converted repositories have good-
45 looking changelogs but are often an order of magnitude
45 looking changelogs but are often an order of magnitude
46 larger than the same ones generated by --branchsort.
46 larger than the same ones generated by --branchsort.
47 --sourcesort try to preserve source revisions order, only supported by
47 --sourcesort try to preserve source revisions order, only supported by
48 Mercurial sources.
48 Mercurial sources.
49 --closesort try to move closed revisions as close as possible to parent
49 --closesort try to move closed revisions as close as possible to parent
50 branches, only supported by Mercurial sources.
50 branches, only supported by Mercurial sources.
51
51
52 If "REVMAP" isn't given, it will be put in a default location
52 If "REVMAP" isn't given, it will be put in a default location
53 ("<dest>/.hg/shamap" by default). The "REVMAP" is a simple text file that
53 ("<dest>/.hg/shamap" by default). The "REVMAP" is a simple text file that
54 maps each source commit ID to the destination ID for that revision, like
54 maps each source commit ID to the destination ID for that revision, like
55 so:
55 so:
56
56
57 <source ID> <destination ID>
57 <source ID> <destination ID>
58
58
59 If the file doesn't exist, it's automatically created. It's updated on
59 If the file doesn't exist, it's automatically created. It's updated on
60 each commit copied, so "hg convert" can be interrupted and can be run
60 each commit copied, so "hg convert" can be interrupted and can be run
61 repeatedly to copy new commits.
61 repeatedly to copy new commits.
62
62
63 The authormap is a simple text file that maps each source commit author to
63 The authormap is a simple text file that maps each source commit author to
64 a destination commit author. It is handy for source SCMs that use unix
64 a destination commit author. It is handy for source SCMs that use unix
65 logins to identify authors (e.g.: CVS). One line per author mapping and
65 logins to identify authors (e.g.: CVS). One line per author mapping and
66 the line format is:
66 the line format is:
67
67
68 source author = destination author
68 source author = destination author
69
69
70 Empty lines and lines starting with a "#" are ignored.
70 Empty lines and lines starting with a "#" are ignored.
71
71
72 The filemap is a file that allows filtering and remapping of files and
72 The filemap is a file that allows filtering and remapping of files and
73 directories. Each line can contain one of the following directives:
73 directories. Each line can contain one of the following directives:
74
74
75 include path/to/file-or-dir
75 include path/to/file-or-dir
76
76
77 exclude path/to/file-or-dir
77 exclude path/to/file-or-dir
78
78
79 rename path/to/source path/to/destination
79 rename path/to/source path/to/destination
80
80
81 Comment lines start with "#". A specified path matches if it equals the
81 Comment lines start with "#". A specified path matches if it equals the
82 full relative name of a file or one of its parent directories. The
82 full relative name of a file or one of its parent directories. The
83 "include" or "exclude" directive with the longest matching path applies,
83 "include" or "exclude" directive with the longest matching path applies,
84 so line order does not matter.
84 so line order does not matter.
85
85
86 The "include" directive causes a file, or all files under a directory, to
86 The "include" directive causes a file, or all files under a directory, to
87 be included in the destination repository, and the exclusion of all other
87 be included in the destination repository. The default if there are no
88 files and directories not explicitly included. The "exclude" directive
88 "include" statements is to include everything. If there are any "include"
89 causes files or directories to be omitted. The "rename" directive renames
89 statements, nothing else is included. The "exclude" directive causes files
90 a file or directory if it is converted. To rename from a subdirectory into
90 or directories to be omitted. The "rename" directive renames a file or
91 the root of the repository, use "." as the path to rename to.
91 directory if it is converted. To rename from a subdirectory into the root
92 of the repository, use "." as the path to rename to.
92
93
93 The splicemap is a file that allows insertion of synthetic history,
94 The splicemap is a file that allows insertion of synthetic history,
94 letting you specify the parents of a revision. This is useful if you want
95 letting you specify the parents of a revision. This is useful if you want
95 to e.g. give a Subversion merge two parents, or graft two disconnected
96 to e.g. give a Subversion merge two parents, or graft two disconnected
96 series of history together. Each entry contains a key, followed by a
97 series of history together. Each entry contains a key, followed by a
97 space, followed by one or two comma-separated values:
98 space, followed by one or two comma-separated values:
98
99
99 key parent1, parent2
100 key parent1, parent2
100
101
101 The key is the revision ID in the source revision control system whose
102 The key is the revision ID in the source revision control system whose
102 parents should be modified (same format as a key in .hg/shamap). The
103 parents should be modified (same format as a key in .hg/shamap). The
103 values are the revision IDs (in either the source or destination revision
104 values are the revision IDs (in either the source or destination revision
104 control system) that should be used as the new parents for that node. For
105 control system) that should be used as the new parents for that node. For
105 example, if you have merged "release-1.0" into "trunk", then you should
106 example, if you have merged "release-1.0" into "trunk", then you should
106 specify the revision on "trunk" as the first parent and the one on the
107 specify the revision on "trunk" as the first parent and the one on the
107 "release-1.0" branch as the second.
108 "release-1.0" branch as the second.
108
109
109 The branchmap is a file that allows you to rename a branch when it is
110 The branchmap is a file that allows you to rename a branch when it is
110 being brought in from whatever external repository. When used in
111 being brought in from whatever external repository. When used in
111 conjunction with a splicemap, it allows for a powerful combination to help
112 conjunction with a splicemap, it allows for a powerful combination to help
112 fix even the most badly mismanaged repositories and turn them into nicely
113 fix even the most badly mismanaged repositories and turn them into nicely
113 structured Mercurial repositories. The branchmap contains lines of the
114 structured Mercurial repositories. The branchmap contains lines of the
114 form:
115 form:
115
116
116 original_branch_name new_branch_name
117 original_branch_name new_branch_name
117
118
118 where "original_branch_name" is the name of the branch in the source
119 where "original_branch_name" is the name of the branch in the source
119 repository, and "new_branch_name" is the name of the branch is the
120 repository, and "new_branch_name" is the name of the branch is the
120 destination repository. No whitespace is allowed in the branch names. This
121 destination repository. No whitespace is allowed in the branch names. This
121 can be used to (for instance) move code in one repository from "default"
122 can be used to (for instance) move code in one repository from "default"
122 to a named branch.
123 to a named branch.
123
124
124 Mercurial Source
125 Mercurial Source
125 ################
126 ################
126
127
127 The Mercurial source recognizes the following configuration options, which
128 The Mercurial source recognizes the following configuration options, which
128 you can set on the command line with "--config":
129 you can set on the command line with "--config":
129
130
130 convert.hg.ignoreerrors
131 convert.hg.ignoreerrors
131 ignore integrity errors when reading. Use it to fix
132 ignore integrity errors when reading. Use it to fix
132 Mercurial repositories with missing revlogs, by converting
133 Mercurial repositories with missing revlogs, by converting
133 from and to Mercurial. Default is False.
134 from and to Mercurial. Default is False.
134 convert.hg.saverev
135 convert.hg.saverev
135 store original revision ID in changeset (forces target IDs
136 store original revision ID in changeset (forces target IDs
136 to change). It takes a boolean argument and defaults to
137 to change). It takes a boolean argument and defaults to
137 False.
138 False.
138 convert.hg.revs
139 convert.hg.revs
139 revset specifying the source revisions to convert.
140 revset specifying the source revisions to convert.
140
141
141 CVS Source
142 CVS Source
142 ##########
143 ##########
143
144
144 CVS source will use a sandbox (i.e. a checked-out copy) from CVS to
145 CVS source will use a sandbox (i.e. a checked-out copy) from CVS to
145 indicate the starting point of what will be converted. Direct access to
146 indicate the starting point of what will be converted. Direct access to
146 the repository files is not needed, unless of course the repository is
147 the repository files is not needed, unless of course the repository is
147 ":local:". The conversion uses the top level directory in the sandbox to
148 ":local:". The conversion uses the top level directory in the sandbox to
148 find the CVS repository, and then uses CVS rlog commands to find files to
149 find the CVS repository, and then uses CVS rlog commands to find files to
149 convert. This means that unless a filemap is given, all files under the
150 convert. This means that unless a filemap is given, all files under the
150 starting directory will be converted, and that any directory
151 starting directory will be converted, and that any directory
151 reorganization in the CVS sandbox is ignored.
152 reorganization in the CVS sandbox is ignored.
152
153
153 The following options can be used with "--config":
154 The following options can be used with "--config":
154
155
155 convert.cvsps.cache
156 convert.cvsps.cache
156 Set to False to disable remote log caching, for testing and
157 Set to False to disable remote log caching, for testing and
157 debugging purposes. Default is True.
158 debugging purposes. Default is True.
158 convert.cvsps.fuzz
159 convert.cvsps.fuzz
159 Specify the maximum time (in seconds) that is allowed
160 Specify the maximum time (in seconds) that is allowed
160 between commits with identical user and log message in a
161 between commits with identical user and log message in a
161 single changeset. When very large files were checked in as
162 single changeset. When very large files were checked in as
162 part of a changeset then the default may not be long enough.
163 part of a changeset then the default may not be long enough.
163 The default is 60.
164 The default is 60.
164 convert.cvsps.mergeto
165 convert.cvsps.mergeto
165 Specify a regular expression to which commit log messages
166 Specify a regular expression to which commit log messages
166 are matched. If a match occurs, then the conversion process
167 are matched. If a match occurs, then the conversion process
167 will insert a dummy revision merging the branch on which
168 will insert a dummy revision merging the branch on which
168 this log message occurs to the branch indicated in the
169 this log message occurs to the branch indicated in the
169 regex. Default is "{{mergetobranch ([-\w]+)}}"
170 regex. Default is "{{mergetobranch ([-\w]+)}}"
170 convert.cvsps.mergefrom
171 convert.cvsps.mergefrom
171 Specify a regular expression to which commit log messages
172 Specify a regular expression to which commit log messages
172 are matched. If a match occurs, then the conversion process
173 are matched. If a match occurs, then the conversion process
173 will add the most recent revision on the branch indicated in
174 will add the most recent revision on the branch indicated in
174 the regex as the second parent of the changeset. Default is
175 the regex as the second parent of the changeset. Default is
175 "{{mergefrombranch ([-\w]+)}}"
176 "{{mergefrombranch ([-\w]+)}}"
176 convert.localtimezone
177 convert.localtimezone
177 use local time (as determined by the TZ environment
178 use local time (as determined by the TZ environment
178 variable) for changeset date/times. The default is False
179 variable) for changeset date/times. The default is False
179 (use UTC).
180 (use UTC).
180 hooks.cvslog Specify a Python function to be called at the end of
181 hooks.cvslog Specify a Python function to be called at the end of
181 gathering the CVS log. The function is passed a list with
182 gathering the CVS log. The function is passed a list with
182 the log entries, and can modify the entries in-place, or add
183 the log entries, and can modify the entries in-place, or add
183 or delete them.
184 or delete them.
184 hooks.cvschangesets
185 hooks.cvschangesets
185 Specify a Python function to be called after the changesets
186 Specify a Python function to be called after the changesets
186 are calculated from the CVS log. The function is passed a
187 are calculated from the CVS log. The function is passed a
187 list with the changeset entries, and can modify the
188 list with the changeset entries, and can modify the
188 changesets in-place, or add or delete them.
189 changesets in-place, or add or delete them.
189
190
190 An additional "debugcvsps" Mercurial command allows the builtin changeset
191 An additional "debugcvsps" Mercurial command allows the builtin changeset
191 merging code to be run without doing a conversion. Its parameters and
192 merging code to be run without doing a conversion. Its parameters and
192 output are similar to that of cvsps 2.1. Please see the command help for
193 output are similar to that of cvsps 2.1. Please see the command help for
193 more details.
194 more details.
194
195
195 Subversion Source
196 Subversion Source
196 #################
197 #################
197
198
198 Subversion source detects classical trunk/branches/tags layouts. By
199 Subversion source detects classical trunk/branches/tags layouts. By
199 default, the supplied "svn://repo/path/" source URL is converted as a
200 default, the supplied "svn://repo/path/" source URL is converted as a
200 single branch. If "svn://repo/path/trunk" exists it replaces the default
201 single branch. If "svn://repo/path/trunk" exists it replaces the default
201 branch. If "svn://repo/path/branches" exists, its subdirectories are
202 branch. If "svn://repo/path/branches" exists, its subdirectories are
202 listed as possible branches. If "svn://repo/path/tags" exists, it is
203 listed as possible branches. If "svn://repo/path/tags" exists, it is
203 looked for tags referencing converted branches. Default "trunk",
204 looked for tags referencing converted branches. Default "trunk",
204 "branches" and "tags" values can be overridden with following options. Set
205 "branches" and "tags" values can be overridden with following options. Set
205 them to paths relative to the source URL, or leave them blank to disable
206 them to paths relative to the source URL, or leave them blank to disable
206 auto detection.
207 auto detection.
207
208
208 The following options can be set with "--config":
209 The following options can be set with "--config":
209
210
210 convert.svn.branches
211 convert.svn.branches
211 specify the directory containing branches. The default is
212 specify the directory containing branches. The default is
212 "branches".
213 "branches".
213 convert.svn.tags
214 convert.svn.tags
214 specify the directory containing tags. The default is
215 specify the directory containing tags. The default is
215 "tags".
216 "tags".
216 convert.svn.trunk
217 convert.svn.trunk
217 specify the name of the trunk branch. The default is
218 specify the name of the trunk branch. The default is
218 "trunk".
219 "trunk".
219 convert.localtimezone
220 convert.localtimezone
220 use local time (as determined by the TZ environment
221 use local time (as determined by the TZ environment
221 variable) for changeset date/times. The default is False
222 variable) for changeset date/times. The default is False
222 (use UTC).
223 (use UTC).
223
224
224 Source history can be retrieved starting at a specific revision, instead
225 Source history can be retrieved starting at a specific revision, instead
225 of being integrally converted. Only single branch conversions are
226 of being integrally converted. Only single branch conversions are
226 supported.
227 supported.
227
228
228 convert.svn.startrev
229 convert.svn.startrev
229 specify start Subversion revision number. The default is 0.
230 specify start Subversion revision number. The default is 0.
230
231
231 Perforce Source
232 Perforce Source
232 ###############
233 ###############
233
234
234 The Perforce (P4) importer can be given a p4 depot path or a client
235 The Perforce (P4) importer can be given a p4 depot path or a client
235 specification as source. It will convert all files in the source to a flat
236 specification as source. It will convert all files in the source to a flat
236 Mercurial repository, ignoring labels, branches and integrations. Note
237 Mercurial repository, ignoring labels, branches and integrations. Note
237 that when a depot path is given you then usually should specify a target
238 that when a depot path is given you then usually should specify a target
238 directory, because otherwise the target may be named "...-hg".
239 directory, because otherwise the target may be named "...-hg".
239
240
240 It is possible to limit the amount of source history to be converted by
241 It is possible to limit the amount of source history to be converted by
241 specifying an initial Perforce revision:
242 specifying an initial Perforce revision:
242
243
243 convert.p4.startrev
244 convert.p4.startrev
244 specify initial Perforce revision (a Perforce changelist
245 specify initial Perforce revision (a Perforce changelist
245 number).
246 number).
246
247
247 Mercurial Destination
248 Mercurial Destination
248 #####################
249 #####################
249
250
250 The following options are supported:
251 The following options are supported:
251
252
252 convert.hg.clonebranches
253 convert.hg.clonebranches
253 dispatch source branches in separate clones. The default is
254 dispatch source branches in separate clones. The default is
254 False.
255 False.
255 convert.hg.tagsbranch
256 convert.hg.tagsbranch
256 branch name for tag revisions, defaults to "default".
257 branch name for tag revisions, defaults to "default".
257 convert.hg.usebranchnames
258 convert.hg.usebranchnames
258 preserve branch names. The default is True.
259 preserve branch names. The default is True.
259
260
260 options:
261 options:
261
262
262 -s --source-type TYPE source repository type
263 -s --source-type TYPE source repository type
263 -d --dest-type TYPE destination repository type
264 -d --dest-type TYPE destination repository type
264 -r --rev REV import up to source revision REV
265 -r --rev REV import up to source revision REV
265 -A --authormap FILE remap usernames using this file
266 -A --authormap FILE remap usernames using this file
266 --filemap FILE remap file names using contents of file
267 --filemap FILE remap file names using contents of file
267 --splicemap FILE splice synthesized history into place
268 --splicemap FILE splice synthesized history into place
268 --branchmap FILE change branch names while converting
269 --branchmap FILE change branch names while converting
269 --branchsort try to sort changesets by branches
270 --branchsort try to sort changesets by branches
270 --datesort try to sort changesets by date
271 --datesort try to sort changesets by date
271 --sourcesort preserve source changesets order
272 --sourcesort preserve source changesets order
272 --closesort try to reorder closed revisions
273 --closesort try to reorder closed revisions
273
274
274 use "hg -v help convert" to show the global options
275 use "hg -v help convert" to show the global options
275 $ hg init a
276 $ hg init a
276 $ cd a
277 $ cd a
277 $ echo a > a
278 $ echo a > a
278 $ hg ci -d'0 0' -Ama
279 $ hg ci -d'0 0' -Ama
279 adding a
280 adding a
280 $ hg cp a b
281 $ hg cp a b
281 $ hg ci -d'1 0' -mb
282 $ hg ci -d'1 0' -mb
282 $ hg rm a
283 $ hg rm a
283 $ hg ci -d'2 0' -mc
284 $ hg ci -d'2 0' -mc
284 $ hg mv b a
285 $ hg mv b a
285 $ hg ci -d'3 0' -md
286 $ hg ci -d'3 0' -md
286 $ echo a >> a
287 $ echo a >> a
287 $ hg ci -d'4 0' -me
288 $ hg ci -d'4 0' -me
288 $ cd ..
289 $ cd ..
289 $ hg convert a 2>&1 | grep -v 'subversion python bindings could not be loaded'
290 $ hg convert a 2>&1 | grep -v 'subversion python bindings could not be loaded'
290 assuming destination a-hg
291 assuming destination a-hg
291 initializing destination a-hg repository
292 initializing destination a-hg repository
292 scanning source...
293 scanning source...
293 sorting...
294 sorting...
294 converting...
295 converting...
295 4 a
296 4 a
296 3 b
297 3 b
297 2 c
298 2 c
298 1 d
299 1 d
299 0 e
300 0 e
300 $ hg --cwd a-hg pull ../a
301 $ hg --cwd a-hg pull ../a
301 pulling from ../a
302 pulling from ../a
302 searching for changes
303 searching for changes
303 no changes found
304 no changes found
304
305
305 conversion to existing file should fail
306 conversion to existing file should fail
306
307
307 $ touch bogusfile
308 $ touch bogusfile
308 $ hg convert a bogusfile
309 $ hg convert a bogusfile
309 initializing destination bogusfile repository
310 initializing destination bogusfile repository
310 abort: cannot create new bundle repository
311 abort: cannot create new bundle repository
311 [255]
312 [255]
312
313
313 #if unix-permissions no-root
314 #if unix-permissions no-root
314
315
315 conversion to dir without permissions should fail
316 conversion to dir without permissions should fail
316
317
317 $ mkdir bogusdir
318 $ mkdir bogusdir
318 $ chmod 000 bogusdir
319 $ chmod 000 bogusdir
319
320
320 $ hg convert a bogusdir
321 $ hg convert a bogusdir
321 abort: Permission denied: 'bogusdir'
322 abort: Permission denied: 'bogusdir'
322 [255]
323 [255]
323
324
324 user permissions should succeed
325 user permissions should succeed
325
326
326 $ chmod 700 bogusdir
327 $ chmod 700 bogusdir
327 $ hg convert a bogusdir
328 $ hg convert a bogusdir
328 initializing destination bogusdir repository
329 initializing destination bogusdir repository
329 scanning source...
330 scanning source...
330 sorting...
331 sorting...
331 converting...
332 converting...
332 4 a
333 4 a
333 3 b
334 3 b
334 2 c
335 2 c
335 1 d
336 1 d
336 0 e
337 0 e
337
338
338 #endif
339 #endif
339
340
340 test pre and post conversion actions
341 test pre and post conversion actions
341
342
342 $ echo 'include b' > filemap
343 $ echo 'include b' > filemap
343 $ hg convert --debug --filemap filemap a partialb | \
344 $ hg convert --debug --filemap filemap a partialb | \
344 > grep 'run hg'
345 > grep 'run hg'
345 run hg source pre-conversion action
346 run hg source pre-conversion action
346 run hg sink pre-conversion action
347 run hg sink pre-conversion action
347 run hg sink post-conversion action
348 run hg sink post-conversion action
348 run hg source post-conversion action
349 run hg source post-conversion action
349
350
350 converting empty dir should fail "nicely
351 converting empty dir should fail "nicely
351
352
352 $ mkdir emptydir
353 $ mkdir emptydir
353
354
354 override $PATH to ensure p4 not visible; use $PYTHON in case we're
355 override $PATH to ensure p4 not visible; use $PYTHON in case we're
355 running from a devel copy, not a temp installation
356 running from a devel copy, not a temp installation
356
357
357 $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg convert emptydir
358 $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg convert emptydir
358 assuming destination emptydir-hg
359 assuming destination emptydir-hg
359 initializing destination emptydir-hg repository
360 initializing destination emptydir-hg repository
360 emptydir does not look like a CVS checkout
361 emptydir does not look like a CVS checkout
361 emptydir does not look like a Git repository
362 emptydir does not look like a Git repository
362 emptydir does not look like a Subversion repository
363 emptydir does not look like a Subversion repository
363 emptydir is not a local Mercurial repository
364 emptydir is not a local Mercurial repository
364 emptydir does not look like a darcs repository
365 emptydir does not look like a darcs repository
365 emptydir does not look like a monotone repository
366 emptydir does not look like a monotone repository
366 emptydir does not look like a GNU Arch repository
367 emptydir does not look like a GNU Arch repository
367 emptydir does not look like a Bazaar repository
368 emptydir does not look like a Bazaar repository
368 cannot find required "p4" tool
369 cannot find required "p4" tool
369 abort: emptydir: missing or unsupported repository
370 abort: emptydir: missing or unsupported repository
370 [255]
371 [255]
371
372
372 convert with imaginary source type
373 convert with imaginary source type
373
374
374 $ hg convert --source-type foo a a-foo
375 $ hg convert --source-type foo a a-foo
375 initializing destination a-foo repository
376 initializing destination a-foo repository
376 abort: foo: invalid source repository type
377 abort: foo: invalid source repository type
377 [255]
378 [255]
378
379
379 convert with imaginary sink type
380 convert with imaginary sink type
380
381
381 $ hg convert --dest-type foo a a-foo
382 $ hg convert --dest-type foo a a-foo
382 abort: foo: invalid destination repository type
383 abort: foo: invalid destination repository type
383 [255]
384 [255]
384
385
385 testing: convert must not produce duplicate entries in fncache
386 testing: convert must not produce duplicate entries in fncache
386
387
387 $ hg convert a b
388 $ hg convert a b
388 initializing destination b repository
389 initializing destination b repository
389 scanning source...
390 scanning source...
390 sorting...
391 sorting...
391 converting...
392 converting...
392 4 a
393 4 a
393 3 b
394 3 b
394 2 c
395 2 c
395 1 d
396 1 d
396 0 e
397 0 e
397
398
398 contents of fncache file:
399 contents of fncache file:
399
400
400 $ cat b/.hg/store/fncache | sort
401 $ cat b/.hg/store/fncache | sort
401 data/a.i
402 data/a.i
402 data/b.i
403 data/b.i
403
404
404 test bogus URL
405 test bogus URL
405
406
406 $ hg convert -q bzr+ssh://foobar@selenic.com/baz baz
407 $ hg convert -q bzr+ssh://foobar@selenic.com/baz baz
407 abort: bzr+ssh://foobar@selenic.com/baz: missing or unsupported repository
408 abort: bzr+ssh://foobar@selenic.com/baz: missing or unsupported repository
408 [255]
409 [255]
409
410
410 test revset converted() lookup
411 test revset converted() lookup
411
412
412 $ hg --config convert.hg.saverev=True convert a c
413 $ hg --config convert.hg.saverev=True convert a c
413 initializing destination c repository
414 initializing destination c repository
414 scanning source...
415 scanning source...
415 sorting...
416 sorting...
416 converting...
417 converting...
417 4 a
418 4 a
418 3 b
419 3 b
419 2 c
420 2 c
420 1 d
421 1 d
421 0 e
422 0 e
422 $ echo f > c/f
423 $ echo f > c/f
423 $ hg -R c ci -d'0 0' -Amf
424 $ hg -R c ci -d'0 0' -Amf
424 adding f
425 adding f
425 created new head
426 created new head
426 $ hg -R c log -r "converted(09d945a62ce6)"
427 $ hg -R c log -r "converted(09d945a62ce6)"
427 changeset: 1:98c3dd46a874
428 changeset: 1:98c3dd46a874
428 user: test
429 user: test
429 date: Thu Jan 01 00:00:01 1970 +0000
430 date: Thu Jan 01 00:00:01 1970 +0000
430 summary: b
431 summary: b
431
432
432 $ hg -R c log -r "converted()"
433 $ hg -R c log -r "converted()"
433 changeset: 0:31ed57b2037c
434 changeset: 0:31ed57b2037c
434 user: test
435 user: test
435 date: Thu Jan 01 00:00:00 1970 +0000
436 date: Thu Jan 01 00:00:00 1970 +0000
436 summary: a
437 summary: a
437
438
438 changeset: 1:98c3dd46a874
439 changeset: 1:98c3dd46a874
439 user: test
440 user: test
440 date: Thu Jan 01 00:00:01 1970 +0000
441 date: Thu Jan 01 00:00:01 1970 +0000
441 summary: b
442 summary: b
442
443
443 changeset: 2:3b9ca06ef716
444 changeset: 2:3b9ca06ef716
444 user: test
445 user: test
445 date: Thu Jan 01 00:00:02 1970 +0000
446 date: Thu Jan 01 00:00:02 1970 +0000
446 summary: c
447 summary: c
447
448
448 changeset: 3:4e0debd37cf2
449 changeset: 3:4e0debd37cf2
449 user: test
450 user: test
450 date: Thu Jan 01 00:00:03 1970 +0000
451 date: Thu Jan 01 00:00:03 1970 +0000
451 summary: d
452 summary: d
452
453
453 changeset: 4:9de3bc9349c5
454 changeset: 4:9de3bc9349c5
454 user: test
455 user: test
455 date: Thu Jan 01 00:00:04 1970 +0000
456 date: Thu Jan 01 00:00:04 1970 +0000
456 summary: e
457 summary: e
457
458
General Comments 0
You need to be logged in to leave comments. Login now