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