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