Show More
@@ -1,307 +1,318 | |||
|
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 | 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 | CVS). One line per author mapping and the line format is: | |
|
77 | srcauthor=whatever string you want | |
|
76 | CVS). One line per author mapping and the line format is:: | |
|
77 | ||
|
78 | source author = destination author | |
|
79 | ||
|
80 | Empty lines and lines starting with a ``#`` are ignored. | |
|
78 | 81 | |
|
79 | 82 | The filemap is a file that allows filtering and remapping of files |
|
80 | 83 | and directories. Each line can contain one of the following |
|
81 | 84 | directives:: |
|
82 | 85 | |
|
83 | 86 | include path/to/file-or-dir |
|
84 | 87 | |
|
85 | 88 | exclude path/to/file-or-dir |
|
86 | 89 | |
|
87 | 90 | rename path/to/source path/to/destination |
|
88 | 91 | |
|
89 | 92 | Comment lines start with '#'. A specificed path matches if it |
|
90 | 93 | equals the full relative name of a file or one of its parent |
|
91 | 94 | directories. The 'include' or 'exclude' directive with the longest |
|
92 | 95 | matching path applies, so line order does not matter. |
|
93 | 96 | |
|
94 | 97 | The 'include' directive causes a file, or all files under a |
|
95 | 98 | directory, to be included in the destination repository, and the |
|
96 | 99 | exclusion of all other files and directories not explicitly |
|
97 | 100 | included. The 'exclude' directive causes files or directories to |
|
98 | 101 | be omitted. The 'rename' directive renames a file or directory if |
|
99 | 102 | is converted. To rename from a subdirectory into the root of the |
|
100 | 103 | repository, use '.' as the path to rename to. |
|
101 | 104 | |
|
102 | 105 | The splicemap is a file that allows insertion of synthetic |
|
103 | 106 | history, letting you specify the parents of a revision. This is |
|
104 | 107 | useful if you want to e.g. give a Subversion merge two parents, or |
|
105 | 108 | graft two disconnected series of history together. Each entry |
|
106 | 109 | contains a key, followed by a space, followed by one or two |
|
107 | comma-separated values. The key is the revision ID in the source | |
|
110 | comma-separated values:: | |
|
111 | ||
|
112 | key parent1, parent2 | |
|
113 | ||
|
114 | The key is the revision ID in the source | |
|
108 | 115 | revision control system whose parents should be modified (same |
|
109 | 116 | format as a key in .hg/shamap). The values are the revision IDs |
|
110 | 117 | (in either the source or destination revision control system) that |
|
111 | 118 | should be used as the new parents for that node. For example, if |
|
112 | 119 | you have merged "release-1.0" into "trunk", then you should |
|
113 | 120 | specify the revision on "trunk" as the first parent and the one on |
|
114 | 121 | the "release-1.0" branch as the second. |
|
115 | 122 | |
|
116 | 123 | The branchmap is a file that allows you to rename a branch when it is |
|
117 | 124 | being brought in from whatever external repository. When used in |
|
118 | 125 | conjunction with a splicemap, it allows for a powerful combination |
|
119 | 126 | to help fix even the most badly mismanaged repositories and turn them |
|
120 | 127 | into nicely structured Mercurial repositories. The branchmap contains |
|
121 | lines of the form "original_branch_name new_branch_name". | |
|
122 | "original_branch_name" is the name of the branch in the source | |
|
123 | repository, and "new_branch_name" is the name of the branch is the | |
|
124 | destination repository. This can be used to (for instance) move code | |
|
125 | in one repository from "default" to a named branch. | |
|
128 | lines of the form:: | |
|
129 | ||
|
130 | original_branch_name new_branch_name | |
|
131 | ||
|
132 | where "original_branch_name" is the name of the branch in the | |
|
133 | source repository, and "new_branch_name" is the name of the branch | |
|
134 | is the destination repository. No whitespace is allowed in the | |
|
135 | branch names. This can be used to (for instance) move code in one | |
|
136 | repository from "default" to a named branch. | |
|
126 | 137 | |
|
127 | 138 | Mercurial Source |
|
128 | 139 | ---------------- |
|
129 | 140 | |
|
130 | 141 | --config convert.hg.ignoreerrors=False (boolean) |
|
131 | 142 | ignore integrity errors when reading. Use it to fix Mercurial |
|
132 | 143 | repositories with missing revlogs, by converting from and to |
|
133 | 144 | Mercurial. |
|
134 | 145 | --config convert.hg.saverev=False (boolean) |
|
135 | 146 | store original revision ID in changeset (forces target IDs to |
|
136 | 147 | change) |
|
137 | 148 | --config convert.hg.startrev=0 (hg revision identifier) |
|
138 | 149 | convert start revision and its descendants |
|
139 | 150 | |
|
140 | 151 | CVS Source |
|
141 | 152 | ---------- |
|
142 | 153 | |
|
143 | 154 | CVS source will use a sandbox (i.e. a checked-out copy) from CVS |
|
144 | 155 | to indicate the starting point of what will be converted. Direct |
|
145 | 156 | access to the repository files is not needed, unless of course the |
|
146 | 157 | repository is :local:. The conversion uses the top level directory |
|
147 | 158 | in the sandbox to find the CVS repository, and then uses CVS rlog |
|
148 | 159 | commands to find files to convert. This means that unless a |
|
149 | 160 | filemap is given, all files under the starting directory will be |
|
150 | 161 | converted, and that any directory reorganization in the CVS |
|
151 | 162 | sandbox is ignored. |
|
152 | 163 | |
|
153 | 164 | The options shown are the defaults. |
|
154 | 165 | |
|
155 | 166 | --config convert.cvsps.cache=True (boolean) |
|
156 | 167 | Set to False to disable remote log caching, for testing and |
|
157 | 168 | debugging purposes. |
|
158 | 169 | --config convert.cvsps.fuzz=60 (integer) |
|
159 | 170 | Specify the maximum time (in seconds) that is allowed between |
|
160 | 171 | commits with identical user and log message in a single |
|
161 | 172 | changeset. When very large files were checked in as part of a |
|
162 | 173 | changeset then the default may not be long enough. |
|
163 | 174 | --config convert.cvsps.mergeto='{{mergetobranch ([-\\w]+)}}' |
|
164 | 175 | Specify a regular expression to which commit log messages are |
|
165 | 176 | matched. If a match occurs, then the conversion process will |
|
166 | 177 | insert a dummy revision merging the branch on which this log |
|
167 | 178 | message occurs to the branch indicated in the regex. |
|
168 | 179 | --config convert.cvsps.mergefrom='{{mergefrombranch ([-\\w]+)}}' |
|
169 | 180 | Specify a regular expression to which commit log messages are |
|
170 | 181 | matched. If a match occurs, then the conversion process will |
|
171 | 182 | add the most recent revision on the branch indicated in the |
|
172 | 183 | regex as the second parent of the changeset. |
|
173 | 184 | --config hook.cvslog |
|
174 | 185 | Specify a Python function to be called at the end of gathering |
|
175 | 186 | the CVS log. The function is passed a list with the log entries, |
|
176 | 187 | and can modify the entries in-place, or add or delete them. |
|
177 | 188 | --config hook.cvschangesets |
|
178 | 189 | Specify a Python function to be called after the changesets |
|
179 | 190 | are calculated from the the CVS log. The function is passed |
|
180 | 191 | a list with the changeset entries, and can modify the changesets |
|
181 | 192 | in-place, or add or delete them. |
|
182 | 193 | |
|
183 | 194 | An additional "debugcvsps" Mercurial command allows the builtin |
|
184 | 195 | changeset merging code to be run without doing a conversion. Its |
|
185 | 196 | parameters and output are similar to that of cvsps 2.1. Please see |
|
186 | 197 | the command help for more details. |
|
187 | 198 | |
|
188 | 199 | Subversion Source |
|
189 | 200 | ----------------- |
|
190 | 201 | |
|
191 | 202 | Subversion source detects classical trunk/branches/tags layouts. |
|
192 | 203 | By default, the supplied "svn://repo/path/" source URL is |
|
193 | 204 | converted as a single branch. If "svn://repo/path/trunk" exists it |
|
194 | 205 | replaces the default branch. If "svn://repo/path/branches" exists, |
|
195 | 206 | its subdirectories are listed as possible branches. If |
|
196 | 207 | "svn://repo/path/tags" exists, it is looked for tags referencing |
|
197 | 208 | converted branches. Default "trunk", "branches" and "tags" values |
|
198 | 209 | can be overridden with following options. Set them to paths |
|
199 | 210 | relative to the source URL, or leave them blank to disable auto |
|
200 | 211 | detection. |
|
201 | 212 | |
|
202 | 213 | --config convert.svn.branches=branches (directory name) |
|
203 | 214 | specify the directory containing branches |
|
204 | 215 | --config convert.svn.tags=tags (directory name) |
|
205 | 216 | specify the directory containing tags |
|
206 | 217 | --config convert.svn.trunk=trunk (directory name) |
|
207 | 218 | specify the name of the trunk branch |
|
208 | 219 | |
|
209 | 220 | Source history can be retrieved starting at a specific revision, |
|
210 | 221 | instead of being integrally converted. Only single branch |
|
211 | 222 | conversions are supported. |
|
212 | 223 | |
|
213 | 224 | --config convert.svn.startrev=0 (svn revision number) |
|
214 | 225 | specify start Subversion revision. |
|
215 | 226 | |
|
216 | 227 | Perforce Source |
|
217 | 228 | --------------- |
|
218 | 229 | |
|
219 | 230 | The Perforce (P4) importer can be given a p4 depot path or a |
|
220 | 231 | client specification as source. It will convert all files in the |
|
221 | 232 | source to a flat Mercurial repository, ignoring labels, branches |
|
222 | 233 | and integrations. Note that when a depot path is given you then |
|
223 | 234 | usually should specify a target directory, because otherwise the |
|
224 | 235 | target may be named ...-hg. |
|
225 | 236 | |
|
226 | 237 | It is possible to limit the amount of source history to be |
|
227 | 238 | converted by specifying an initial Perforce revision. |
|
228 | 239 | |
|
229 | 240 | --config convert.p4.startrev=0 (perforce changelist number) |
|
230 | 241 | specify initial Perforce revision. |
|
231 | 242 | |
|
232 | 243 | Mercurial Destination |
|
233 | 244 | --------------------- |
|
234 | 245 | |
|
235 | 246 | --config convert.hg.clonebranches=False (boolean) |
|
236 | 247 | dispatch source branches in separate clones. |
|
237 | 248 | --config convert.hg.tagsbranch=default (branch name) |
|
238 | 249 | tag revisions branch name |
|
239 | 250 | --config convert.hg.usebranchnames=True (boolean) |
|
240 | 251 | preserve branch names |
|
241 | 252 | |
|
242 | 253 | """ |
|
243 | 254 | return convcmd.convert(ui, src, dest, revmapfile, **opts) |
|
244 | 255 | |
|
245 | 256 | def debugsvnlog(ui, **opts): |
|
246 | 257 | return subversion.debugsvnlog(ui, **opts) |
|
247 | 258 | |
|
248 | 259 | def debugcvsps(ui, *args, **opts): |
|
249 | 260 | '''create changeset information from CVS |
|
250 | 261 | |
|
251 | 262 | This command is intended as a debugging tool for the CVS to |
|
252 | 263 | Mercurial converter, and can be used as a direct replacement for |
|
253 | 264 | cvsps. |
|
254 | 265 | |
|
255 | 266 | Hg debugcvsps reads the CVS rlog for current directory (or any |
|
256 | 267 | named directory) in the CVS repository, and converts the log to a |
|
257 | 268 | series of changesets based on matching commit log entries and |
|
258 | 269 | dates.''' |
|
259 | 270 | return cvsps.debugcvsps(ui, *args, **opts) |
|
260 | 271 | |
|
261 | 272 | commands.norepo += " convert debugsvnlog debugcvsps" |
|
262 | 273 | |
|
263 | 274 | cmdtable = { |
|
264 | 275 | "convert": |
|
265 | 276 | (convert, |
|
266 | 277 | [('A', 'authors', '', |
|
267 | 278 | _('username mapping filename'), _('FILE')), |
|
268 | 279 | ('d', 'dest-type', '', |
|
269 | 280 | _('destination repository type'), _('TYPE')), |
|
270 | 281 | ('', 'filemap', '', |
|
271 | 282 | _('remap file names using contents of file'), _('FILE')), |
|
272 | 283 | ('r', 'rev', '', |
|
273 | 284 | _('import up to target revision REV'), _('REV')), |
|
274 | 285 | ('s', 'source-type', '', |
|
275 | 286 | _('source repository type'), _('TYPE')), |
|
276 | 287 | ('', 'splicemap', '', |
|
277 | 288 | _('splice synthesized history into place'), _('FILE')), |
|
278 | 289 | ('', 'branchmap', '', |
|
279 | 290 | _('change branch names while converting'), _('FILE')), |
|
280 | 291 | ('', 'branchsort', None, _('try to sort changesets by branches')), |
|
281 | 292 | ('', 'datesort', None, _('try to sort changesets by date')), |
|
282 | 293 | ('', 'sourcesort', None, _('preserve source changesets order'))], |
|
283 | 294 | _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]')), |
|
284 | 295 | "debugsvnlog": |
|
285 | 296 | (debugsvnlog, |
|
286 | 297 | [], |
|
287 | 298 | 'hg debugsvnlog'), |
|
288 | 299 | "debugcvsps": |
|
289 | 300 | (debugcvsps, |
|
290 | 301 | [ |
|
291 | 302 | # Main options shared with cvsps-2.1 |
|
292 | 303 | ('b', 'branches', [], _('only return changes on specified branches')), |
|
293 | 304 | ('p', 'prefix', '', _('prefix to remove from file names')), |
|
294 | 305 | ('r', 'revisions', [], |
|
295 | 306 | _('only return changes after or between specified tags')), |
|
296 | 307 | ('u', 'update-cache', None, _("update cvs log cache")), |
|
297 | 308 | ('x', 'new-cache', None, _("create new cvs log cache")), |
|
298 | 309 | ('z', 'fuzz', 60, _('set commit time fuzz in seconds')), |
|
299 | 310 | ('', 'root', '', _('specify cvsroot')), |
|
300 | 311 | # Options specific to builtin cvsps |
|
301 | 312 | ('', 'parents', '', _('show parent changesets')), |
|
302 | 313 | ('', 'ancestors', '', _('show current changeset in ancestor branches')), |
|
303 | 314 | # Options that are ignored for compatibility with cvsps-2.1 |
|
304 | 315 | ('A', 'cvs-direct', None, _('ignored for compatibility')), |
|
305 | 316 | ], |
|
306 | 317 | _('hg debugcvsps [OPTION]... [PATH]...')), |
|
307 | 318 | } |
@@ -1,306 +1,318 | |||
|
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 |
mapping and the line format is: |
|
|
57 | mapping and the line format is: | |
|
58 | ||
|
59 | source author = destination author | |
|
60 | ||
|
61 | Empty lines and lines starting with a "#" are ignored. | |
|
58 | 62 | |
|
59 | 63 | The filemap is a file that allows filtering and remapping of files and |
|
60 | 64 | directories. Each line can contain one of the following directives: |
|
61 | 65 | |
|
62 | 66 | include path/to/file-or-dir |
|
63 | 67 | |
|
64 | 68 | exclude path/to/file-or-dir |
|
65 | 69 | |
|
66 | 70 | rename path/to/source path/to/destination |
|
67 | 71 | |
|
68 | 72 | Comment lines start with '#'. A specificed path matches if it equals the |
|
69 | 73 | full relative name of a file or one of its parent directories. The |
|
70 | 74 | 'include' or 'exclude' directive with the longest matching path applies, |
|
71 | 75 | so line order does not matter. |
|
72 | 76 | |
|
73 | 77 | The 'include' directive causes a file, or all files under a directory, to |
|
74 | 78 | be included in the destination repository, and the exclusion of all other |
|
75 | 79 | files and directories not explicitly included. The 'exclude' directive |
|
76 | 80 | causes files or directories to be omitted. The 'rename' directive renames |
|
77 | 81 | a file or directory if is converted. To rename from a subdirectory into |
|
78 | 82 | the root of the repository, use '.' as the path to rename to. |
|
79 | 83 | |
|
80 | 84 | The splicemap is a file that allows insertion of synthetic history, |
|
81 | 85 | letting you specify the parents of a revision. This is useful if you want |
|
82 | 86 | to e.g. give a Subversion merge two parents, or graft two disconnected |
|
83 | 87 | series of history together. Each entry contains a key, followed by a |
|
84 |
space, followed by one or two comma-separated values |
|
|
85 | revision ID in the source revision control system whose parents should be | |
|
86 | modified (same format as a key in .hg/shamap). The values are the revision | |
|
87 | IDs (in either the source or destination revision control system) that | |
|
88 | should be used as the new parents for that node. For example, if you have | |
|
89 | merged "release-1.0" into "trunk", then you should specify the revision on | |
|
90 | "trunk" as the first parent and the one on the "release-1.0" branch as the | |
|
91 | second. | |
|
88 | space, followed by one or two comma-separated values: | |
|
89 | ||
|
90 | key parent1, parent2 | |
|
91 | ||
|
92 | The key is the revision ID in the source revision control system whose | |
|
93 | parents should be modified (same format as a key in .hg/shamap). The | |
|
94 | values are the revision IDs (in either the source or destination revision | |
|
95 | control system) that should be used as the new parents for that node. For | |
|
96 | example, if you have merged "release-1.0" into "trunk", then you should | |
|
97 | specify the revision on "trunk" as the first parent and the one on the | |
|
98 | "release-1.0" branch as the second. | |
|
92 | 99 | |
|
93 | 100 | The branchmap is a file that allows you to rename a branch when it is |
|
94 | 101 | being brought in from whatever external repository. When used in |
|
95 | 102 | conjunction with a splicemap, it allows for a powerful combination to help |
|
96 | 103 | fix even the most badly mismanaged repositories and turn them into nicely |
|
97 | 104 | structured Mercurial repositories. The branchmap contains lines of the |
|
98 | form "original_branch_name new_branch_name". "original_branch_name" is the | |
|
99 | name of the branch in the source repository, and "new_branch_name" is the | |
|
100 | name of the branch is the destination repository. This can be used to (for | |
|
101 | instance) move code in one repository from "default" to a named branch. | |
|
105 | form: | |
|
106 | ||
|
107 | original_branch_name new_branch_name | |
|
108 | ||
|
109 | where "original_branch_name" is the name of the branch in the source | |
|
110 | repository, and "new_branch_name" is the name of the branch is the | |
|
111 | destination repository. No whitespace is allowed in the branch names. This | |
|
112 | can be used to (for instance) move code in one repository from "default" | |
|
113 | to a named branch. | |
|
102 | 114 | |
|
103 | 115 | Mercurial Source |
|
104 | 116 | ---------------- |
|
105 | 117 | |
|
106 | 118 | --config convert.hg.ignoreerrors=False (boolean) |
|
107 | 119 | ignore integrity errors when reading. Use it to fix Mercurial |
|
108 | 120 | repositories with missing revlogs, by converting from and to |
|
109 | 121 | Mercurial. |
|
110 | 122 | |
|
111 | 123 | --config convert.hg.saverev=False (boolean) |
|
112 | 124 | store original revision ID in changeset (forces target IDs to change) |
|
113 | 125 | |
|
114 | 126 | --config convert.hg.startrev=0 (hg revision identifier) |
|
115 | 127 | convert start revision and its descendants |
|
116 | 128 | |
|
117 | 129 | CVS Source |
|
118 | 130 | ---------- |
|
119 | 131 | |
|
120 | 132 | CVS source will use a sandbox (i.e. a checked-out copy) from CVS to |
|
121 | 133 | indicate the starting point of what will be converted. Direct access to |
|
122 | 134 | the repository files is not needed, unless of course the repository is |
|
123 | 135 | :local:. The conversion uses the top level directory in the sandbox to |
|
124 | 136 | find the CVS repository, and then uses CVS rlog commands to find files to |
|
125 | 137 | convert. This means that unless a filemap is given, all files under the |
|
126 | 138 | starting directory will be converted, and that any directory |
|
127 | 139 | reorganization in the CVS sandbox is ignored. |
|
128 | 140 | |
|
129 | 141 | The options shown are the defaults. |
|
130 | 142 | |
|
131 | 143 | --config convert.cvsps.cache=True (boolean) |
|
132 | 144 | Set to False to disable remote log caching, for testing and debugging |
|
133 | 145 | purposes. |
|
134 | 146 | |
|
135 | 147 | --config convert.cvsps.fuzz=60 (integer) |
|
136 | 148 | Specify the maximum time (in seconds) that is allowed between commits |
|
137 | 149 | with identical user and log message in a single changeset. When very |
|
138 | 150 | large files were checked in as part of a changeset then the default |
|
139 | 151 | may not be long enough. |
|
140 | 152 | |
|
141 | 153 | --config convert.cvsps.mergeto='{{mergetobranch ([-\w]+)}}' |
|
142 | 154 | Specify a regular expression to which commit log messages are matched. |
|
143 | 155 | If a match occurs, then the conversion process will insert a dummy |
|
144 | 156 | revision merging the branch on which this log message occurs to the |
|
145 | 157 | branch indicated in the regex. |
|
146 | 158 | |
|
147 | 159 | --config convert.cvsps.mergefrom='{{mergefrombranch ([-\w]+)}}' |
|
148 | 160 | Specify a regular expression to which commit log messages are matched. |
|
149 | 161 | If a match occurs, then the conversion process will add the most |
|
150 | 162 | recent revision on the branch indicated in the regex as the second |
|
151 | 163 | parent of the changeset. |
|
152 | 164 | |
|
153 | 165 | --config hook.cvslog |
|
154 | 166 | Specify a Python function to be called at the end of gathering the CVS |
|
155 | 167 | log. The function is passed a list with the log entries, and can |
|
156 | 168 | modify the entries in-place, or add or delete them. |
|
157 | 169 | |
|
158 | 170 | --config hook.cvschangesets |
|
159 | 171 | Specify a Python function to be called after the changesets are |
|
160 | 172 | calculated from the the CVS log. The function is passed a list with |
|
161 | 173 | the changeset entries, and can modify the changesets in-place, or add |
|
162 | 174 | or delete them. |
|
163 | 175 | |
|
164 | 176 | An additional "debugcvsps" Mercurial command allows the builtin changeset |
|
165 | 177 | merging code to be run without doing a conversion. Its parameters and |
|
166 | 178 | output are similar to that of cvsps 2.1. Please see the command help for |
|
167 | 179 | more details. |
|
168 | 180 | |
|
169 | 181 | Subversion Source |
|
170 | 182 | ----------------- |
|
171 | 183 | |
|
172 | 184 | Subversion source detects classical trunk/branches/tags layouts. By |
|
173 | 185 | default, the supplied "svn://repo/path/" source URL is converted as a |
|
174 | 186 | single branch. If "svn://repo/path/trunk" exists it replaces the default |
|
175 | 187 | branch. If "svn://repo/path/branches" exists, its subdirectories are |
|
176 | 188 | listed as possible branches. If "svn://repo/path/tags" exists, it is |
|
177 | 189 | looked for tags referencing converted branches. Default "trunk", |
|
178 | 190 | "branches" and "tags" values can be overridden with following options. Set |
|
179 | 191 | them to paths relative to the source URL, or leave them blank to disable |
|
180 | 192 | auto detection. |
|
181 | 193 | |
|
182 | 194 | --config convert.svn.branches=branches (directory name) |
|
183 | 195 | specify the directory containing branches |
|
184 | 196 | |
|
185 | 197 | --config convert.svn.tags=tags (directory name) |
|
186 | 198 | specify the directory containing tags |
|
187 | 199 | |
|
188 | 200 | --config convert.svn.trunk=trunk (directory name) |
|
189 | 201 | specify the name of the trunk branch |
|
190 | 202 | |
|
191 | 203 | Source history can be retrieved starting at a specific revision, instead |
|
192 | 204 | of being integrally converted. Only single branch conversions are |
|
193 | 205 | supported. |
|
194 | 206 | |
|
195 | 207 | --config convert.svn.startrev=0 (svn revision number) |
|
196 | 208 | specify start Subversion revision. |
|
197 | 209 | |
|
198 | 210 | Perforce Source |
|
199 | 211 | --------------- |
|
200 | 212 | |
|
201 | 213 | The Perforce (P4) importer can be given a p4 depot path or a client |
|
202 | 214 | specification as source. It will convert all files in the source to a flat |
|
203 | 215 | Mercurial repository, ignoring labels, branches and integrations. Note |
|
204 | 216 | that when a depot path is given you then usually should specify a target |
|
205 | 217 | directory, because otherwise the target may be named ...-hg. |
|
206 | 218 | |
|
207 | 219 | It is possible to limit the amount of source history to be converted by |
|
208 | 220 | specifying an initial Perforce revision. |
|
209 | 221 | |
|
210 | 222 | --config convert.p4.startrev=0 (perforce changelist number) |
|
211 | 223 | specify initial Perforce revision. |
|
212 | 224 | |
|
213 | 225 | Mercurial Destination |
|
214 | 226 | --------------------- |
|
215 | 227 | |
|
216 | 228 | --config convert.hg.clonebranches=False (boolean) |
|
217 | 229 | dispatch source branches in separate clones. |
|
218 | 230 | |
|
219 | 231 | --config convert.hg.tagsbranch=default (branch name) |
|
220 | 232 | tag revisions branch name |
|
221 | 233 | |
|
222 | 234 | --config convert.hg.usebranchnames=True (boolean) |
|
223 | 235 | preserve branch names |
|
224 | 236 | |
|
225 | 237 | options: |
|
226 | 238 | |
|
227 | 239 | -A --authors FILE username mapping filename |
|
228 | 240 | -d --dest-type TYPE destination repository type |
|
229 | 241 | --filemap FILE remap file names using contents of file |
|
230 | 242 | -r --rev REV import up to target revision REV |
|
231 | 243 | -s --source-type TYPE source repository type |
|
232 | 244 | --splicemap FILE splice synthesized history into place |
|
233 | 245 | --branchmap FILE change branch names while converting |
|
234 | 246 | --branchsort try to sort changesets by branches |
|
235 | 247 | --datesort try to sort changesets by date |
|
236 | 248 | --sourcesort preserve source changesets order |
|
237 | 249 | |
|
238 | 250 | use "hg -v help convert" to show global options |
|
239 | 251 | adding a |
|
240 | 252 | assuming destination a-hg |
|
241 | 253 | initializing destination a-hg repository |
|
242 | 254 | scanning source... |
|
243 | 255 | sorting... |
|
244 | 256 | converting... |
|
245 | 257 | 4 a |
|
246 | 258 | 3 b |
|
247 | 259 | 2 c |
|
248 | 260 | 1 d |
|
249 | 261 | 0 e |
|
250 | 262 | pulling from ../a |
|
251 | 263 | searching for changes |
|
252 | 264 | no changes found |
|
253 | 265 | % should fail |
|
254 | 266 | initializing destination bogusfile repository |
|
255 | 267 | abort: cannot create new bundle repository |
|
256 | 268 | % should fail |
|
257 | 269 | abort: Permission denied: bogusdir |
|
258 | 270 | % should succeed |
|
259 | 271 | initializing destination bogusdir repository |
|
260 | 272 | scanning source... |
|
261 | 273 | sorting... |
|
262 | 274 | converting... |
|
263 | 275 | 4 a |
|
264 | 276 | 3 b |
|
265 | 277 | 2 c |
|
266 | 278 | 1 d |
|
267 | 279 | 0 e |
|
268 | 280 | % test pre and post conversion actions |
|
269 | 281 | run hg source pre-conversion action |
|
270 | 282 | run hg sink pre-conversion action |
|
271 | 283 | run hg sink post-conversion action |
|
272 | 284 | run hg source post-conversion action |
|
273 | 285 | % converting empty dir should fail nicely |
|
274 | 286 | assuming destination emptydir-hg |
|
275 | 287 | initializing destination emptydir-hg repository |
|
276 | 288 | emptydir does not look like a CVS checkout |
|
277 | 289 | emptydir does not look like a Git repository |
|
278 | 290 | emptydir does not look like a Subversion repository |
|
279 | 291 | emptydir is not a local Mercurial repository |
|
280 | 292 | emptydir does not look like a darcs repository |
|
281 | 293 | emptydir does not look like a monotone repository |
|
282 | 294 | emptydir does not look like a GNU Arch repository |
|
283 | 295 | emptydir does not look like a Bazaar repository |
|
284 | 296 | cannot find required "p4" tool |
|
285 | 297 | abort: emptydir: missing or unsupported repository |
|
286 | 298 | % convert with imaginary source type |
|
287 | 299 | initializing destination a-foo repository |
|
288 | 300 | abort: foo: invalid source repository type |
|
289 | 301 | % convert with imaginary sink type |
|
290 | 302 | abort: foo: invalid destination repository type |
|
291 | 303 | |
|
292 | 304 | % testing: convert must not produce duplicate entries in fncache |
|
293 | 305 | initializing destination b repository |
|
294 | 306 | scanning source... |
|
295 | 307 | sorting... |
|
296 | 308 | converting... |
|
297 | 309 | 4 a |
|
298 | 310 | 3 b |
|
299 | 311 | 2 c |
|
300 | 312 | 1 d |
|
301 | 313 | 0 e |
|
302 | 314 | % contents of fncache file: |
|
303 | 315 | data/a.i |
|
304 | 316 | data/b.i |
|
305 | 317 | % test bogus URL |
|
306 | 318 | abort: bzr+ssh://foobar@selenic.com/baz: missing or unsupported repository |
General Comments 0
You need to be logged in to leave comments.
Login now