##// END OF EJS Templates
convert: fixed typo in docstring
Martin Geisler -
r9086:f459f09b default
parent child Browse files
Show More
@@ -1,281 +1,281 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, incorporated herein by reference.
6 # GNU General Public License version 2, incorporated herein by reference.
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
13 from mercurial import commands
14 from mercurial.i18n import _
14 from mercurial.i18n import _
15
15
16 # Commands definition was moved elsewhere to ease demandload job.
16 # Commands definition was moved elsewhere to ease demandload job.
17
17
18 def convert(ui, src, dest=None, revmapfile=None, **opts):
18 def convert(ui, src, dest=None, revmapfile=None, **opts):
19 """convert a foreign SCM repository to a Mercurial one.
19 """convert a foreign SCM repository to a Mercurial one.
20
20
21 Accepted source formats [identifiers]:
21 Accepted source formats [identifiers]:
22 - Mercurial [hg]
22 - Mercurial [hg]
23 - CVS [cvs]
23 - CVS [cvs]
24 - Darcs [darcs]
24 - Darcs [darcs]
25 - git [git]
25 - git [git]
26 - Subversion [svn]
26 - Subversion [svn]
27 - Monotone [mtn]
27 - Monotone [mtn]
28 - GNU Arch [gnuarch]
28 - GNU Arch [gnuarch]
29 - Bazaar [bzr]
29 - Bazaar [bzr]
30 - Perforce [p4]
30 - Perforce [p4]
31
31
32 Accepted destination formats [identifiers]:
32 Accepted destination formats [identifiers]:
33 - Mercurial [hg]
33 - Mercurial [hg]
34 - Subversion [svn] (history on branches is not preserved)
34 - Subversion [svn] (history on branches is not preserved)
35
35
36 If no revision is given, all revisions will be converted. Otherwise,
36 If no revision is given, all revisions will be converted. Otherwise,
37 convert will only import up to the named revision (given in a format
37 convert will only import up to the named revision (given in a format
38 understood by the source).
38 understood by the source).
39
39
40 If no destination directory name is specified, it defaults to the basename
40 If no destination directory name is specified, it defaults to the basename
41 of the source with '-hg' appended. If the destination repository doesn't
41 of the source with '-hg' appended. If the destination repository doesn't
42 exist, it will be created.
42 exist, it will be created.
43
43
44 By default, all sources except Mercurial will use --branchsort. Mercurial
44 By default, all sources except Mercurial will use --branchsort. Mercurial
45 uses --sourcesort to preserve original revision numbers order. Sort modes
45 uses --sourcesort to preserve original revision numbers order. Sort modes
46 have the following effects:
46 have the following effects:
47 --branchsort: convert from parent to child revision when possible, which
47 --branchsort: convert from parent to child revision when possible, which
48 means branches are usually converted one after the other. It generates
48 means branches are usually converted one after the other. It generates
49 more compact repositories.
49 more compact repositories.
50 --datesort: sort revisions by date. Converted repositories have
50 --datesort: sort revisions by date. Converted repositories have
51 good-looking changelogs but are often an order of magnitude larger
51 good-looking changelogs but are often an order of magnitude larger
52 than the same ones generated by --branchsort.
52 than the same ones generated by --branchsort.
53 --sourcesort: try to preserve source revisions order, only supported by
53 --sourcesort: try to preserve source revisions order, only supported by
54 Mercurial sources.
54 Mercurial sources.
55
55
56 If <REVMAP> isn't given, it will be put in a default location
56 If <REVMAP> isn't given, it will be put in a default location
57 (<dest>/.hg/shamap by default). The <REVMAP> is a simple text file that
57 (<dest>/.hg/shamap by default). The <REVMAP> is a simple text file that
58 maps each source commit ID to the destination ID for that revision, like
58 maps each source commit ID to the destination ID for that revision, like
59 so:
59 so:
60
60
61 <source ID> <destination ID>
61 <source ID> <destination ID>
62
62
63 If the file doesn't exist, it's automatically created. It's updated on
63 If the file doesn't exist, it's automatically created. It's updated on
64 each commit copied, so convert-repo can be interrupted and can be run
64 each commit copied, so convert-repo can be interrupted and can be run
65 repeatedly to copy new commits.
65 repeatedly to copy new commits.
66
66
67 The [username mapping] file is a simple text file that maps each source
67 The [username mapping] file is a simple text file that maps each source
68 commit author to a destination commit author. It is handy for source SCMs
68 commit author to a destination commit author. It is handy for source SCMs
69 that use unix logins to identify authors (eg: CVS). One line per author
69 that use unix logins to identify authors (eg: CVS). One line per author
70 mapping and the line format is: srcauthor=whatever string you want
70 mapping and the line format is: srcauthor=whatever string you want
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. Comment lines start with '#'. Each line can contain one of
73 directories. Comment lines start with '#'. Each line can contain one of
74 the following directives:
74 the following directives:
75
75
76 include path/to/file
76 include path/to/file
77
77
78 exclude path/to/file
78 exclude path/to/file
79
79
80 rename from/file to/file
80 rename from/file to/file
81
81
82 The 'include' directive causes a file, or all files under a directory, to
82 The 'include' directive causes a file, or all files under a directory, to
83 be included in the destination repository, and the exclusion of all other
83 be included in the destination repository, and the exclusion of all other
84 files and directories not explicitly included. The 'exclude' directive
84 files and directories not explicitly included. The 'exclude' directive
85 causes files or directories to be omitted. The 'rename' directive renames
85 causes files or directories to be omitted. The 'rename' directive renames
86 a file or directory. To rename from a subdirectory into the root of the
86 a file or directory. To rename from a subdirectory into the root of the
87 repository, use '.' as the path to rename to.
87 repository, use '.' as the path to rename to.
88
88
89 The splicemap is a file that allows insertion of synthetic history,
89 The splicemap is a file that allows insertion of synthetic history,
90 letting you specify the parents of a revision. This is useful if you want
90 letting you specify the parents of a revision. This is useful if you want
91 to e.g. give a Subversion merge two parents, or graft two disconnected
91 to e.g. give a Subversion merge two parents, or graft two disconnected
92 series of history together. Each entry contains a key, followed by a
92 series of history together. Each entry contains a key, followed by a
93 space, followed by one or two comma-separated values. The key is the
93 space, followed by one or two comma-separated values. The key is the
94 revision ID in the source revision control system whose parents should be
94 revision ID in the source revision control system whose parents should be
95 modified (same format as a key in .hg/shamap). The values are the revision
95 modified (same format as a key in .hg/shamap). The values are the revision
96 IDs (in either the source or destination revision control system) that
96 IDs (in either the source or destination revision control system) that
97 should be used as the new parents for that node.
97 should be used as the new parents for that node.
98
98
99 The branchmap is a file that allows you to rename a branch when it is
99 The branchmap is a file that allows you to rename a branch when it is
100 being brought in from whatever external repository. When used in
100 being brought in from whatever external repository. When used in
101 conjunction with a splicemap, it allows for a powerful combination to help
101 conjunction with a splicemap, it allows for a powerful combination to help
102 fix even the most badly mismanaged repositories and turn them into nicely
102 fix even the most badly mismanaged repositories and turn them into nicely
103 structured Mercurial repositories. The branchmap contains lines of the
103 structured Mercurial repositories. The branchmap contains lines of the
104 form "original_branch_name new_branch_name". "original_branch_name" is the
104 form "original_branch_name new_branch_name". "original_branch_name" is the
105 name of the branch in the source repository, and "new_branch_name" is the
105 name of the branch in the source repository, and "new_branch_name" is the
106 name of the branch is the destination repository. This can be used to (for
106 name of the branch is the destination repository. This can be used to (for
107 instance) move code in one repository from "default" to a named branch.
107 instance) move code in one repository from "default" to a named branch.
108
108
109 Mercurial Source
109 Mercurial Source
110 -----------------
110 ----------------
111
111
112 --config convert.hg.ignoreerrors=False (boolean)
112 --config convert.hg.ignoreerrors=False (boolean)
113 ignore integrity errors when reading. Use it to fix Mercurial
113 ignore integrity errors when reading. Use it to fix Mercurial
114 repositories with missing revlogs, by converting from and to
114 repositories with missing revlogs, by converting from and to
115 Mercurial.
115 Mercurial.
116 --config convert.hg.saverev=False (boolean)
116 --config convert.hg.saverev=False (boolean)
117 store original revision ID in changeset (forces target IDs to change)
117 store original revision ID in changeset (forces target IDs to change)
118 --config convert.hg.startrev=0 (hg revision identifier)
118 --config convert.hg.startrev=0 (hg revision identifier)
119 convert start revision and its descendants
119 convert start revision and its descendants
120
120
121 CVS Source
121 CVS Source
122 ----------
122 ----------
123
123
124 CVS source will use a sandbox (i.e. a checked-out copy) from CVS to
124 CVS source will use a sandbox (i.e. a checked-out copy) from CVS to
125 indicate the starting point of what will be converted. Direct access to
125 indicate the starting point of what will be converted. Direct access to
126 the repository files is not needed, unless of course the repository is
126 the repository files is not needed, unless of course the repository is
127 :local:. The conversion uses the top level directory in the sandbox to
127 :local:. The conversion uses the top level directory in the sandbox to
128 find the CVS repository, and then uses CVS rlog commands to find files to
128 find the CVS repository, and then uses CVS rlog commands to find files to
129 convert. This means that unless a filemap is given, all files under the
129 convert. This means that unless a filemap is given, all files under the
130 starting directory will be converted, and that any directory
130 starting directory will be converted, and that any directory
131 reorganization in the CVS sandbox is ignored.
131 reorganization in the CVS sandbox is ignored.
132
132
133 Because CVS does not have changesets, it is necessary to collect
133 Because CVS does not have changesets, it is necessary to collect
134 individual commits to CVS and merge them into changesets. CVS source uses
134 individual commits to CVS and merge them into changesets. CVS source uses
135 its internal changeset merging code by default but can be configured to
135 its internal changeset merging code by default but can be configured to
136 call the external 'cvsps' program by setting:
136 call the external 'cvsps' program by setting:
137
137
138 --config convert.cvsps='cvsps -A -u --cvs-direct -q'
138 --config convert.cvsps='cvsps -A -u --cvs-direct -q'
139
139
140 This option is deprecated and will be removed in Mercurial 1.4.
140 This option is deprecated and will be removed in Mercurial 1.4.
141
141
142 The options shown are the defaults.
142 The options shown are the defaults.
143
143
144 Internal cvsps is selected by setting
144 Internal cvsps is selected by setting
145
145
146 --config convert.cvsps=builtin
146 --config convert.cvsps=builtin
147
147
148 and has a few more configurable options:
148 and has a few more configurable options:
149 --config convert.cvsps.cache=True (boolean)
149 --config convert.cvsps.cache=True (boolean)
150 Set to False to disable remote log caching, for testing and
150 Set to False to disable remote log caching, for testing and
151 debugging purposes.
151 debugging purposes.
152 --config convert.cvsps.fuzz=60 (integer)
152 --config convert.cvsps.fuzz=60 (integer)
153 Specify the maximum time (in seconds) that is allowed between
153 Specify the maximum time (in seconds) that is allowed between
154 commits with identical user and log message in a single changeset.
154 commits with identical user and log message in a single changeset.
155 When very large files were checked in as part of a changeset then
155 When very large files were checked in as part of a changeset then
156 the default may not be long enough.
156 the default may not be long enough.
157 --config convert.cvsps.mergeto='{{mergetobranch ([-\\w]+)}}'
157 --config convert.cvsps.mergeto='{{mergetobranch ([-\\w]+)}}'
158 Specify a regular expression to which commit log messages are
158 Specify a regular expression to which commit log messages are
159 matched. If a match occurs, then the conversion process will
159 matched. If a match occurs, then the conversion process will
160 insert a dummy revision merging the branch on which this log
160 insert a dummy revision merging the branch on which this log
161 message occurs to the branch indicated in the regex.
161 message occurs to the branch indicated in the regex.
162 --config convert.cvsps.mergefrom='{{mergefrombranch ([-\\w]+)}}'
162 --config convert.cvsps.mergefrom='{{mergefrombranch ([-\\w]+)}}'
163 Specify a regular expression to which commit log messages are
163 Specify a regular expression to which commit log messages are
164 matched. If a match occurs, then the conversion process will add
164 matched. If a match occurs, then the conversion process will add
165 the most recent revision on the branch indicated in the regex as
165 the most recent revision on the branch indicated in the regex as
166 the second parent of the changeset.
166 the second parent of the changeset.
167
167
168 The hgext/convert/cvsps wrapper script allows the builtin changeset
168 The hgext/convert/cvsps wrapper script allows the builtin changeset
169 merging code to be run without doing a conversion. Its parameters and
169 merging code to be run without doing a conversion. Its parameters and
170 output are similar to that of cvsps 2.1.
170 output are similar to that of cvsps 2.1.
171
171
172 Subversion Source
172 Subversion Source
173 -----------------
173 -----------------
174
174
175 Subversion source detects classical trunk/branches/tags layouts. By
175 Subversion source detects classical trunk/branches/tags layouts. By
176 default, the supplied "svn://repo/path/" source URL is converted as a
176 default, the supplied "svn://repo/path/" source URL is converted as a
177 single branch. If "svn://repo/path/trunk" exists it replaces the default
177 single branch. If "svn://repo/path/trunk" exists it replaces the default
178 branch. If "svn://repo/path/branches" exists, its subdirectories are
178 branch. If "svn://repo/path/branches" exists, its subdirectories are
179 listed as possible branches. If "svn://repo/path/tags" exists, it is
179 listed as possible branches. If "svn://repo/path/tags" exists, it is
180 looked for tags referencing converted branches. Default "trunk",
180 looked for tags referencing converted branches. Default "trunk",
181 "branches" and "tags" values can be overridden with following options. Set
181 "branches" and "tags" values can be overridden with following options. Set
182 them to paths relative to the source URL, or leave them blank to disable
182 them to paths relative to the source URL, or leave them blank to disable
183 auto detection.
183 auto detection.
184
184
185 --config convert.svn.branches=branches (directory name)
185 --config convert.svn.branches=branches (directory name)
186 specify the directory containing branches
186 specify the directory containing branches
187 --config convert.svn.tags=tags (directory name)
187 --config convert.svn.tags=tags (directory name)
188 specify the directory containing tags
188 specify the directory containing tags
189 --config convert.svn.trunk=trunk (directory name)
189 --config convert.svn.trunk=trunk (directory name)
190 specify the name of the trunk branch
190 specify the name of the trunk branch
191
191
192 Source history can be retrieved starting at a specific revision, instead
192 Source history can be retrieved starting at a specific revision, instead
193 of being integrally converted. Only single branch conversions are
193 of being integrally converted. Only single branch conversions are
194 supported.
194 supported.
195
195
196 --config convert.svn.startrev=0 (svn revision number)
196 --config convert.svn.startrev=0 (svn revision number)
197 specify start Subversion revision.
197 specify start Subversion revision.
198
198
199 Perforce Source
199 Perforce Source
200 ---------------
200 ---------------
201
201
202 The Perforce (P4) importer can be given a p4 depot path or a client
202 The Perforce (P4) importer can be given a p4 depot path or a client
203 specification as source. It will convert all files in the source to a flat
203 specification as source. It will convert all files in the source to a flat
204 Mercurial repository, ignoring labels, branches and integrations. Note
204 Mercurial repository, ignoring labels, branches and integrations. Note
205 that when a depot path is given you then usually should specify a target
205 that when a depot path is given you then usually should specify a target
206 directory, because otherwise the target may be named ...-hg.
206 directory, because otherwise the target may be named ...-hg.
207
207
208 It is possible to limit the amount of source history to be converted by
208 It is possible to limit the amount of source history to be converted by
209 specifying an initial Perforce revision.
209 specifying an initial Perforce revision.
210
210
211 --config convert.p4.startrev=0 (perforce changelist number)
211 --config convert.p4.startrev=0 (perforce changelist number)
212 specify initial Perforce revision.
212 specify initial Perforce revision.
213
213
214
214
215 Mercurial Destination
215 Mercurial Destination
216 ---------------------
216 ---------------------
217
217
218 --config convert.hg.clonebranches=False (boolean)
218 --config convert.hg.clonebranches=False (boolean)
219 dispatch source branches in separate clones.
219 dispatch source branches in separate clones.
220 --config convert.hg.tagsbranch=default (branch name)
220 --config convert.hg.tagsbranch=default (branch name)
221 tag revisions branch name
221 tag revisions branch name
222 --config convert.hg.usebranchnames=True (boolean)
222 --config convert.hg.usebranchnames=True (boolean)
223 preserve branch names
223 preserve branch names
224
224
225 """
225 """
226 return convcmd.convert(ui, src, dest, revmapfile, **opts)
226 return convcmd.convert(ui, src, dest, revmapfile, **opts)
227
227
228 def debugsvnlog(ui, **opts):
228 def debugsvnlog(ui, **opts):
229 return subversion.debugsvnlog(ui, **opts)
229 return subversion.debugsvnlog(ui, **opts)
230
230
231 def debugcvsps(ui, *args, **opts):
231 def debugcvsps(ui, *args, **opts):
232 '''create changeset information from CVS
232 '''create changeset information from CVS
233
233
234 This command is intended as a debugging tool for the CVS to Mercurial
234 This command is intended as a debugging tool for the CVS to Mercurial
235 converter, and can be used as a direct replacement for cvsps.
235 converter, and can be used as a direct replacement for cvsps.
236
236
237 Hg debugcvsps reads the CVS rlog for current directory (or any named
237 Hg debugcvsps reads the CVS rlog for current directory (or any named
238 directory) in the CVS repository, and converts the log to a series of
238 directory) in the CVS repository, and converts the log to a series of
239 changesets based on matching commit log entries and dates.
239 changesets based on matching commit log entries and dates.
240 '''
240 '''
241 return cvsps.debugcvsps(ui, *args, **opts)
241 return cvsps.debugcvsps(ui, *args, **opts)
242
242
243 commands.norepo += " convert debugsvnlog debugcvsps"
243 commands.norepo += " convert debugsvnlog debugcvsps"
244
244
245 cmdtable = {
245 cmdtable = {
246 "convert":
246 "convert":
247 (convert,
247 (convert,
248 [('A', 'authors', '', _('username mapping filename')),
248 [('A', 'authors', '', _('username mapping filename')),
249 ('d', 'dest-type', '', _('destination repository type')),
249 ('d', 'dest-type', '', _('destination repository type')),
250 ('', 'filemap', '', _('remap file names using contents of file')),
250 ('', 'filemap', '', _('remap file names using contents of file')),
251 ('r', 'rev', '', _('import up to target revision REV')),
251 ('r', 'rev', '', _('import up to target revision REV')),
252 ('s', 'source-type', '', _('source repository type')),
252 ('s', 'source-type', '', _('source repository type')),
253 ('', 'splicemap', '', _('splice synthesized history into place')),
253 ('', 'splicemap', '', _('splice synthesized history into place')),
254 ('', 'branchmap', '', _('change branch names while converting')),
254 ('', 'branchmap', '', _('change branch names while converting')),
255 ('', 'branchsort', None, _('try to sort changesets by branches')),
255 ('', 'branchsort', None, _('try to sort changesets by branches')),
256 ('', 'datesort', None, _('try to sort changesets by date')),
256 ('', 'datesort', None, _('try to sort changesets by date')),
257 ('', 'sourcesort', None, _('preserve source changesets order'))],
257 ('', 'sourcesort', None, _('preserve source changesets order'))],
258 _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]')),
258 _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]')),
259 "debugsvnlog":
259 "debugsvnlog":
260 (debugsvnlog,
260 (debugsvnlog,
261 [],
261 [],
262 'hg debugsvnlog'),
262 'hg debugsvnlog'),
263 "debugcvsps":
263 "debugcvsps":
264 (debugcvsps,
264 (debugcvsps,
265 [
265 [
266 # Main options shared with cvsps-2.1
266 # Main options shared with cvsps-2.1
267 ('b', 'branches', [], _('only return changes on specified branches')),
267 ('b', 'branches', [], _('only return changes on specified branches')),
268 ('p', 'prefix', '', _('prefix to remove from file names')),
268 ('p', 'prefix', '', _('prefix to remove from file names')),
269 ('r', 'revisions', [], _('only return changes after or between specified tags')),
269 ('r', 'revisions', [], _('only return changes after or between specified tags')),
270 ('u', 'update-cache', None, _("update cvs log cache")),
270 ('u', 'update-cache', None, _("update cvs log cache")),
271 ('x', 'new-cache', None, _("create new cvs log cache")),
271 ('x', 'new-cache', None, _("create new cvs log cache")),
272 ('z', 'fuzz', 60, _('set commit time fuzz in seconds')),
272 ('z', 'fuzz', 60, _('set commit time fuzz in seconds')),
273 ('', 'root', '', _('specify cvsroot')),
273 ('', 'root', '', _('specify cvsroot')),
274 # Options specific to builtin cvsps
274 # Options specific to builtin cvsps
275 ('', 'parents', '', _('show parent changesets')),
275 ('', 'parents', '', _('show parent changesets')),
276 ('', 'ancestors', '', _('show current changeset in ancestor branches')),
276 ('', 'ancestors', '', _('show current changeset in ancestor branches')),
277 # Options that are ignored for compatibility with cvsps-2.1
277 # Options that are ignored for compatibility with cvsps-2.1
278 ('A', 'cvs-direct', None, _('ignored for compatibility')),
278 ('A', 'cvs-direct', None, _('ignored for compatibility')),
279 ],
279 ],
280 _('hg debugcvsps [OPTION]... [PATH]...')),
280 _('hg debugcvsps [OPTION]... [PATH]...')),
281 }
281 }
@@ -1,269 +1,269 b''
1 hg convert [OPTION]... SOURCE [DEST [REVMAP]]
1 hg convert [OPTION]... SOURCE [DEST [REVMAP]]
2
2
3 convert a foreign SCM repository to a Mercurial one.
3 convert a foreign SCM repository to a Mercurial one.
4
4
5 Accepted source formats [identifiers]:
5 Accepted source formats [identifiers]:
6 - Mercurial [hg]
6 - Mercurial [hg]
7 - CVS [cvs]
7 - CVS [cvs]
8 - Darcs [darcs]
8 - Darcs [darcs]
9 - git [git]
9 - git [git]
10 - Subversion [svn]
10 - Subversion [svn]
11 - Monotone [mtn]
11 - Monotone [mtn]
12 - GNU Arch [gnuarch]
12 - GNU Arch [gnuarch]
13 - Bazaar [bzr]
13 - Bazaar [bzr]
14 - Perforce [p4]
14 - Perforce [p4]
15
15
16 Accepted destination formats [identifiers]:
16 Accepted destination formats [identifiers]:
17 - Mercurial [hg]
17 - Mercurial [hg]
18 - Subversion [svn] (history on branches is not preserved)
18 - Subversion [svn] (history on branches is not preserved)
19
19
20 If no revision is given, all revisions will be converted. Otherwise,
20 If no revision is given, all revisions will be converted. Otherwise,
21 convert will only import up to the named revision (given in a format
21 convert will only import up to the named revision (given in a format
22 understood by the source).
22 understood by the source).
23
23
24 If no destination directory name is specified, it defaults to the basename
24 If no destination directory name is specified, it defaults to the basename
25 of the source with '-hg' appended. If the destination repository doesn't
25 of the source with '-hg' appended. If the destination repository doesn't
26 exist, it will be created.
26 exist, it will be created.
27
27
28 By default, all sources except Mercurial will use --branchsort. Mercurial
28 By default, all sources except Mercurial will use --branchsort. Mercurial
29 uses --sourcesort to preserve original revision numbers order. Sort modes
29 uses --sourcesort to preserve original revision numbers order. Sort modes
30 have the following effects:
30 have the following effects:
31 --branchsort: convert from parent to child revision when possible, which
31 --branchsort: convert from parent to child revision when possible, which
32 means branches are usually converted one after the other. It generates
32 means branches are usually converted one after the other. It generates
33 more compact repositories.
33 more compact repositories.
34 --datesort: sort revisions by date. Converted repositories have
34 --datesort: sort revisions by date. Converted repositories have
35 good-looking changelogs but are often an order of magnitude larger
35 good-looking changelogs but are often an order of magnitude larger
36 than the same ones generated by --branchsort.
36 than the same ones generated by --branchsort.
37 --sourcesort: try to preserve source revisions order, only supported by
37 --sourcesort: try to preserve source revisions order, only supported by
38 Mercurial sources.
38 Mercurial sources.
39
39
40 If <REVMAP> isn't given, it will be put in a default location
40 If <REVMAP> isn't given, it will be put in a default location
41 (<dest>/.hg/shamap by default). The <REVMAP> is a simple text file that
41 (<dest>/.hg/shamap by default). The <REVMAP> is a simple text file that
42 maps each source commit ID to the destination ID for that revision, like
42 maps each source commit ID to the destination ID for that revision, like
43 so:
43 so:
44
44
45 <source ID> <destination ID>
45 <source ID> <destination ID>
46
46
47 If the file doesn't exist, it's automatically created. It's updated on
47 If the file doesn't exist, it's automatically created. It's updated on
48 each commit copied, so convert-repo can be interrupted and can be run
48 each commit copied, so convert-repo can be interrupted and can be run
49 repeatedly to copy new commits.
49 repeatedly to copy new commits.
50
50
51 The [username mapping] file is a simple text file that maps each source
51 The [username mapping] file is a simple text file that maps each source
52 commit author to a destination commit author. It is handy for source SCMs
52 commit author to a destination commit author. It is handy for source SCMs
53 that use unix logins to identify authors (eg: CVS). One line per author
53 that use unix logins to identify authors (eg: CVS). One line per author
54 mapping and the line format is: srcauthor=whatever string you want
54 mapping and the line format is: srcauthor=whatever string you want
55
55
56 The filemap is a file that allows filtering and remapping of files and
56 The filemap is a file that allows filtering and remapping of files and
57 directories. Comment lines start with '#'. Each line can contain one of
57 directories. Comment lines start with '#'. Each line can contain one of
58 the following directives:
58 the following directives:
59
59
60 include path/to/file
60 include path/to/file
61
61
62 exclude path/to/file
62 exclude path/to/file
63
63
64 rename from/file to/file
64 rename from/file to/file
65
65
66 The 'include' directive causes a file, or all files under a directory, to
66 The 'include' directive causes a file, or all files under a directory, to
67 be included in the destination repository, and the exclusion of all other
67 be included in the destination repository, and the exclusion of all other
68 files and directories not explicitly included. The 'exclude' directive
68 files and directories not explicitly included. The 'exclude' directive
69 causes files or directories to be omitted. The 'rename' directive renames
69 causes files or directories to be omitted. The 'rename' directive renames
70 a file or directory. To rename from a subdirectory into the root of the
70 a file or directory. To rename from a subdirectory into the root of the
71 repository, use '.' as the path to rename to.
71 repository, use '.' as the path to rename to.
72
72
73 The splicemap is a file that allows insertion of synthetic history,
73 The splicemap is a file that allows insertion of synthetic history,
74 letting you specify the parents of a revision. This is useful if you want
74 letting you specify the parents of a revision. This is useful if you want
75 to e.g. give a Subversion merge two parents, or graft two disconnected
75 to e.g. give a Subversion merge two parents, or graft two disconnected
76 series of history together. Each entry contains a key, followed by a
76 series of history together. Each entry contains a key, followed by a
77 space, followed by one or two comma-separated values. The key is the
77 space, followed by one or two comma-separated values. The key is the
78 revision ID in the source revision control system whose parents should be
78 revision ID in the source revision control system whose parents should be
79 modified (same format as a key in .hg/shamap). The values are the revision
79 modified (same format as a key in .hg/shamap). The values are the revision
80 IDs (in either the source or destination revision control system) that
80 IDs (in either the source or destination revision control system) that
81 should be used as the new parents for that node.
81 should be used as the new parents for that node.
82
82
83 The branchmap is a file that allows you to rename a branch when it is
83 The branchmap is a file that allows you to rename a branch when it is
84 being brought in from whatever external repository. When used in
84 being brought in from whatever external repository. When used in
85 conjunction with a splicemap, it allows for a powerful combination to help
85 conjunction with a splicemap, it allows for a powerful combination to help
86 fix even the most badly mismanaged repositories and turn them into nicely
86 fix even the most badly mismanaged repositories and turn them into nicely
87 structured Mercurial repositories. The branchmap contains lines of the
87 structured Mercurial repositories. The branchmap contains lines of the
88 form "original_branch_name new_branch_name". "original_branch_name" is the
88 form "original_branch_name new_branch_name". "original_branch_name" is the
89 name of the branch in the source repository, and "new_branch_name" is the
89 name of the branch in the source repository, and "new_branch_name" is the
90 name of the branch is the destination repository. This can be used to (for
90 name of the branch is the destination repository. This can be used to (for
91 instance) move code in one repository from "default" to a named branch.
91 instance) move code in one repository from "default" to a named branch.
92
92
93 Mercurial Source
93 Mercurial Source
94 -----------------
94 ----------------
95
95
96 --config convert.hg.ignoreerrors=False (boolean)
96 --config convert.hg.ignoreerrors=False (boolean)
97 ignore integrity errors when reading. Use it to fix Mercurial
97 ignore integrity errors when reading. Use it to fix Mercurial
98 repositories with missing revlogs, by converting from and to
98 repositories with missing revlogs, by converting from and to
99 Mercurial.
99 Mercurial.
100 --config convert.hg.saverev=False (boolean)
100 --config convert.hg.saverev=False (boolean)
101 store original revision ID in changeset (forces target IDs to change)
101 store original revision ID in changeset (forces target IDs to change)
102 --config convert.hg.startrev=0 (hg revision identifier)
102 --config convert.hg.startrev=0 (hg revision identifier)
103 convert start revision and its descendants
103 convert start revision and its descendants
104
104
105 CVS Source
105 CVS Source
106 ----------
106 ----------
107
107
108 CVS source will use a sandbox (i.e. a checked-out copy) from CVS to
108 CVS source will use a sandbox (i.e. a checked-out copy) from CVS to
109 indicate the starting point of what will be converted. Direct access to
109 indicate the starting point of what will be converted. Direct access to
110 the repository files is not needed, unless of course the repository is
110 the repository files is not needed, unless of course the repository is
111 :local:. The conversion uses the top level directory in the sandbox to
111 :local:. The conversion uses the top level directory in the sandbox to
112 find the CVS repository, and then uses CVS rlog commands to find files to
112 find the CVS repository, and then uses CVS rlog commands to find files to
113 convert. This means that unless a filemap is given, all files under the
113 convert. This means that unless a filemap is given, all files under the
114 starting directory will be converted, and that any directory
114 starting directory will be converted, and that any directory
115 reorganization in the CVS sandbox is ignored.
115 reorganization in the CVS sandbox is ignored.
116
116
117 Because CVS does not have changesets, it is necessary to collect
117 Because CVS does not have changesets, it is necessary to collect
118 individual commits to CVS and merge them into changesets. CVS source uses
118 individual commits to CVS and merge them into changesets. CVS source uses
119 its internal changeset merging code by default but can be configured to
119 its internal changeset merging code by default but can be configured to
120 call the external 'cvsps' program by setting:
120 call the external 'cvsps' program by setting:
121
121
122 --config convert.cvsps='cvsps -A -u --cvs-direct -q'
122 --config convert.cvsps='cvsps -A -u --cvs-direct -q'
123
123
124 This option is deprecated and will be removed in Mercurial 1.4.
124 This option is deprecated and will be removed in Mercurial 1.4.
125
125
126 The options shown are the defaults.
126 The options shown are the defaults.
127
127
128 Internal cvsps is selected by setting
128 Internal cvsps is selected by setting
129
129
130 --config convert.cvsps=builtin
130 --config convert.cvsps=builtin
131
131
132 and has a few more configurable options:
132 and has a few more configurable options:
133 --config convert.cvsps.cache=True (boolean)
133 --config convert.cvsps.cache=True (boolean)
134 Set to False to disable remote log caching, for testing and
134 Set to False to disable remote log caching, for testing and
135 debugging purposes.
135 debugging purposes.
136 --config convert.cvsps.fuzz=60 (integer)
136 --config convert.cvsps.fuzz=60 (integer)
137 Specify the maximum time (in seconds) that is allowed between
137 Specify the maximum time (in seconds) that is allowed between
138 commits with identical user and log message in a single changeset.
138 commits with identical user and log message in a single changeset.
139 When very large files were checked in as part of a changeset then
139 When very large files were checked in as part of a changeset then
140 the default may not be long enough.
140 the default may not be long enough.
141 --config convert.cvsps.mergeto='{{mergetobranch ([-\w]+)}}'
141 --config convert.cvsps.mergeto='{{mergetobranch ([-\w]+)}}'
142 Specify a regular expression to which commit log messages are
142 Specify a regular expression to which commit log messages are
143 matched. If a match occurs, then the conversion process will
143 matched. If a match occurs, then the conversion process will
144 insert a dummy revision merging the branch on which this log
144 insert a dummy revision merging the branch on which this log
145 message occurs to the branch indicated in the regex.
145 message occurs to the branch indicated in the regex.
146 --config convert.cvsps.mergefrom='{{mergefrombranch ([-\w]+)}}'
146 --config convert.cvsps.mergefrom='{{mergefrombranch ([-\w]+)}}'
147 Specify a regular expression to which commit log messages are
147 Specify a regular expression to which commit log messages are
148 matched. If a match occurs, then the conversion process will add
148 matched. If a match occurs, then the conversion process will add
149 the most recent revision on the branch indicated in the regex as
149 the most recent revision on the branch indicated in the regex as
150 the second parent of the changeset.
150 the second parent of the changeset.
151
151
152 The hgext/convert/cvsps wrapper script allows the builtin changeset
152 The hgext/convert/cvsps wrapper script allows the builtin changeset
153 merging code to be run without doing a conversion. Its parameters and
153 merging code to be run without doing a conversion. Its parameters and
154 output are similar to that of cvsps 2.1.
154 output are similar to that of cvsps 2.1.
155
155
156 Subversion Source
156 Subversion Source
157 -----------------
157 -----------------
158
158
159 Subversion source detects classical trunk/branches/tags layouts. By
159 Subversion source detects classical trunk/branches/tags layouts. By
160 default, the supplied "svn://repo/path/" source URL is converted as a
160 default, the supplied "svn://repo/path/" source URL is converted as a
161 single branch. If "svn://repo/path/trunk" exists it replaces the default
161 single branch. If "svn://repo/path/trunk" exists it replaces the default
162 branch. If "svn://repo/path/branches" exists, its subdirectories are
162 branch. If "svn://repo/path/branches" exists, its subdirectories are
163 listed as possible branches. If "svn://repo/path/tags" exists, it is
163 listed as possible branches. If "svn://repo/path/tags" exists, it is
164 looked for tags referencing converted branches. Default "trunk",
164 looked for tags referencing converted branches. Default "trunk",
165 "branches" and "tags" values can be overridden with following options. Set
165 "branches" and "tags" values can be overridden with following options. Set
166 them to paths relative to the source URL, or leave them blank to disable
166 them to paths relative to the source URL, or leave them blank to disable
167 auto detection.
167 auto detection.
168
168
169 --config convert.svn.branches=branches (directory name)
169 --config convert.svn.branches=branches (directory name)
170 specify the directory containing branches
170 specify the directory containing branches
171 --config convert.svn.tags=tags (directory name)
171 --config convert.svn.tags=tags (directory name)
172 specify the directory containing tags
172 specify the directory containing tags
173 --config convert.svn.trunk=trunk (directory name)
173 --config convert.svn.trunk=trunk (directory name)
174 specify the name of the trunk branch
174 specify the name of the trunk branch
175
175
176 Source history can be retrieved starting at a specific revision, instead
176 Source history can be retrieved starting at a specific revision, instead
177 of being integrally converted. Only single branch conversions are
177 of being integrally converted. Only single branch conversions are
178 supported.
178 supported.
179
179
180 --config convert.svn.startrev=0 (svn revision number)
180 --config convert.svn.startrev=0 (svn revision number)
181 specify start Subversion revision.
181 specify start Subversion revision.
182
182
183 Perforce Source
183 Perforce Source
184 ---------------
184 ---------------
185
185
186 The Perforce (P4) importer can be given a p4 depot path or a client
186 The Perforce (P4) importer can be given a p4 depot path or a client
187 specification as source. It will convert all files in the source to a flat
187 specification as source. It will convert all files in the source to a flat
188 Mercurial repository, ignoring labels, branches and integrations. Note
188 Mercurial repository, ignoring labels, branches and integrations. Note
189 that when a depot path is given you then usually should specify a target
189 that when a depot path is given you then usually should specify a target
190 directory, because otherwise the target may be named ...-hg.
190 directory, because otherwise the target may be named ...-hg.
191
191
192 It is possible to limit the amount of source history to be converted by
192 It is possible to limit the amount of source history to be converted by
193 specifying an initial Perforce revision.
193 specifying an initial Perforce revision.
194
194
195 --config convert.p4.startrev=0 (perforce changelist number)
195 --config convert.p4.startrev=0 (perforce changelist number)
196 specify initial Perforce revision.
196 specify initial Perforce revision.
197
197
198
198
199 Mercurial Destination
199 Mercurial Destination
200 ---------------------
200 ---------------------
201
201
202 --config convert.hg.clonebranches=False (boolean)
202 --config convert.hg.clonebranches=False (boolean)
203 dispatch source branches in separate clones.
203 dispatch source branches in separate clones.
204 --config convert.hg.tagsbranch=default (branch name)
204 --config convert.hg.tagsbranch=default (branch name)
205 tag revisions branch name
205 tag revisions branch name
206 --config convert.hg.usebranchnames=True (boolean)
206 --config convert.hg.usebranchnames=True (boolean)
207 preserve branch names
207 preserve branch names
208
208
209 options:
209 options:
210
210
211 -A --authors username mapping filename
211 -A --authors username mapping filename
212 -d --dest-type destination repository type
212 -d --dest-type destination repository type
213 --filemap remap file names using contents of file
213 --filemap remap file names using contents of file
214 -r --rev import up to target revision REV
214 -r --rev import up to target revision REV
215 -s --source-type source repository type
215 -s --source-type source repository type
216 --splicemap splice synthesized history into place
216 --splicemap splice synthesized history into place
217 --branchmap change branch names while converting
217 --branchmap change branch names while converting
218 --branchsort try to sort changesets by branches
218 --branchsort try to sort changesets by branches
219 --datesort try to sort changesets by date
219 --datesort try to sort changesets by date
220 --sourcesort preserve source changesets order
220 --sourcesort preserve source changesets order
221
221
222 use "hg -v help convert" to show global options
222 use "hg -v help convert" to show global options
223 adding a
223 adding a
224 assuming destination a-hg
224 assuming destination a-hg
225 initializing destination a-hg repository
225 initializing destination a-hg repository
226 scanning source...
226 scanning source...
227 sorting...
227 sorting...
228 converting...
228 converting...
229 4 a
229 4 a
230 3 b
230 3 b
231 2 c
231 2 c
232 1 d
232 1 d
233 0 e
233 0 e
234 pulling from ../a
234 pulling from ../a
235 searching for changes
235 searching for changes
236 no changes found
236 no changes found
237 % should fail
237 % should fail
238 initializing destination bogusfile repository
238 initializing destination bogusfile repository
239 abort: cannot create new bundle repository
239 abort: cannot create new bundle repository
240 % should fail
240 % should fail
241 abort: Permission denied: bogusdir
241 abort: Permission denied: bogusdir
242 % should succeed
242 % should succeed
243 initializing destination bogusdir repository
243 initializing destination bogusdir repository
244 scanning source...
244 scanning source...
245 sorting...
245 sorting...
246 converting...
246 converting...
247 4 a
247 4 a
248 3 b
248 3 b
249 2 c
249 2 c
250 1 d
250 1 d
251 0 e
251 0 e
252 % test pre and post conversion actions
252 % test pre and post conversion actions
253 run hg source pre-conversion action
253 run hg source pre-conversion action
254 run hg sink pre-conversion action
254 run hg sink pre-conversion action
255 run hg sink post-conversion action
255 run hg sink post-conversion action
256 run hg source post-conversion action
256 run hg source post-conversion action
257 % converting empty dir should fail nicely
257 % converting empty dir should fail nicely
258 assuming destination emptydir-hg
258 assuming destination emptydir-hg
259 initializing destination emptydir-hg repository
259 initializing destination emptydir-hg repository
260 emptydir does not look like a CVS checkout
260 emptydir does not look like a CVS checkout
261 emptydir does not look like a Git repo
261 emptydir does not look like a Git repo
262 emptydir does not look like a Subversion repo
262 emptydir does not look like a Subversion repo
263 emptydir is not a local Mercurial repo
263 emptydir is not a local Mercurial repo
264 emptydir does not look like a darcs repo
264 emptydir does not look like a darcs repo
265 emptydir does not look like a monotone repo
265 emptydir does not look like a monotone repo
266 emptydir does not look like a GNU Arch repo
266 emptydir does not look like a GNU Arch repo
267 emptydir does not look like a Bazaar repo
267 emptydir does not look like a Bazaar repo
268 cannot find required "p4" tool
268 cannot find required "p4" tool
269 abort: emptydir: missing or unsupported repository
269 abort: emptydir: missing or unsupported repository
General Comments 0
You need to be logged in to leave comments. Login now