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