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