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