Show More
@@ -1,503 +1,503 | |||||
1 | # convert.py Foreign SCM converter |
|
1 | # convert.py Foreign SCM converter | |
2 | # |
|
2 | # | |
3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | '''import revisions from foreign VCS repositories into Mercurial''' |
|
8 | '''import revisions from foreign VCS repositories into Mercurial''' | |
9 |
|
9 | |||
10 | from __future__ import absolute_import |
|
10 | from __future__ import absolute_import | |
11 |
|
11 | |||
12 | from mercurial.i18n import _ |
|
12 | from mercurial.i18n import _ | |
13 | from mercurial import ( |
|
13 | from mercurial import ( | |
14 | registrar, |
|
14 | registrar, | |
15 | ) |
|
15 | ) | |
16 |
|
16 | |||
17 | from . import ( |
|
17 | from . import ( | |
18 | convcmd, |
|
18 | convcmd, | |
19 | cvsps, |
|
19 | cvsps, | |
20 | subversion, |
|
20 | subversion, | |
21 | ) |
|
21 | ) | |
22 |
|
22 | |||
23 | cmdtable = {} |
|
23 | cmdtable = {} | |
24 | command = registrar.command(cmdtable) |
|
24 | command = registrar.command(cmdtable) | |
25 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
25 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
26 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
26 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
27 | # be specifying the version(s) of Mercurial they are tested with, or |
|
27 | # be specifying the version(s) of Mercurial they are tested with, or | |
28 | # leave the attribute unspecified. |
|
28 | # leave the attribute unspecified. | |
29 | testedwith = 'ships-with-hg-core' |
|
29 | testedwith = 'ships-with-hg-core' | |
30 |
|
30 | |||
31 | # Commands definition was moved elsewhere to ease demandload job. |
|
31 | # Commands definition was moved elsewhere to ease demandload job. | |
32 |
|
32 | |||
33 | @command('convert', |
|
33 | @command('convert', | |
34 | [('', 'authors', '', |
|
34 | [('', 'authors', '', | |
35 | _('username mapping filename (DEPRECATED) (use --authormap instead)'), |
|
35 | _('username mapping filename (DEPRECATED) (use --authormap instead)'), | |
36 | _('FILE')), |
|
36 | _('FILE')), | |
37 | ('s', 'source-type', '', _('source repository type'), _('TYPE')), |
|
37 | ('s', 'source-type', '', _('source repository type'), _('TYPE')), | |
38 | ('d', 'dest-type', '', _('destination repository type'), _('TYPE')), |
|
38 | ('d', 'dest-type', '', _('destination repository type'), _('TYPE')), | |
39 | ('r', 'rev', [], _('import up to source revision REV'), _('REV')), |
|
39 | ('r', 'rev', [], _('import up to source revision REV'), _('REV')), | |
40 | ('A', 'authormap', '', _('remap usernames using this file'), _('FILE')), |
|
40 | ('A', 'authormap', '', _('remap usernames using this file'), _('FILE')), | |
41 | ('', 'filemap', '', _('remap file names using contents of file'), |
|
41 | ('', 'filemap', '', _('remap file names using contents of file'), | |
42 | _('FILE')), |
|
42 | _('FILE')), | |
43 | ('', 'full', None, |
|
43 | ('', 'full', None, | |
44 | _('apply filemap changes by converting all files again')), |
|
44 | _('apply filemap changes by converting all files again')), | |
45 | ('', 'splicemap', '', _('splice synthesized history into place'), |
|
45 | ('', 'splicemap', '', _('splice synthesized history into place'), | |
46 | _('FILE')), |
|
46 | _('FILE')), | |
47 | ('', 'branchmap', '', _('change branch names while converting'), |
|
47 | ('', 'branchmap', '', _('change branch names while converting'), | |
48 | _('FILE')), |
|
48 | _('FILE')), | |
49 | ('', 'branchsort', None, _('try to sort changesets by branches')), |
|
49 | ('', 'branchsort', None, _('try to sort changesets by branches')), | |
50 | ('', 'datesort', None, _('try to sort changesets by date')), |
|
50 | ('', 'datesort', None, _('try to sort changesets by date')), | |
51 | ('', 'sourcesort', None, _('preserve source changesets order')), |
|
51 | ('', 'sourcesort', None, _('preserve source changesets order')), | |
52 | ('', 'closesort', None, _('try to reorder closed revisions'))], |
|
52 | ('', 'closesort', None, _('try to reorder closed revisions'))], | |
53 | _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]'), |
|
53 | _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]'), | |
54 | norepo=True) |
|
54 | norepo=True) | |
55 | def convert(ui, src, dest=None, revmapfile=None, **opts): |
|
55 | def convert(ui, src, dest=None, revmapfile=None, **opts): | |
56 | """convert a foreign SCM repository to a Mercurial one. |
|
56 | """convert a foreign SCM repository to a Mercurial one. | |
57 |
|
57 | |||
58 | Accepted source formats [identifiers]: |
|
58 | Accepted source formats [identifiers]: | |
59 |
|
59 | |||
60 | - Mercurial [hg] |
|
60 | - Mercurial [hg] | |
61 | - CVS [cvs] |
|
61 | - CVS [cvs] | |
62 | - Darcs [darcs] |
|
62 | - Darcs [darcs] | |
63 | - git [git] |
|
63 | - git [git] | |
64 | - Subversion [svn] |
|
64 | - Subversion [svn] | |
65 | - Monotone [mtn] |
|
65 | - Monotone [mtn] | |
66 | - GNU Arch [gnuarch] |
|
66 | - GNU Arch [gnuarch] | |
67 | - Bazaar [bzr] |
|
67 | - Bazaar [bzr] | |
68 | - Perforce [p4] |
|
68 | - Perforce [p4] | |
69 |
|
69 | |||
70 | Accepted destination formats [identifiers]: |
|
70 | Accepted destination formats [identifiers]: | |
71 |
|
71 | |||
72 | - Mercurial [hg] |
|
72 | - Mercurial [hg] | |
73 | - Subversion [svn] (history on branches is not preserved) |
|
73 | - Subversion [svn] (history on branches is not preserved) | |
74 |
|
74 | |||
75 | If no revision is given, all revisions will be converted. |
|
75 | If no revision is given, all revisions will be converted. | |
76 | Otherwise, convert will only import up to the named revision |
|
76 | Otherwise, convert will only import up to the named revision | |
77 | (given in a format understood by the source). |
|
77 | (given in a format understood by the source). | |
78 |
|
78 | |||
79 | If no destination directory name is specified, it defaults to the |
|
79 | If no destination directory name is specified, it defaults to the | |
80 | basename of the source with ``-hg`` appended. If the destination |
|
80 | basename of the source with ``-hg`` appended. If the destination | |
81 | repository doesn't exist, it will be created. |
|
81 | repository doesn't exist, it will be created. | |
82 |
|
82 | |||
83 | By default, all sources except Mercurial will use --branchsort. |
|
83 | By default, all sources except Mercurial will use --branchsort. | |
84 | Mercurial uses --sourcesort to preserve original revision numbers |
|
84 | Mercurial uses --sourcesort to preserve original revision numbers | |
85 | order. Sort modes have the following effects: |
|
85 | order. Sort modes have the following effects: | |
86 |
|
86 | |||
87 | --branchsort convert from parent to child revision when possible, |
|
87 | --branchsort convert from parent to child revision when possible, | |
88 | which means branches are usually converted one after |
|
88 | which means branches are usually converted one after | |
89 | the other. It generates more compact repositories. |
|
89 | the other. It generates more compact repositories. | |
90 |
|
90 | |||
91 | --datesort sort revisions by date. Converted repositories have |
|
91 | --datesort sort revisions by date. Converted repositories have | |
92 | good-looking changelogs but are often an order of |
|
92 | good-looking changelogs but are often an order of | |
93 | magnitude larger than the same ones generated by |
|
93 | magnitude larger than the same ones generated by | |
94 | --branchsort. |
|
94 | --branchsort. | |
95 |
|
95 | |||
96 | --sourcesort try to preserve source revisions order, only |
|
96 | --sourcesort try to preserve source revisions order, only | |
97 | supported by Mercurial sources. |
|
97 | supported by Mercurial sources. | |
98 |
|
98 | |||
99 | --closesort try to move closed revisions as close as possible |
|
99 | --closesort try to move closed revisions as close as possible | |
100 | to parent branches, only supported by Mercurial |
|
100 | to parent branches, only supported by Mercurial | |
101 | sources. |
|
101 | sources. | |
102 |
|
102 | |||
103 | If ``REVMAP`` isn't given, it will be put in a default location |
|
103 | If ``REVMAP`` isn't given, it will be put in a default location | |
104 | (``<dest>/.hg/shamap`` by default). The ``REVMAP`` is a simple |
|
104 | (``<dest>/.hg/shamap`` by default). The ``REVMAP`` is a simple | |
105 | text file that maps each source commit ID to the destination ID |
|
105 | text file that maps each source commit ID to the destination ID | |
106 | for that revision, like so:: |
|
106 | for that revision, like so:: | |
107 |
|
107 | |||
108 | <source ID> <destination ID> |
|
108 | <source ID> <destination ID> | |
109 |
|
109 | |||
110 | If the file doesn't exist, it's automatically created. It's |
|
110 | If the file doesn't exist, it's automatically created. It's | |
111 | updated on each commit copied, so :hg:`convert` can be interrupted |
|
111 | updated on each commit copied, so :hg:`convert` can be interrupted | |
112 | and can be run repeatedly to copy new commits. |
|
112 | and can be run repeatedly to copy new commits. | |
113 |
|
113 | |||
114 | The authormap is a simple text file that maps each source commit |
|
114 | The authormap is a simple text file that maps each source commit | |
115 | author to a destination commit author. It is handy for source SCMs |
|
115 | author to a destination commit author. It is handy for source SCMs | |
116 | that use unix logins to identify authors (e.g.: CVS). One line per |
|
116 | that use unix logins to identify authors (e.g.: CVS). One line per | |
117 | author mapping and the line format is:: |
|
117 | author mapping and the line format is:: | |
118 |
|
118 | |||
119 | source author = destination author |
|
119 | source author = destination author | |
120 |
|
120 | |||
121 | Empty lines and lines starting with a ``#`` are ignored. |
|
121 | Empty lines and lines starting with a ``#`` are ignored. | |
122 |
|
122 | |||
123 | The filemap is a file that allows filtering and remapping of files |
|
123 | The filemap is a file that allows filtering and remapping of files | |
124 | and directories. Each line can contain one of the following |
|
124 | and directories. Each line can contain one of the following | |
125 | directives:: |
|
125 | directives:: | |
126 |
|
126 | |||
127 | include path/to/file-or-dir |
|
127 | include path/to/file-or-dir | |
128 |
|
128 | |||
129 | exclude path/to/file-or-dir |
|
129 | exclude path/to/file-or-dir | |
130 |
|
130 | |||
131 | rename path/to/source path/to/destination |
|
131 | rename path/to/source path/to/destination | |
132 |
|
132 | |||
133 | Comment lines start with ``#``. A specified path matches if it |
|
133 | Comment lines start with ``#``. A specified path matches if it | |
134 | equals the full relative name of a file or one of its parent |
|
134 | equals the full relative name of a file or one of its parent | |
135 | directories. The ``include`` or ``exclude`` directive with the |
|
135 | directories. The ``include`` or ``exclude`` directive with the | |
136 | longest matching path applies, so line order does not matter. |
|
136 | longest matching path applies, so line order does not matter. | |
137 |
|
137 | |||
138 | The ``include`` directive causes a file, or all files under a |
|
138 | The ``include`` directive causes a file, or all files under a | |
139 | directory, to be included in the destination repository. The default |
|
139 | directory, to be included in the destination repository. The default | |
140 | if there are no ``include`` statements is to include everything. |
|
140 | if there are no ``include`` statements is to include everything. | |
141 | If there are any ``include`` statements, nothing else is included. |
|
141 | If there are any ``include`` statements, nothing else is included. | |
142 | The ``exclude`` directive causes files or directories to |
|
142 | The ``exclude`` directive causes files or directories to | |
143 | be omitted. The ``rename`` directive renames a file or directory if |
|
143 | be omitted. The ``rename`` directive renames a file or directory if | |
144 | it is converted. To rename from a subdirectory into the root of |
|
144 | it is converted. To rename from a subdirectory into the root of | |
145 | the repository, use ``.`` as the path to rename to. |
|
145 | the repository, use ``.`` as the path to rename to. | |
146 |
|
146 | |||
147 | ``--full`` will make sure the converted changesets contain exactly |
|
147 | ``--full`` will make sure the converted changesets contain exactly | |
148 | the right files with the right content. It will make a full |
|
148 | the right files with the right content. It will make a full | |
149 | conversion of all files, not just the ones that have |
|
149 | conversion of all files, not just the ones that have | |
150 | changed. Files that already are correct will not be changed. This |
|
150 | changed. Files that already are correct will not be changed. This | |
151 | can be used to apply filemap changes when converting |
|
151 | can be used to apply filemap changes when converting | |
152 | incrementally. This is currently only supported for Mercurial and |
|
152 | incrementally. This is currently only supported for Mercurial and | |
153 | Subversion. |
|
153 | Subversion. | |
154 |
|
154 | |||
155 | The splicemap is a file that allows insertion of synthetic |
|
155 | The splicemap is a file that allows insertion of synthetic | |
156 | history, letting you specify the parents of a revision. This is |
|
156 | history, letting you specify the parents of a revision. This is | |
157 | useful if you want to e.g. give a Subversion merge two parents, or |
|
157 | useful if you want to e.g. give a Subversion merge two parents, or | |
158 | graft two disconnected series of history together. Each entry |
|
158 | graft two disconnected series of history together. Each entry | |
159 | contains a key, followed by a space, followed by one or two |
|
159 | contains a key, followed by a space, followed by one or two | |
160 | comma-separated values:: |
|
160 | comma-separated values:: | |
161 |
|
161 | |||
162 | key parent1, parent2 |
|
162 | key parent1, parent2 | |
163 |
|
163 | |||
164 | The key is the revision ID in the source |
|
164 | The key is the revision ID in the source | |
165 | revision control system whose parents should be modified (same |
|
165 | revision control system whose parents should be modified (same | |
166 | format as a key in .hg/shamap). The values are the revision IDs |
|
166 | format as a key in .hg/shamap). The values are the revision IDs | |
167 | (in either the source or destination revision control system) that |
|
167 | (in either the source or destination revision control system) that | |
168 | should be used as the new parents for that node. For example, if |
|
168 | should be used as the new parents for that node. For example, if | |
169 | you have merged "release-1.0" into "trunk", then you should |
|
169 | you have merged "release-1.0" into "trunk", then you should | |
170 | specify the revision on "trunk" as the first parent and the one on |
|
170 | specify the revision on "trunk" as the first parent and the one on | |
171 | the "release-1.0" branch as the second. |
|
171 | the "release-1.0" branch as the second. | |
172 |
|
172 | |||
173 | The branchmap is a file that allows you to rename a branch when it is |
|
173 | The branchmap is a file that allows you to rename a branch when it is | |
174 | being brought in from whatever external repository. When used in |
|
174 | being brought in from whatever external repository. When used in | |
175 | conjunction with a splicemap, it allows for a powerful combination |
|
175 | conjunction with a splicemap, it allows for a powerful combination | |
176 | to help fix even the most badly mismanaged repositories and turn them |
|
176 | to help fix even the most badly mismanaged repositories and turn them | |
177 | into nicely structured Mercurial repositories. The branchmap contains |
|
177 | into nicely structured Mercurial repositories. The branchmap contains | |
178 | lines of the form:: |
|
178 | lines of the form:: | |
179 |
|
179 | |||
180 | original_branch_name new_branch_name |
|
180 | original_branch_name new_branch_name | |
181 |
|
181 | |||
182 | where "original_branch_name" is the name of the branch in the |
|
182 | where "original_branch_name" is the name of the branch in the | |
183 | source repository, and "new_branch_name" is the name of the branch |
|
183 | source repository, and "new_branch_name" is the name of the branch | |
184 | is the destination repository. No whitespace is allowed in the |
|
184 | is the destination repository. No whitespace is allowed in the new | |
185 |
branch name |
|
185 | branch name. This can be used to (for instance) move code in one | |
186 | repository from "default" to a named branch. |
|
186 | repository from "default" to a named branch. | |
187 |
|
187 | |||
188 | Mercurial Source |
|
188 | Mercurial Source | |
189 | ################ |
|
189 | ################ | |
190 |
|
190 | |||
191 | The Mercurial source recognizes the following configuration |
|
191 | The Mercurial source recognizes the following configuration | |
192 | options, which you can set on the command line with ``--config``: |
|
192 | options, which you can set on the command line with ``--config``: | |
193 |
|
193 | |||
194 | :convert.hg.ignoreerrors: ignore integrity errors when reading. |
|
194 | :convert.hg.ignoreerrors: ignore integrity errors when reading. | |
195 | Use it to fix Mercurial repositories with missing revlogs, by |
|
195 | Use it to fix Mercurial repositories with missing revlogs, by | |
196 | converting from and to Mercurial. Default is False. |
|
196 | converting from and to Mercurial. Default is False. | |
197 |
|
197 | |||
198 | :convert.hg.saverev: store original revision ID in changeset |
|
198 | :convert.hg.saverev: store original revision ID in changeset | |
199 | (forces target IDs to change). It takes a boolean argument and |
|
199 | (forces target IDs to change). It takes a boolean argument and | |
200 | defaults to False. |
|
200 | defaults to False. | |
201 |
|
201 | |||
202 | :convert.hg.startrev: specify the initial Mercurial revision. |
|
202 | :convert.hg.startrev: specify the initial Mercurial revision. | |
203 | The default is 0. |
|
203 | The default is 0. | |
204 |
|
204 | |||
205 | :convert.hg.revs: revset specifying the source revisions to convert. |
|
205 | :convert.hg.revs: revset specifying the source revisions to convert. | |
206 |
|
206 | |||
207 | CVS Source |
|
207 | CVS Source | |
208 | ########## |
|
208 | ########## | |
209 |
|
209 | |||
210 | CVS source will use a sandbox (i.e. a checked-out copy) from CVS |
|
210 | CVS source will use a sandbox (i.e. a checked-out copy) from CVS | |
211 | to indicate the starting point of what will be converted. Direct |
|
211 | to indicate the starting point of what will be converted. Direct | |
212 | access to the repository files is not needed, unless of course the |
|
212 | access to the repository files is not needed, unless of course the | |
213 | repository is ``:local:``. The conversion uses the top level |
|
213 | repository is ``:local:``. The conversion uses the top level | |
214 | directory in the sandbox to find the CVS repository, and then uses |
|
214 | directory in the sandbox to find the CVS repository, and then uses | |
215 | CVS rlog commands to find files to convert. This means that unless |
|
215 | CVS rlog commands to find files to convert. This means that unless | |
216 | a filemap is given, all files under the starting directory will be |
|
216 | a filemap is given, all files under the starting directory will be | |
217 | converted, and that any directory reorganization in the CVS |
|
217 | converted, and that any directory reorganization in the CVS | |
218 | sandbox is ignored. |
|
218 | sandbox is ignored. | |
219 |
|
219 | |||
220 | The following options can be used with ``--config``: |
|
220 | The following options can be used with ``--config``: | |
221 |
|
221 | |||
222 | :convert.cvsps.cache: Set to False to disable remote log caching, |
|
222 | :convert.cvsps.cache: Set to False to disable remote log caching, | |
223 | for testing and debugging purposes. Default is True. |
|
223 | for testing and debugging purposes. Default is True. | |
224 |
|
224 | |||
225 | :convert.cvsps.fuzz: Specify the maximum time (in seconds) that is |
|
225 | :convert.cvsps.fuzz: Specify the maximum time (in seconds) that is | |
226 | allowed between commits with identical user and log message in |
|
226 | allowed between commits with identical user and log message in | |
227 | a single changeset. When very large files were checked in as |
|
227 | a single changeset. When very large files were checked in as | |
228 | part of a changeset then the default may not be long enough. |
|
228 | part of a changeset then the default may not be long enough. | |
229 | The default is 60. |
|
229 | The default is 60. | |
230 |
|
230 | |||
231 | :convert.cvsps.mergeto: Specify a regular expression to which |
|
231 | :convert.cvsps.mergeto: Specify a regular expression to which | |
232 | commit log messages are matched. If a match occurs, then the |
|
232 | commit log messages are matched. If a match occurs, then the | |
233 | conversion process will insert a dummy revision merging the |
|
233 | conversion process will insert a dummy revision merging the | |
234 | branch on which this log message occurs to the branch |
|
234 | branch on which this log message occurs to the branch | |
235 | indicated in the regex. Default is ``{{mergetobranch |
|
235 | indicated in the regex. Default is ``{{mergetobranch | |
236 | ([-\\w]+)}}`` |
|
236 | ([-\\w]+)}}`` | |
237 |
|
237 | |||
238 | :convert.cvsps.mergefrom: Specify a regular expression to which |
|
238 | :convert.cvsps.mergefrom: Specify a regular expression to which | |
239 | commit log messages are matched. If a match occurs, then the |
|
239 | commit log messages are matched. If a match occurs, then the | |
240 | conversion process will add the most recent revision on the |
|
240 | conversion process will add the most recent revision on the | |
241 | branch indicated in the regex as the second parent of the |
|
241 | branch indicated in the regex as the second parent of the | |
242 | changeset. Default is ``{{mergefrombranch ([-\\w]+)}}`` |
|
242 | changeset. Default is ``{{mergefrombranch ([-\\w]+)}}`` | |
243 |
|
243 | |||
244 | :convert.localtimezone: use local time (as determined by the TZ |
|
244 | :convert.localtimezone: use local time (as determined by the TZ | |
245 | environment variable) for changeset date/times. The default |
|
245 | environment variable) for changeset date/times. The default | |
246 | is False (use UTC). |
|
246 | is False (use UTC). | |
247 |
|
247 | |||
248 | :hooks.cvslog: Specify a Python function to be called at the end of |
|
248 | :hooks.cvslog: Specify a Python function to be called at the end of | |
249 | gathering the CVS log. The function is passed a list with the |
|
249 | gathering the CVS log. The function is passed a list with the | |
250 | log entries, and can modify the entries in-place, or add or |
|
250 | log entries, and can modify the entries in-place, or add or | |
251 | delete them. |
|
251 | delete them. | |
252 |
|
252 | |||
253 | :hooks.cvschangesets: Specify a Python function to be called after |
|
253 | :hooks.cvschangesets: Specify a Python function to be called after | |
254 | the changesets are calculated from the CVS log. The |
|
254 | the changesets are calculated from the CVS log. The | |
255 | function is passed a list with the changeset entries, and can |
|
255 | function is passed a list with the changeset entries, and can | |
256 | modify the changesets in-place, or add or delete them. |
|
256 | modify the changesets in-place, or add or delete them. | |
257 |
|
257 | |||
258 | An additional "debugcvsps" Mercurial command allows the builtin |
|
258 | An additional "debugcvsps" Mercurial command allows the builtin | |
259 | changeset merging code to be run without doing a conversion. Its |
|
259 | changeset merging code to be run without doing a conversion. Its | |
260 | parameters and output are similar to that of cvsps 2.1. Please see |
|
260 | parameters and output are similar to that of cvsps 2.1. Please see | |
261 | the command help for more details. |
|
261 | the command help for more details. | |
262 |
|
262 | |||
263 | Subversion Source |
|
263 | Subversion Source | |
264 | ################# |
|
264 | ################# | |
265 |
|
265 | |||
266 | Subversion source detects classical trunk/branches/tags layouts. |
|
266 | Subversion source detects classical trunk/branches/tags layouts. | |
267 | By default, the supplied ``svn://repo/path/`` source URL is |
|
267 | By default, the supplied ``svn://repo/path/`` source URL is | |
268 | converted as a single branch. If ``svn://repo/path/trunk`` exists |
|
268 | converted as a single branch. If ``svn://repo/path/trunk`` exists | |
269 | it replaces the default branch. If ``svn://repo/path/branches`` |
|
269 | it replaces the default branch. If ``svn://repo/path/branches`` | |
270 | exists, its subdirectories are listed as possible branches. If |
|
270 | exists, its subdirectories are listed as possible branches. If | |
271 | ``svn://repo/path/tags`` exists, it is looked for tags referencing |
|
271 | ``svn://repo/path/tags`` exists, it is looked for tags referencing | |
272 | converted branches. Default ``trunk``, ``branches`` and ``tags`` |
|
272 | converted branches. Default ``trunk``, ``branches`` and ``tags`` | |
273 | values can be overridden with following options. Set them to paths |
|
273 | values can be overridden with following options. Set them to paths | |
274 | relative to the source URL, or leave them blank to disable auto |
|
274 | relative to the source URL, or leave them blank to disable auto | |
275 | detection. |
|
275 | detection. | |
276 |
|
276 | |||
277 | The following options can be set with ``--config``: |
|
277 | The following options can be set with ``--config``: | |
278 |
|
278 | |||
279 | :convert.svn.branches: specify the directory containing branches. |
|
279 | :convert.svn.branches: specify the directory containing branches. | |
280 | The default is ``branches``. |
|
280 | The default is ``branches``. | |
281 |
|
281 | |||
282 | :convert.svn.tags: specify the directory containing tags. The |
|
282 | :convert.svn.tags: specify the directory containing tags. The | |
283 | default is ``tags``. |
|
283 | default is ``tags``. | |
284 |
|
284 | |||
285 | :convert.svn.trunk: specify the name of the trunk branch. The |
|
285 | :convert.svn.trunk: specify the name of the trunk branch. The | |
286 | default is ``trunk``. |
|
286 | default is ``trunk``. | |
287 |
|
287 | |||
288 | :convert.localtimezone: use local time (as determined by the TZ |
|
288 | :convert.localtimezone: use local time (as determined by the TZ | |
289 | environment variable) for changeset date/times. The default |
|
289 | environment variable) for changeset date/times. The default | |
290 | is False (use UTC). |
|
290 | is False (use UTC). | |
291 |
|
291 | |||
292 | Source history can be retrieved starting at a specific revision, |
|
292 | Source history can be retrieved starting at a specific revision, | |
293 | instead of being integrally converted. Only single branch |
|
293 | instead of being integrally converted. Only single branch | |
294 | conversions are supported. |
|
294 | conversions are supported. | |
295 |
|
295 | |||
296 | :convert.svn.startrev: specify start Subversion revision number. |
|
296 | :convert.svn.startrev: specify start Subversion revision number. | |
297 | The default is 0. |
|
297 | The default is 0. | |
298 |
|
298 | |||
299 | Git Source |
|
299 | Git Source | |
300 | ########## |
|
300 | ########## | |
301 |
|
301 | |||
302 | The Git importer converts commits from all reachable branches (refs |
|
302 | The Git importer converts commits from all reachable branches (refs | |
303 | in refs/heads) and remotes (refs in refs/remotes) to Mercurial. |
|
303 | in refs/heads) and remotes (refs in refs/remotes) to Mercurial. | |
304 | Branches are converted to bookmarks with the same name, with the |
|
304 | Branches are converted to bookmarks with the same name, with the | |
305 | leading 'refs/heads' stripped. Git submodules are converted to Git |
|
305 | leading 'refs/heads' stripped. Git submodules are converted to Git | |
306 | subrepos in Mercurial. |
|
306 | subrepos in Mercurial. | |
307 |
|
307 | |||
308 | The following options can be set with ``--config``: |
|
308 | The following options can be set with ``--config``: | |
309 |
|
309 | |||
310 | :convert.git.similarity: specify how similar files modified in a |
|
310 | :convert.git.similarity: specify how similar files modified in a | |
311 | commit must be to be imported as renames or copies, as a |
|
311 | commit must be to be imported as renames or copies, as a | |
312 | percentage between ``0`` (disabled) and ``100`` (files must be |
|
312 | percentage between ``0`` (disabled) and ``100`` (files must be | |
313 | identical). For example, ``90`` means that a delete/add pair will |
|
313 | identical). For example, ``90`` means that a delete/add pair will | |
314 | be imported as a rename if more than 90% of the file hasn't |
|
314 | be imported as a rename if more than 90% of the file hasn't | |
315 | changed. The default is ``50``. |
|
315 | changed. The default is ``50``. | |
316 |
|
316 | |||
317 | :convert.git.findcopiesharder: while detecting copies, look at all |
|
317 | :convert.git.findcopiesharder: while detecting copies, look at all | |
318 | files in the working copy instead of just changed ones. This |
|
318 | files in the working copy instead of just changed ones. This | |
319 | is very expensive for large projects, and is only effective when |
|
319 | is very expensive for large projects, and is only effective when | |
320 | ``convert.git.similarity`` is greater than 0. The default is False. |
|
320 | ``convert.git.similarity`` is greater than 0. The default is False. | |
321 |
|
321 | |||
322 | :convert.git.renamelimit: perform rename and copy detection up to this |
|
322 | :convert.git.renamelimit: perform rename and copy detection up to this | |
323 | many changed files in a commit. Increasing this will make rename |
|
323 | many changed files in a commit. Increasing this will make rename | |
324 | and copy detection more accurate but will significantly slow down |
|
324 | and copy detection more accurate but will significantly slow down | |
325 | computation on large projects. The option is only relevant if |
|
325 | computation on large projects. The option is only relevant if | |
326 | ``convert.git.similarity`` is greater than 0. The default is |
|
326 | ``convert.git.similarity`` is greater than 0. The default is | |
327 | ``400``. |
|
327 | ``400``. | |
328 |
|
328 | |||
329 | :convert.git.committeractions: list of actions to take when processing |
|
329 | :convert.git.committeractions: list of actions to take when processing | |
330 | author and committer values. |
|
330 | author and committer values. | |
331 |
|
331 | |||
332 | Git commits have separate author (who wrote the commit) and committer |
|
332 | Git commits have separate author (who wrote the commit) and committer | |
333 | (who applied the commit) fields. Not all destinations support separate |
|
333 | (who applied the commit) fields. Not all destinations support separate | |
334 | author and committer fields (including Mercurial). This config option |
|
334 | author and committer fields (including Mercurial). This config option | |
335 | controls what to do with these author and committer fields during |
|
335 | controls what to do with these author and committer fields during | |
336 | conversion. |
|
336 | conversion. | |
337 |
|
337 | |||
338 | A value of ``messagedifferent`` will append a ``committer: ...`` |
|
338 | A value of ``messagedifferent`` will append a ``committer: ...`` | |
339 | line to the commit message if the Git committer is different from the |
|
339 | line to the commit message if the Git committer is different from the | |
340 | author. The prefix of that line can be specified using the syntax |
|
340 | author. The prefix of that line can be specified using the syntax | |
341 | ``messagedifferent=<prefix>``. e.g. ``messagedifferent=git-committer:``. |
|
341 | ``messagedifferent=<prefix>``. e.g. ``messagedifferent=git-committer:``. | |
342 | When a prefix is specified, a space will always be inserted between the |
|
342 | When a prefix is specified, a space will always be inserted between the | |
343 | prefix and the value. |
|
343 | prefix and the value. | |
344 |
|
344 | |||
345 | ``messagealways`` behaves like ``messagedifferent`` except it will |
|
345 | ``messagealways`` behaves like ``messagedifferent`` except it will | |
346 | always result in a ``committer: ...`` line being appended to the commit |
|
346 | always result in a ``committer: ...`` line being appended to the commit | |
347 | message. This value is mutually exclusive with ``messagedifferent``. |
|
347 | message. This value is mutually exclusive with ``messagedifferent``. | |
348 |
|
348 | |||
349 | ``dropcommitter`` will remove references to the committer. Only |
|
349 | ``dropcommitter`` will remove references to the committer. Only | |
350 | references to the author will remain. Actions that add references |
|
350 | references to the author will remain. Actions that add references | |
351 | to the committer will have no effect when this is set. |
|
351 | to the committer will have no effect when this is set. | |
352 |
|
352 | |||
353 | ``replaceauthor`` will replace the value of the author field with |
|
353 | ``replaceauthor`` will replace the value of the author field with | |
354 | the committer. Other actions that add references to the committer |
|
354 | the committer. Other actions that add references to the committer | |
355 | will still take effect when this is set. |
|
355 | will still take effect when this is set. | |
356 |
|
356 | |||
357 | The default is ``messagedifferent``. |
|
357 | The default is ``messagedifferent``. | |
358 |
|
358 | |||
359 | :convert.git.extrakeys: list of extra keys from commit metadata to copy to |
|
359 | :convert.git.extrakeys: list of extra keys from commit metadata to copy to | |
360 | the destination. Some Git repositories store extra metadata in commits. |
|
360 | the destination. Some Git repositories store extra metadata in commits. | |
361 | By default, this non-default metadata will be lost during conversion. |
|
361 | By default, this non-default metadata will be lost during conversion. | |
362 | Setting this config option can retain that metadata. Some built-in |
|
362 | Setting this config option can retain that metadata. Some built-in | |
363 | keys such as ``parent`` and ``branch`` are not allowed to be copied. |
|
363 | keys such as ``parent`` and ``branch`` are not allowed to be copied. | |
364 |
|
364 | |||
365 | :convert.git.remoteprefix: remote refs are converted as bookmarks with |
|
365 | :convert.git.remoteprefix: remote refs are converted as bookmarks with | |
366 | ``convert.git.remoteprefix`` as a prefix followed by a /. The default |
|
366 | ``convert.git.remoteprefix`` as a prefix followed by a /. The default | |
367 | is 'remote'. |
|
367 | is 'remote'. | |
368 |
|
368 | |||
369 | :convert.git.saverev: whether to store the original Git commit ID in the |
|
369 | :convert.git.saverev: whether to store the original Git commit ID in the | |
370 | metadata of the destination commit. The default is True. |
|
370 | metadata of the destination commit. The default is True. | |
371 |
|
371 | |||
372 | :convert.git.skipsubmodules: does not convert root level .gitmodules files |
|
372 | :convert.git.skipsubmodules: does not convert root level .gitmodules files | |
373 | or files with 160000 mode indicating a submodule. Default is False. |
|
373 | or files with 160000 mode indicating a submodule. Default is False. | |
374 |
|
374 | |||
375 | Perforce Source |
|
375 | Perforce Source | |
376 | ############### |
|
376 | ############### | |
377 |
|
377 | |||
378 | The Perforce (P4) importer can be given a p4 depot path or a |
|
378 | The Perforce (P4) importer can be given a p4 depot path or a | |
379 | client specification as source. It will convert all files in the |
|
379 | client specification as source. It will convert all files in the | |
380 | source to a flat Mercurial repository, ignoring labels, branches |
|
380 | source to a flat Mercurial repository, ignoring labels, branches | |
381 | and integrations. Note that when a depot path is given you then |
|
381 | and integrations. Note that when a depot path is given you then | |
382 | usually should specify a target directory, because otherwise the |
|
382 | usually should specify a target directory, because otherwise the | |
383 | target may be named ``...-hg``. |
|
383 | target may be named ``...-hg``. | |
384 |
|
384 | |||
385 | The following options can be set with ``--config``: |
|
385 | The following options can be set with ``--config``: | |
386 |
|
386 | |||
387 | :convert.p4.encoding: specify the encoding to use when decoding standard |
|
387 | :convert.p4.encoding: specify the encoding to use when decoding standard | |
388 | output of the Perforce command line tool. The default is default system |
|
388 | output of the Perforce command line tool. The default is default system | |
389 | encoding. |
|
389 | encoding. | |
390 |
|
390 | |||
391 | :convert.p4.startrev: specify initial Perforce revision (a |
|
391 | :convert.p4.startrev: specify initial Perforce revision (a | |
392 | Perforce changelist number). |
|
392 | Perforce changelist number). | |
393 |
|
393 | |||
394 | Mercurial Destination |
|
394 | Mercurial Destination | |
395 | ##################### |
|
395 | ##################### | |
396 |
|
396 | |||
397 | The Mercurial destination will recognize Mercurial subrepositories in the |
|
397 | The Mercurial destination will recognize Mercurial subrepositories in the | |
398 | destination directory, and update the .hgsubstate file automatically if the |
|
398 | destination directory, and update the .hgsubstate file automatically if the | |
399 | destination subrepositories contain the <dest>/<sub>/.hg/shamap file. |
|
399 | destination subrepositories contain the <dest>/<sub>/.hg/shamap file. | |
400 | Converting a repository with subrepositories requires converting a single |
|
400 | Converting a repository with subrepositories requires converting a single | |
401 | repository at a time, from the bottom up. |
|
401 | repository at a time, from the bottom up. | |
402 |
|
402 | |||
403 | .. container:: verbose |
|
403 | .. container:: verbose | |
404 |
|
404 | |||
405 | An example showing how to convert a repository with subrepositories:: |
|
405 | An example showing how to convert a repository with subrepositories:: | |
406 |
|
406 | |||
407 | # so convert knows the type when it sees a non empty destination |
|
407 | # so convert knows the type when it sees a non empty destination | |
408 | $ hg init converted |
|
408 | $ hg init converted | |
409 |
|
409 | |||
410 | $ hg convert orig/sub1 converted/sub1 |
|
410 | $ hg convert orig/sub1 converted/sub1 | |
411 | $ hg convert orig/sub2 converted/sub2 |
|
411 | $ hg convert orig/sub2 converted/sub2 | |
412 | $ hg convert orig converted |
|
412 | $ hg convert orig converted | |
413 |
|
413 | |||
414 | The following options are supported: |
|
414 | The following options are supported: | |
415 |
|
415 | |||
416 | :convert.hg.clonebranches: dispatch source branches in separate |
|
416 | :convert.hg.clonebranches: dispatch source branches in separate | |
417 | clones. The default is False. |
|
417 | clones. The default is False. | |
418 |
|
418 | |||
419 | :convert.hg.tagsbranch: branch name for tag revisions, defaults to |
|
419 | :convert.hg.tagsbranch: branch name for tag revisions, defaults to | |
420 | ``default``. |
|
420 | ``default``. | |
421 |
|
421 | |||
422 | :convert.hg.usebranchnames: preserve branch names. The default is |
|
422 | :convert.hg.usebranchnames: preserve branch names. The default is | |
423 | True. |
|
423 | True. | |
424 |
|
424 | |||
425 | :convert.hg.sourcename: records the given string as a 'convert_source' extra |
|
425 | :convert.hg.sourcename: records the given string as a 'convert_source' extra | |
426 | value on each commit made in the target repository. The default is None. |
|
426 | value on each commit made in the target repository. The default is None. | |
427 |
|
427 | |||
428 | All Destinations |
|
428 | All Destinations | |
429 | ################ |
|
429 | ################ | |
430 |
|
430 | |||
431 | All destination types accept the following options: |
|
431 | All destination types accept the following options: | |
432 |
|
432 | |||
433 | :convert.skiptags: does not convert tags from the source repo to the target |
|
433 | :convert.skiptags: does not convert tags from the source repo to the target | |
434 | repo. The default is False. |
|
434 | repo. The default is False. | |
435 | """ |
|
435 | """ | |
436 | return convcmd.convert(ui, src, dest, revmapfile, **opts) |
|
436 | return convcmd.convert(ui, src, dest, revmapfile, **opts) | |
437 |
|
437 | |||
438 | @command('debugsvnlog', [], 'hg debugsvnlog', norepo=True) |
|
438 | @command('debugsvnlog', [], 'hg debugsvnlog', norepo=True) | |
439 | def debugsvnlog(ui, **opts): |
|
439 | def debugsvnlog(ui, **opts): | |
440 | return subversion.debugsvnlog(ui, **opts) |
|
440 | return subversion.debugsvnlog(ui, **opts) | |
441 |
|
441 | |||
442 | @command('debugcvsps', |
|
442 | @command('debugcvsps', | |
443 | [ |
|
443 | [ | |
444 | # Main options shared with cvsps-2.1 |
|
444 | # Main options shared with cvsps-2.1 | |
445 | ('b', 'branches', [], _('only return changes on specified branches')), |
|
445 | ('b', 'branches', [], _('only return changes on specified branches')), | |
446 | ('p', 'prefix', '', _('prefix to remove from file names')), |
|
446 | ('p', 'prefix', '', _('prefix to remove from file names')), | |
447 | ('r', 'revisions', [], |
|
447 | ('r', 'revisions', [], | |
448 | _('only return changes after or between specified tags')), |
|
448 | _('only return changes after or between specified tags')), | |
449 | ('u', 'update-cache', None, _("update cvs log cache")), |
|
449 | ('u', 'update-cache', None, _("update cvs log cache")), | |
450 | ('x', 'new-cache', None, _("create new cvs log cache")), |
|
450 | ('x', 'new-cache', None, _("create new cvs log cache")), | |
451 | ('z', 'fuzz', 60, _('set commit time fuzz in seconds')), |
|
451 | ('z', 'fuzz', 60, _('set commit time fuzz in seconds')), | |
452 | ('', 'root', '', _('specify cvsroot')), |
|
452 | ('', 'root', '', _('specify cvsroot')), | |
453 | # Options specific to builtin cvsps |
|
453 | # Options specific to builtin cvsps | |
454 | ('', 'parents', '', _('show parent changesets')), |
|
454 | ('', 'parents', '', _('show parent changesets')), | |
455 | ('', 'ancestors', '', _('show current changeset in ancestor branches')), |
|
455 | ('', 'ancestors', '', _('show current changeset in ancestor branches')), | |
456 | # Options that are ignored for compatibility with cvsps-2.1 |
|
456 | # Options that are ignored for compatibility with cvsps-2.1 | |
457 | ('A', 'cvs-direct', None, _('ignored for compatibility')), |
|
457 | ('A', 'cvs-direct', None, _('ignored for compatibility')), | |
458 | ], |
|
458 | ], | |
459 | _('hg debugcvsps [OPTION]... [PATH]...'), |
|
459 | _('hg debugcvsps [OPTION]... [PATH]...'), | |
460 | norepo=True) |
|
460 | norepo=True) | |
461 | def debugcvsps(ui, *args, **opts): |
|
461 | def debugcvsps(ui, *args, **opts): | |
462 | '''create changeset information from CVS |
|
462 | '''create changeset information from CVS | |
463 |
|
463 | |||
464 | This command is intended as a debugging tool for the CVS to |
|
464 | This command is intended as a debugging tool for the CVS to | |
465 | Mercurial converter, and can be used as a direct replacement for |
|
465 | Mercurial converter, and can be used as a direct replacement for | |
466 | cvsps. |
|
466 | cvsps. | |
467 |
|
467 | |||
468 | Hg debugcvsps reads the CVS rlog for current directory (or any |
|
468 | Hg debugcvsps reads the CVS rlog for current directory (or any | |
469 | named directory) in the CVS repository, and converts the log to a |
|
469 | named directory) in the CVS repository, and converts the log to a | |
470 | series of changesets based on matching commit log entries and |
|
470 | series of changesets based on matching commit log entries and | |
471 | dates.''' |
|
471 | dates.''' | |
472 | return cvsps.debugcvsps(ui, *args, **opts) |
|
472 | return cvsps.debugcvsps(ui, *args, **opts) | |
473 |
|
473 | |||
474 | def kwconverted(ctx, name): |
|
474 | def kwconverted(ctx, name): | |
475 | rev = ctx.extra().get('convert_revision', '') |
|
475 | rev = ctx.extra().get('convert_revision', '') | |
476 | if rev.startswith('svn:'): |
|
476 | if rev.startswith('svn:'): | |
477 | if name == 'svnrev': |
|
477 | if name == 'svnrev': | |
478 | return str(subversion.revsplit(rev)[2]) |
|
478 | return str(subversion.revsplit(rev)[2]) | |
479 | elif name == 'svnpath': |
|
479 | elif name == 'svnpath': | |
480 | return subversion.revsplit(rev)[1] |
|
480 | return subversion.revsplit(rev)[1] | |
481 | elif name == 'svnuuid': |
|
481 | elif name == 'svnuuid': | |
482 | return subversion.revsplit(rev)[0] |
|
482 | return subversion.revsplit(rev)[0] | |
483 | return rev |
|
483 | return rev | |
484 |
|
484 | |||
485 | templatekeyword = registrar.templatekeyword() |
|
485 | templatekeyword = registrar.templatekeyword() | |
486 |
|
486 | |||
487 | @templatekeyword('svnrev') |
|
487 | @templatekeyword('svnrev') | |
488 | def kwsvnrev(repo, ctx, **args): |
|
488 | def kwsvnrev(repo, ctx, **args): | |
489 | """String. Converted subversion revision number.""" |
|
489 | """String. Converted subversion revision number.""" | |
490 | return kwconverted(ctx, 'svnrev') |
|
490 | return kwconverted(ctx, 'svnrev') | |
491 |
|
491 | |||
492 | @templatekeyword('svnpath') |
|
492 | @templatekeyword('svnpath') | |
493 | def kwsvnpath(repo, ctx, **args): |
|
493 | def kwsvnpath(repo, ctx, **args): | |
494 | """String. Converted subversion revision project path.""" |
|
494 | """String. Converted subversion revision project path.""" | |
495 | return kwconverted(ctx, 'svnpath') |
|
495 | return kwconverted(ctx, 'svnpath') | |
496 |
|
496 | |||
497 | @templatekeyword('svnuuid') |
|
497 | @templatekeyword('svnuuid') | |
498 | def kwsvnuuid(repo, ctx, **args): |
|
498 | def kwsvnuuid(repo, ctx, **args): | |
499 | """String. Converted subversion revision repository identifier.""" |
|
499 | """String. Converted subversion revision repository identifier.""" | |
500 | return kwconverted(ctx, 'svnuuid') |
|
500 | return kwconverted(ctx, 'svnuuid') | |
501 |
|
501 | |||
502 | # tell hggettext to extract docstrings from these functions: |
|
502 | # tell hggettext to extract docstrings from these functions: | |
503 | i18nfunctions = [kwsvnrev, kwsvnpath, kwsvnuuid] |
|
503 | i18nfunctions = [kwsvnrev, kwsvnpath, kwsvnuuid] |
@@ -1,583 +1,610 | |||||
1 | $ cat >> $HGRCPATH <<EOF |
|
1 | $ cat >> $HGRCPATH <<EOF | |
2 | > [extensions] |
|
2 | > [extensions] | |
3 | > convert= |
|
3 | > convert= | |
4 | > [convert] |
|
4 | > [convert] | |
5 | > hg.saverev=False |
|
5 | > hg.saverev=False | |
6 | > EOF |
|
6 | > EOF | |
7 | $ hg help convert |
|
7 | $ hg help convert | |
8 | hg convert [OPTION]... SOURCE [DEST [REVMAP]] |
|
8 | hg convert [OPTION]... SOURCE [DEST [REVMAP]] | |
9 |
|
9 | |||
10 | convert a foreign SCM repository to a Mercurial one. |
|
10 | convert a foreign SCM repository to a Mercurial one. | |
11 |
|
11 | |||
12 | Accepted source formats [identifiers]: |
|
12 | Accepted source formats [identifiers]: | |
13 |
|
13 | |||
14 | - Mercurial [hg] |
|
14 | - Mercurial [hg] | |
15 | - CVS [cvs] |
|
15 | - CVS [cvs] | |
16 | - Darcs [darcs] |
|
16 | - Darcs [darcs] | |
17 | - git [git] |
|
17 | - git [git] | |
18 | - Subversion [svn] |
|
18 | - Subversion [svn] | |
19 | - Monotone [mtn] |
|
19 | - Monotone [mtn] | |
20 | - GNU Arch [gnuarch] |
|
20 | - GNU Arch [gnuarch] | |
21 | - Bazaar [bzr] |
|
21 | - Bazaar [bzr] | |
22 | - Perforce [p4] |
|
22 | - Perforce [p4] | |
23 |
|
23 | |||
24 | Accepted destination formats [identifiers]: |
|
24 | Accepted destination formats [identifiers]: | |
25 |
|
25 | |||
26 | - Mercurial [hg] |
|
26 | - Mercurial [hg] | |
27 | - Subversion [svn] (history on branches is not preserved) |
|
27 | - Subversion [svn] (history on branches is not preserved) | |
28 |
|
28 | |||
29 | If no revision is given, all revisions will be converted. Otherwise, |
|
29 | If no revision is given, all revisions will be converted. Otherwise, | |
30 | convert will only import up to the named revision (given in a format |
|
30 | convert will only import up to the named revision (given in a format | |
31 | understood by the source). |
|
31 | understood by the source). | |
32 |
|
32 | |||
33 | If no destination directory name is specified, it defaults to the basename |
|
33 | If no destination directory name is specified, it defaults to the basename | |
34 | of the source with "-hg" appended. If the destination repository doesn't |
|
34 | of the source with "-hg" appended. If the destination repository doesn't | |
35 | exist, it will be created. |
|
35 | exist, it will be created. | |
36 |
|
36 | |||
37 | By default, all sources except Mercurial will use --branchsort. Mercurial |
|
37 | By default, all sources except Mercurial will use --branchsort. Mercurial | |
38 | uses --sourcesort to preserve original revision numbers order. Sort modes |
|
38 | uses --sourcesort to preserve original revision numbers order. Sort modes | |
39 | have the following effects: |
|
39 | have the following effects: | |
40 |
|
40 | |||
41 | --branchsort convert from parent to child revision when possible, which |
|
41 | --branchsort convert from parent to child revision when possible, which | |
42 | means branches are usually converted one after the other. |
|
42 | means branches are usually converted one after the other. | |
43 | It generates more compact repositories. |
|
43 | It generates more compact repositories. | |
44 | --datesort sort revisions by date. Converted repositories have good- |
|
44 | --datesort sort revisions by date. Converted repositories have good- | |
45 | looking changelogs but are often an order of magnitude |
|
45 | looking changelogs but are often an order of magnitude | |
46 | larger than the same ones generated by --branchsort. |
|
46 | larger than the same ones generated by --branchsort. | |
47 | --sourcesort try to preserve source revisions order, only supported by |
|
47 | --sourcesort try to preserve source revisions order, only supported by | |
48 | Mercurial sources. |
|
48 | Mercurial sources. | |
49 | --closesort try to move closed revisions as close as possible to parent |
|
49 | --closesort try to move closed revisions as close as possible to parent | |
50 | branches, only supported by Mercurial sources. |
|
50 | branches, only supported by Mercurial sources. | |
51 |
|
51 | |||
52 | If "REVMAP" isn't given, it will be put in a default location |
|
52 | If "REVMAP" isn't given, it will be put in a default location | |
53 | ("<dest>/.hg/shamap" by default). The "REVMAP" is a simple text file that |
|
53 | ("<dest>/.hg/shamap" by default). The "REVMAP" is a simple text file that | |
54 | maps each source commit ID to the destination ID for that revision, like |
|
54 | maps each source commit ID to the destination ID for that revision, like | |
55 | so: |
|
55 | so: | |
56 |
|
56 | |||
57 | <source ID> <destination ID> |
|
57 | <source ID> <destination ID> | |
58 |
|
58 | |||
59 | If the file doesn't exist, it's automatically created. It's updated on |
|
59 | If the file doesn't exist, it's automatically created. It's updated on | |
60 | each commit copied, so 'hg convert' can be interrupted and can be run |
|
60 | each commit copied, so 'hg convert' can be interrupted and can be run | |
61 | repeatedly to copy new commits. |
|
61 | repeatedly to copy new commits. | |
62 |
|
62 | |||
63 | The authormap is a simple text file that maps each source commit author to |
|
63 | The authormap is a simple text file that maps each source commit author to | |
64 | a destination commit author. It is handy for source SCMs that use unix |
|
64 | a destination commit author. It is handy for source SCMs that use unix | |
65 | logins to identify authors (e.g.: CVS). One line per author mapping and |
|
65 | logins to identify authors (e.g.: CVS). One line per author mapping and | |
66 | the line format is: |
|
66 | the line format is: | |
67 |
|
67 | |||
68 | source author = destination author |
|
68 | source author = destination author | |
69 |
|
69 | |||
70 | Empty lines and lines starting with a "#" are ignored. |
|
70 | Empty lines and lines starting with a "#" are ignored. | |
71 |
|
71 | |||
72 | The filemap is a file that allows filtering and remapping of files and |
|
72 | The filemap is a file that allows filtering and remapping of files and | |
73 | directories. Each line can contain one of the following directives: |
|
73 | directories. Each line can contain one of the following directives: | |
74 |
|
74 | |||
75 | include path/to/file-or-dir |
|
75 | include path/to/file-or-dir | |
76 |
|
76 | |||
77 | exclude path/to/file-or-dir |
|
77 | exclude path/to/file-or-dir | |
78 |
|
78 | |||
79 | rename path/to/source path/to/destination |
|
79 | rename path/to/source path/to/destination | |
80 |
|
80 | |||
81 | Comment lines start with "#". A specified path matches if it equals the |
|
81 | Comment lines start with "#". A specified path matches if it equals the | |
82 | full relative name of a file or one of its parent directories. The |
|
82 | full relative name of a file or one of its parent directories. The | |
83 | "include" or "exclude" directive with the longest matching path applies, |
|
83 | "include" or "exclude" directive with the longest matching path applies, | |
84 | so line order does not matter. |
|
84 | so line order does not matter. | |
85 |
|
85 | |||
86 | The "include" directive causes a file, or all files under a directory, to |
|
86 | The "include" directive causes a file, or all files under a directory, to | |
87 | be included in the destination repository. The default if there are no |
|
87 | be included in the destination repository. The default if there are no | |
88 | "include" statements is to include everything. If there are any "include" |
|
88 | "include" statements is to include everything. If there are any "include" | |
89 | statements, nothing else is included. The "exclude" directive causes files |
|
89 | statements, nothing else is included. The "exclude" directive causes files | |
90 | or directories to be omitted. The "rename" directive renames a file or |
|
90 | or directories to be omitted. The "rename" directive renames a file or | |
91 | directory if it is converted. To rename from a subdirectory into the root |
|
91 | directory if it is converted. To rename from a subdirectory into the root | |
92 | of the repository, use "." as the path to rename to. |
|
92 | of the repository, use "." as the path to rename to. | |
93 |
|
93 | |||
94 | "--full" will make sure the converted changesets contain exactly the right |
|
94 | "--full" will make sure the converted changesets contain exactly the right | |
95 | files with the right content. It will make a full conversion of all files, |
|
95 | files with the right content. It will make a full conversion of all files, | |
96 | not just the ones that have changed. Files that already are correct will |
|
96 | not just the ones that have changed. Files that already are correct will | |
97 | not be changed. This can be used to apply filemap changes when converting |
|
97 | not be changed. This can be used to apply filemap changes when converting | |
98 | incrementally. This is currently only supported for Mercurial and |
|
98 | incrementally. This is currently only supported for Mercurial and | |
99 | Subversion. |
|
99 | Subversion. | |
100 |
|
100 | |||
101 | The splicemap is a file that allows insertion of synthetic history, |
|
101 | The splicemap is a file that allows insertion of synthetic history, | |
102 | letting you specify the parents of a revision. This is useful if you want |
|
102 | letting you specify the parents of a revision. This is useful if you want | |
103 | to e.g. give a Subversion merge two parents, or graft two disconnected |
|
103 | to e.g. give a Subversion merge two parents, or graft two disconnected | |
104 | series of history together. Each entry contains a key, followed by a |
|
104 | series of history together. Each entry contains a key, followed by a | |
105 | space, followed by one or two comma-separated values: |
|
105 | space, followed by one or two comma-separated values: | |
106 |
|
106 | |||
107 | key parent1, parent2 |
|
107 | key parent1, parent2 | |
108 |
|
108 | |||
109 | The key is the revision ID in the source revision control system whose |
|
109 | The key is the revision ID in the source revision control system whose | |
110 | parents should be modified (same format as a key in .hg/shamap). The |
|
110 | parents should be modified (same format as a key in .hg/shamap). The | |
111 | values are the revision IDs (in either the source or destination revision |
|
111 | values are the revision IDs (in either the source or destination revision | |
112 | control system) that should be used as the new parents for that node. For |
|
112 | control system) that should be used as the new parents for that node. For | |
113 | example, if you have merged "release-1.0" into "trunk", then you should |
|
113 | example, if you have merged "release-1.0" into "trunk", then you should | |
114 | specify the revision on "trunk" as the first parent and the one on the |
|
114 | specify the revision on "trunk" as the first parent and the one on the | |
115 | "release-1.0" branch as the second. |
|
115 | "release-1.0" branch as the second. | |
116 |
|
116 | |||
117 | The branchmap is a file that allows you to rename a branch when it is |
|
117 | The branchmap is a file that allows you to rename a branch when it is | |
118 | being brought in from whatever external repository. When used in |
|
118 | being brought in from whatever external repository. When used in | |
119 | conjunction with a splicemap, it allows for a powerful combination to help |
|
119 | conjunction with a splicemap, it allows for a powerful combination to help | |
120 | fix even the most badly mismanaged repositories and turn them into nicely |
|
120 | fix even the most badly mismanaged repositories and turn them into nicely | |
121 | structured Mercurial repositories. The branchmap contains lines of the |
|
121 | structured Mercurial repositories. The branchmap contains lines of the | |
122 | form: |
|
122 | form: | |
123 |
|
123 | |||
124 | original_branch_name new_branch_name |
|
124 | original_branch_name new_branch_name | |
125 |
|
125 | |||
126 | where "original_branch_name" is the name of the branch in the source |
|
126 | where "original_branch_name" is the name of the branch in the source | |
127 | repository, and "new_branch_name" is the name of the branch is the |
|
127 | repository, and "new_branch_name" is the name of the branch is the | |
128 |
destination repository. No whitespace is allowed in the branch name |
|
128 | destination repository. No whitespace is allowed in the new branch name. | |
129 |
can be used to (for instance) move code in one repository from |
|
129 | This can be used to (for instance) move code in one repository from | |
130 | to a named branch. |
|
130 | "default" to a named branch. | |
131 |
|
131 | |||
132 | Mercurial Source |
|
132 | Mercurial Source | |
133 | ################ |
|
133 | ################ | |
134 |
|
134 | |||
135 | The Mercurial source recognizes the following configuration options, which |
|
135 | The Mercurial source recognizes the following configuration options, which | |
136 | you can set on the command line with "--config": |
|
136 | you can set on the command line with "--config": | |
137 |
|
137 | |||
138 | convert.hg.ignoreerrors |
|
138 | convert.hg.ignoreerrors | |
139 | ignore integrity errors when reading. Use it to fix |
|
139 | ignore integrity errors when reading. Use it to fix | |
140 | Mercurial repositories with missing revlogs, by converting |
|
140 | Mercurial repositories with missing revlogs, by converting | |
141 | from and to Mercurial. Default is False. |
|
141 | from and to Mercurial. Default is False. | |
142 | convert.hg.saverev |
|
142 | convert.hg.saverev | |
143 | store original revision ID in changeset (forces target IDs |
|
143 | store original revision ID in changeset (forces target IDs | |
144 | to change). It takes a boolean argument and defaults to |
|
144 | to change). It takes a boolean argument and defaults to | |
145 | False. |
|
145 | False. | |
146 | convert.hg.startrev |
|
146 | convert.hg.startrev | |
147 | specify the initial Mercurial revision. The default is 0. |
|
147 | specify the initial Mercurial revision. The default is 0. | |
148 | convert.hg.revs |
|
148 | convert.hg.revs | |
149 | revset specifying the source revisions to convert. |
|
149 | revset specifying the source revisions to convert. | |
150 |
|
150 | |||
151 | CVS Source |
|
151 | CVS Source | |
152 | ########## |
|
152 | ########## | |
153 |
|
153 | |||
154 | CVS source will use a sandbox (i.e. a checked-out copy) from CVS to |
|
154 | CVS source will use a sandbox (i.e. a checked-out copy) from CVS to | |
155 | indicate the starting point of what will be converted. Direct access to |
|
155 | indicate the starting point of what will be converted. Direct access to | |
156 | the repository files is not needed, unless of course the repository is |
|
156 | the repository files is not needed, unless of course the repository is | |
157 | ":local:". The conversion uses the top level directory in the sandbox to |
|
157 | ":local:". The conversion uses the top level directory in the sandbox to | |
158 | find the CVS repository, and then uses CVS rlog commands to find files to |
|
158 | find the CVS repository, and then uses CVS rlog commands to find files to | |
159 | convert. This means that unless a filemap is given, all files under the |
|
159 | convert. This means that unless a filemap is given, all files under the | |
160 | starting directory will be converted, and that any directory |
|
160 | starting directory will be converted, and that any directory | |
161 | reorganization in the CVS sandbox is ignored. |
|
161 | reorganization in the CVS sandbox is ignored. | |
162 |
|
162 | |||
163 | The following options can be used with "--config": |
|
163 | The following options can be used with "--config": | |
164 |
|
164 | |||
165 | convert.cvsps.cache |
|
165 | convert.cvsps.cache | |
166 | Set to False to disable remote log caching, for testing and |
|
166 | Set to False to disable remote log caching, for testing and | |
167 | debugging purposes. Default is True. |
|
167 | debugging purposes. Default is True. | |
168 | convert.cvsps.fuzz |
|
168 | convert.cvsps.fuzz | |
169 | Specify the maximum time (in seconds) that is allowed |
|
169 | Specify the maximum time (in seconds) that is allowed | |
170 | between commits with identical user and log message in a |
|
170 | between commits with identical user and log message in a | |
171 | single changeset. When very large files were checked in as |
|
171 | single changeset. When very large files were checked in as | |
172 | part of a changeset then the default may not be long enough. |
|
172 | part of a changeset then the default may not be long enough. | |
173 | The default is 60. |
|
173 | The default is 60. | |
174 | convert.cvsps.mergeto |
|
174 | convert.cvsps.mergeto | |
175 | Specify a regular expression to which commit log messages |
|
175 | Specify a regular expression to which commit log messages | |
176 | are matched. If a match occurs, then the conversion process |
|
176 | are matched. If a match occurs, then the conversion process | |
177 | will insert a dummy revision merging the branch on which |
|
177 | will insert a dummy revision merging the branch on which | |
178 | this log message occurs to the branch indicated in the |
|
178 | this log message occurs to the branch indicated in the | |
179 | regex. Default is "{{mergetobranch ([-\w]+)}}" |
|
179 | regex. Default is "{{mergetobranch ([-\w]+)}}" | |
180 | convert.cvsps.mergefrom |
|
180 | convert.cvsps.mergefrom | |
181 | Specify a regular expression to which commit log messages |
|
181 | Specify a regular expression to which commit log messages | |
182 | are matched. If a match occurs, then the conversion process |
|
182 | are matched. If a match occurs, then the conversion process | |
183 | will add the most recent revision on the branch indicated in |
|
183 | will add the most recent revision on the branch indicated in | |
184 | the regex as the second parent of the changeset. Default is |
|
184 | the regex as the second parent of the changeset. Default is | |
185 | "{{mergefrombranch ([-\w]+)}}" |
|
185 | "{{mergefrombranch ([-\w]+)}}" | |
186 | convert.localtimezone |
|
186 | convert.localtimezone | |
187 | use local time (as determined by the TZ environment |
|
187 | use local time (as determined by the TZ environment | |
188 | variable) for changeset date/times. The default is False |
|
188 | variable) for changeset date/times. The default is False | |
189 | (use UTC). |
|
189 | (use UTC). | |
190 | hooks.cvslog Specify a Python function to be called at the end of |
|
190 | hooks.cvslog Specify a Python function to be called at the end of | |
191 | gathering the CVS log. The function is passed a list with |
|
191 | gathering the CVS log. The function is passed a list with | |
192 | the log entries, and can modify the entries in-place, or add |
|
192 | the log entries, and can modify the entries in-place, or add | |
193 | or delete them. |
|
193 | or delete them. | |
194 | hooks.cvschangesets |
|
194 | hooks.cvschangesets | |
195 | Specify a Python function to be called after the changesets |
|
195 | Specify a Python function to be called after the changesets | |
196 | are calculated from the CVS log. The function is passed a |
|
196 | are calculated from the CVS log. The function is passed a | |
197 | list with the changeset entries, and can modify the |
|
197 | list with the changeset entries, and can modify the | |
198 | changesets in-place, or add or delete them. |
|
198 | changesets in-place, or add or delete them. | |
199 |
|
199 | |||
200 | An additional "debugcvsps" Mercurial command allows the builtin changeset |
|
200 | An additional "debugcvsps" Mercurial command allows the builtin changeset | |
201 | merging code to be run without doing a conversion. Its parameters and |
|
201 | merging code to be run without doing a conversion. Its parameters and | |
202 | output are similar to that of cvsps 2.1. Please see the command help for |
|
202 | output are similar to that of cvsps 2.1. Please see the command help for | |
203 | more details. |
|
203 | more details. | |
204 |
|
204 | |||
205 | Subversion Source |
|
205 | Subversion Source | |
206 | ################# |
|
206 | ################# | |
207 |
|
207 | |||
208 | Subversion source detects classical trunk/branches/tags layouts. By |
|
208 | Subversion source detects classical trunk/branches/tags layouts. By | |
209 | default, the supplied "svn://repo/path/" source URL is converted as a |
|
209 | default, the supplied "svn://repo/path/" source URL is converted as a | |
210 | single branch. If "svn://repo/path/trunk" exists it replaces the default |
|
210 | single branch. If "svn://repo/path/trunk" exists it replaces the default | |
211 | branch. If "svn://repo/path/branches" exists, its subdirectories are |
|
211 | branch. If "svn://repo/path/branches" exists, its subdirectories are | |
212 | listed as possible branches. If "svn://repo/path/tags" exists, it is |
|
212 | listed as possible branches. If "svn://repo/path/tags" exists, it is | |
213 | looked for tags referencing converted branches. Default "trunk", |
|
213 | looked for tags referencing converted branches. Default "trunk", | |
214 | "branches" and "tags" values can be overridden with following options. Set |
|
214 | "branches" and "tags" values can be overridden with following options. Set | |
215 | them to paths relative to the source URL, or leave them blank to disable |
|
215 | them to paths relative to the source URL, or leave them blank to disable | |
216 | auto detection. |
|
216 | auto detection. | |
217 |
|
217 | |||
218 | The following options can be set with "--config": |
|
218 | The following options can be set with "--config": | |
219 |
|
219 | |||
220 | convert.svn.branches |
|
220 | convert.svn.branches | |
221 | specify the directory containing branches. The default is |
|
221 | specify the directory containing branches. The default is | |
222 | "branches". |
|
222 | "branches". | |
223 | convert.svn.tags |
|
223 | convert.svn.tags | |
224 | specify the directory containing tags. The default is |
|
224 | specify the directory containing tags. The default is | |
225 | "tags". |
|
225 | "tags". | |
226 | convert.svn.trunk |
|
226 | convert.svn.trunk | |
227 | specify the name of the trunk branch. The default is |
|
227 | specify the name of the trunk branch. The default is | |
228 | "trunk". |
|
228 | "trunk". | |
229 | convert.localtimezone |
|
229 | convert.localtimezone | |
230 | use local time (as determined by the TZ environment |
|
230 | use local time (as determined by the TZ environment | |
231 | variable) for changeset date/times. The default is False |
|
231 | variable) for changeset date/times. The default is False | |
232 | (use UTC). |
|
232 | (use UTC). | |
233 |
|
233 | |||
234 | Source history can be retrieved starting at a specific revision, instead |
|
234 | Source history can be retrieved starting at a specific revision, instead | |
235 | of being integrally converted. Only single branch conversions are |
|
235 | of being integrally converted. Only single branch conversions are | |
236 | supported. |
|
236 | supported. | |
237 |
|
237 | |||
238 | convert.svn.startrev |
|
238 | convert.svn.startrev | |
239 | specify start Subversion revision number. The default is 0. |
|
239 | specify start Subversion revision number. The default is 0. | |
240 |
|
240 | |||
241 | Git Source |
|
241 | Git Source | |
242 | ########## |
|
242 | ########## | |
243 |
|
243 | |||
244 | The Git importer converts commits from all reachable branches (refs in |
|
244 | The Git importer converts commits from all reachable branches (refs in | |
245 | refs/heads) and remotes (refs in refs/remotes) to Mercurial. Branches are |
|
245 | refs/heads) and remotes (refs in refs/remotes) to Mercurial. Branches are | |
246 | converted to bookmarks with the same name, with the leading 'refs/heads' |
|
246 | converted to bookmarks with the same name, with the leading 'refs/heads' | |
247 | stripped. Git submodules are converted to Git subrepos in Mercurial. |
|
247 | stripped. Git submodules are converted to Git subrepos in Mercurial. | |
248 |
|
248 | |||
249 | The following options can be set with "--config": |
|
249 | The following options can be set with "--config": | |
250 |
|
250 | |||
251 | convert.git.similarity |
|
251 | convert.git.similarity | |
252 | specify how similar files modified in a commit must be to be |
|
252 | specify how similar files modified in a commit must be to be | |
253 | imported as renames or copies, as a percentage between "0" |
|
253 | imported as renames or copies, as a percentage between "0" | |
254 | (disabled) and "100" (files must be identical). For example, |
|
254 | (disabled) and "100" (files must be identical). For example, | |
255 | "90" means that a delete/add pair will be imported as a |
|
255 | "90" means that a delete/add pair will be imported as a | |
256 | rename if more than 90% of the file hasn't changed. The |
|
256 | rename if more than 90% of the file hasn't changed. The | |
257 | default is "50". |
|
257 | default is "50". | |
258 | convert.git.findcopiesharder |
|
258 | convert.git.findcopiesharder | |
259 | while detecting copies, look at all files in the working |
|
259 | while detecting copies, look at all files in the working | |
260 | copy instead of just changed ones. This is very expensive |
|
260 | copy instead of just changed ones. This is very expensive | |
261 | for large projects, and is only effective when |
|
261 | for large projects, and is only effective when | |
262 | "convert.git.similarity" is greater than 0. The default is |
|
262 | "convert.git.similarity" is greater than 0. The default is | |
263 | False. |
|
263 | False. | |
264 | convert.git.renamelimit |
|
264 | convert.git.renamelimit | |
265 | perform rename and copy detection up to this many changed |
|
265 | perform rename and copy detection up to this many changed | |
266 | files in a commit. Increasing this will make rename and copy |
|
266 | files in a commit. Increasing this will make rename and copy | |
267 | detection more accurate but will significantly slow down |
|
267 | detection more accurate but will significantly slow down | |
268 | computation on large projects. The option is only relevant |
|
268 | computation on large projects. The option is only relevant | |
269 | if "convert.git.similarity" is greater than 0. The default |
|
269 | if "convert.git.similarity" is greater than 0. The default | |
270 | is "400". |
|
270 | is "400". | |
271 | convert.git.committeractions |
|
271 | convert.git.committeractions | |
272 | list of actions to take when processing author and committer |
|
272 | list of actions to take when processing author and committer | |
273 | values. |
|
273 | values. | |
274 |
|
274 | |||
275 | Git commits have separate author (who wrote the commit) and committer |
|
275 | Git commits have separate author (who wrote the commit) and committer | |
276 | (who applied the commit) fields. Not all destinations support separate |
|
276 | (who applied the commit) fields. Not all destinations support separate | |
277 | author and committer fields (including Mercurial). This config option |
|
277 | author and committer fields (including Mercurial). This config option | |
278 | controls what to do with these author and committer fields during |
|
278 | controls what to do with these author and committer fields during | |
279 | conversion. |
|
279 | conversion. | |
280 |
|
280 | |||
281 | A value of "messagedifferent" will append a "committer: ..." line to |
|
281 | A value of "messagedifferent" will append a "committer: ..." line to | |
282 | the commit message if the Git committer is different from the author. |
|
282 | the commit message if the Git committer is different from the author. | |
283 | The prefix of that line can be specified using the syntax |
|
283 | The prefix of that line can be specified using the syntax | |
284 | "messagedifferent=<prefix>". e.g. "messagedifferent=git-committer:". |
|
284 | "messagedifferent=<prefix>". e.g. "messagedifferent=git-committer:". | |
285 | When a prefix is specified, a space will always be inserted between |
|
285 | When a prefix is specified, a space will always be inserted between | |
286 | the prefix and the value. |
|
286 | the prefix and the value. | |
287 |
|
287 | |||
288 | "messagealways" behaves like "messagedifferent" except it will always |
|
288 | "messagealways" behaves like "messagedifferent" except it will always | |
289 | result in a "committer: ..." line being appended to the commit |
|
289 | result in a "committer: ..." line being appended to the commit | |
290 | message. This value is mutually exclusive with "messagedifferent". |
|
290 | message. This value is mutually exclusive with "messagedifferent". | |
291 |
|
291 | |||
292 | "dropcommitter" will remove references to the committer. Only |
|
292 | "dropcommitter" will remove references to the committer. Only | |
293 | references to the author will remain. Actions that add references to |
|
293 | references to the author will remain. Actions that add references to | |
294 | the committer will have no effect when this is set. |
|
294 | the committer will have no effect when this is set. | |
295 |
|
295 | |||
296 | "replaceauthor" will replace the value of the author field with the |
|
296 | "replaceauthor" will replace the value of the author field with the | |
297 | committer. Other actions that add references to the committer will |
|
297 | committer. Other actions that add references to the committer will | |
298 | still take effect when this is set. |
|
298 | still take effect when this is set. | |
299 |
|
299 | |||
300 | The default is "messagedifferent". |
|
300 | The default is "messagedifferent". | |
301 |
|
301 | |||
302 | convert.git.extrakeys |
|
302 | convert.git.extrakeys | |
303 | list of extra keys from commit metadata to copy to the |
|
303 | list of extra keys from commit metadata to copy to the | |
304 | destination. Some Git repositories store extra metadata in |
|
304 | destination. Some Git repositories store extra metadata in | |
305 | commits. By default, this non-default metadata will be lost |
|
305 | commits. By default, this non-default metadata will be lost | |
306 | during conversion. Setting this config option can retain |
|
306 | during conversion. Setting this config option can retain | |
307 | that metadata. Some built-in keys such as "parent" and |
|
307 | that metadata. Some built-in keys such as "parent" and | |
308 | "branch" are not allowed to be copied. |
|
308 | "branch" are not allowed to be copied. | |
309 | convert.git.remoteprefix |
|
309 | convert.git.remoteprefix | |
310 | remote refs are converted as bookmarks with |
|
310 | remote refs are converted as bookmarks with | |
311 | "convert.git.remoteprefix" as a prefix followed by a /. The |
|
311 | "convert.git.remoteprefix" as a prefix followed by a /. The | |
312 | default is 'remote'. |
|
312 | default is 'remote'. | |
313 | convert.git.saverev |
|
313 | convert.git.saverev | |
314 | whether to store the original Git commit ID in the metadata |
|
314 | whether to store the original Git commit ID in the metadata | |
315 | of the destination commit. The default is True. |
|
315 | of the destination commit. The default is True. | |
316 | convert.git.skipsubmodules |
|
316 | convert.git.skipsubmodules | |
317 | does not convert root level .gitmodules files or files with |
|
317 | does not convert root level .gitmodules files or files with | |
318 | 160000 mode indicating a submodule. Default is False. |
|
318 | 160000 mode indicating a submodule. Default is False. | |
319 |
|
319 | |||
320 | Perforce Source |
|
320 | Perforce Source | |
321 | ############### |
|
321 | ############### | |
322 |
|
322 | |||
323 | The Perforce (P4) importer can be given a p4 depot path or a client |
|
323 | The Perforce (P4) importer can be given a p4 depot path or a client | |
324 | specification as source. It will convert all files in the source to a flat |
|
324 | specification as source. It will convert all files in the source to a flat | |
325 | Mercurial repository, ignoring labels, branches and integrations. Note |
|
325 | Mercurial repository, ignoring labels, branches and integrations. Note | |
326 | that when a depot path is given you then usually should specify a target |
|
326 | that when a depot path is given you then usually should specify a target | |
327 | directory, because otherwise the target may be named "...-hg". |
|
327 | directory, because otherwise the target may be named "...-hg". | |
328 |
|
328 | |||
329 | The following options can be set with "--config": |
|
329 | The following options can be set with "--config": | |
330 |
|
330 | |||
331 | convert.p4.encoding |
|
331 | convert.p4.encoding | |
332 | specify the encoding to use when decoding standard output of |
|
332 | specify the encoding to use when decoding standard output of | |
333 | the Perforce command line tool. The default is default |
|
333 | the Perforce command line tool. The default is default | |
334 | system encoding. |
|
334 | system encoding. | |
335 | convert.p4.startrev |
|
335 | convert.p4.startrev | |
336 | specify initial Perforce revision (a Perforce changelist |
|
336 | specify initial Perforce revision (a Perforce changelist | |
337 | number). |
|
337 | number). | |
338 |
|
338 | |||
339 | Mercurial Destination |
|
339 | Mercurial Destination | |
340 | ##################### |
|
340 | ##################### | |
341 |
|
341 | |||
342 | The Mercurial destination will recognize Mercurial subrepositories in the |
|
342 | The Mercurial destination will recognize Mercurial subrepositories in the | |
343 | destination directory, and update the .hgsubstate file automatically if |
|
343 | destination directory, and update the .hgsubstate file automatically if | |
344 | the destination subrepositories contain the <dest>/<sub>/.hg/shamap file. |
|
344 | the destination subrepositories contain the <dest>/<sub>/.hg/shamap file. | |
345 | Converting a repository with subrepositories requires converting a single |
|
345 | Converting a repository with subrepositories requires converting a single | |
346 | repository at a time, from the bottom up. |
|
346 | repository at a time, from the bottom up. | |
347 |
|
347 | |||
348 | The following options are supported: |
|
348 | The following options are supported: | |
349 |
|
349 | |||
350 | convert.hg.clonebranches |
|
350 | convert.hg.clonebranches | |
351 | dispatch source branches in separate clones. The default is |
|
351 | dispatch source branches in separate clones. The default is | |
352 | False. |
|
352 | False. | |
353 | convert.hg.tagsbranch |
|
353 | convert.hg.tagsbranch | |
354 | branch name for tag revisions, defaults to "default". |
|
354 | branch name for tag revisions, defaults to "default". | |
355 | convert.hg.usebranchnames |
|
355 | convert.hg.usebranchnames | |
356 | preserve branch names. The default is True. |
|
356 | preserve branch names. The default is True. | |
357 | convert.hg.sourcename |
|
357 | convert.hg.sourcename | |
358 | records the given string as a 'convert_source' extra value |
|
358 | records the given string as a 'convert_source' extra value | |
359 | on each commit made in the target repository. The default is |
|
359 | on each commit made in the target repository. The default is | |
360 | None. |
|
360 | None. | |
361 |
|
361 | |||
362 | All Destinations |
|
362 | All Destinations | |
363 | ################ |
|
363 | ################ | |
364 |
|
364 | |||
365 | All destination types accept the following options: |
|
365 | All destination types accept the following options: | |
366 |
|
366 | |||
367 | convert.skiptags |
|
367 | convert.skiptags | |
368 | does not convert tags from the source repo to the target |
|
368 | does not convert tags from the source repo to the target | |
369 | repo. The default is False. |
|
369 | repo. The default is False. | |
370 |
|
370 | |||
371 | options ([+] can be repeated): |
|
371 | options ([+] can be repeated): | |
372 |
|
372 | |||
373 | -s --source-type TYPE source repository type |
|
373 | -s --source-type TYPE source repository type | |
374 | -d --dest-type TYPE destination repository type |
|
374 | -d --dest-type TYPE destination repository type | |
375 | -r --rev REV [+] import up to source revision REV |
|
375 | -r --rev REV [+] import up to source revision REV | |
376 | -A --authormap FILE remap usernames using this file |
|
376 | -A --authormap FILE remap usernames using this file | |
377 | --filemap FILE remap file names using contents of file |
|
377 | --filemap FILE remap file names using contents of file | |
378 | --full apply filemap changes by converting all files again |
|
378 | --full apply filemap changes by converting all files again | |
379 | --splicemap FILE splice synthesized history into place |
|
379 | --splicemap FILE splice synthesized history into place | |
380 | --branchmap FILE change branch names while converting |
|
380 | --branchmap FILE change branch names while converting | |
381 | --branchsort try to sort changesets by branches |
|
381 | --branchsort try to sort changesets by branches | |
382 | --datesort try to sort changesets by date |
|
382 | --datesort try to sort changesets by date | |
383 | --sourcesort preserve source changesets order |
|
383 | --sourcesort preserve source changesets order | |
384 | --closesort try to reorder closed revisions |
|
384 | --closesort try to reorder closed revisions | |
385 |
|
385 | |||
386 | (some details hidden, use --verbose to show complete help) |
|
386 | (some details hidden, use --verbose to show complete help) | |
387 | $ hg init a |
|
387 | $ hg init a | |
388 | $ cd a |
|
388 | $ cd a | |
389 | $ echo a > a |
|
389 | $ echo a > a | |
390 | $ hg ci -d'0 0' -Ama |
|
390 | $ hg ci -d'0 0' -Ama | |
391 | adding a |
|
391 | adding a | |
392 | $ hg cp a b |
|
392 | $ hg cp a b | |
393 | $ hg ci -d'1 0' -mb |
|
393 | $ hg ci -d'1 0' -mb | |
394 | $ hg rm a |
|
394 | $ hg rm a | |
395 | $ hg ci -d'2 0' -mc |
|
395 | $ hg ci -d'2 0' -mc | |
396 | $ hg mv b a |
|
396 | $ hg mv b a | |
397 | $ hg ci -d'3 0' -md |
|
397 | $ hg ci -d'3 0' -md | |
398 | $ echo a >> a |
|
398 | $ echo a >> a | |
399 | $ hg ci -d'4 0' -me |
|
399 | $ hg ci -d'4 0' -me | |
400 | $ cd .. |
|
400 | $ cd .. | |
401 | $ hg convert a 2>&1 | grep -v 'subversion python bindings could not be loaded' |
|
401 | $ hg convert a 2>&1 | grep -v 'subversion python bindings could not be loaded' | |
402 | assuming destination a-hg |
|
402 | assuming destination a-hg | |
403 | initializing destination a-hg repository |
|
403 | initializing destination a-hg repository | |
404 | scanning source... |
|
404 | scanning source... | |
405 | sorting... |
|
405 | sorting... | |
406 | converting... |
|
406 | converting... | |
407 | 4 a |
|
407 | 4 a | |
408 | 3 b |
|
408 | 3 b | |
409 | 2 c |
|
409 | 2 c | |
410 | 1 d |
|
410 | 1 d | |
411 | 0 e |
|
411 | 0 e | |
412 | $ hg --cwd a-hg pull ../a |
|
412 | $ hg --cwd a-hg pull ../a | |
413 | pulling from ../a |
|
413 | pulling from ../a | |
414 | searching for changes |
|
414 | searching for changes | |
415 | no changes found |
|
415 | no changes found | |
416 |
|
416 | |||
417 | conversion to existing file should fail |
|
417 | conversion to existing file should fail | |
418 |
|
418 | |||
419 | $ touch bogusfile |
|
419 | $ touch bogusfile | |
420 | $ hg convert a bogusfile |
|
420 | $ hg convert a bogusfile | |
421 | initializing destination bogusfile repository |
|
421 | initializing destination bogusfile repository | |
422 | abort: cannot create new bundle repository |
|
422 | abort: cannot create new bundle repository | |
423 | [255] |
|
423 | [255] | |
424 |
|
424 | |||
425 | #if unix-permissions no-root |
|
425 | #if unix-permissions no-root | |
426 |
|
426 | |||
427 | conversion to dir without permissions should fail |
|
427 | conversion to dir without permissions should fail | |
428 |
|
428 | |||
429 | $ mkdir bogusdir |
|
429 | $ mkdir bogusdir | |
430 | $ chmod 000 bogusdir |
|
430 | $ chmod 000 bogusdir | |
431 |
|
431 | |||
432 | $ hg convert a bogusdir |
|
432 | $ hg convert a bogusdir | |
433 | abort: Permission denied: 'bogusdir' |
|
433 | abort: Permission denied: 'bogusdir' | |
434 | [255] |
|
434 | [255] | |
435 |
|
435 | |||
436 | user permissions should succeed |
|
436 | user permissions should succeed | |
437 |
|
437 | |||
438 | $ chmod 700 bogusdir |
|
438 | $ chmod 700 bogusdir | |
439 | $ hg convert a bogusdir |
|
439 | $ hg convert a bogusdir | |
440 | initializing destination bogusdir repository |
|
440 | initializing destination bogusdir repository | |
441 | scanning source... |
|
441 | scanning source... | |
442 | sorting... |
|
442 | sorting... | |
443 | converting... |
|
443 | converting... | |
444 | 4 a |
|
444 | 4 a | |
445 | 3 b |
|
445 | 3 b | |
446 | 2 c |
|
446 | 2 c | |
447 | 1 d |
|
447 | 1 d | |
448 | 0 e |
|
448 | 0 e | |
449 |
|
449 | |||
450 | #endif |
|
450 | #endif | |
451 |
|
451 | |||
452 | test pre and post conversion actions |
|
452 | test pre and post conversion actions | |
453 |
|
453 | |||
454 | $ echo 'include b' > filemap |
|
454 | $ echo 'include b' > filemap | |
455 | $ hg convert --debug --filemap filemap a partialb | \ |
|
455 | $ hg convert --debug --filemap filemap a partialb | \ | |
456 | > grep 'run hg' |
|
456 | > grep 'run hg' | |
457 | run hg source pre-conversion action |
|
457 | run hg source pre-conversion action | |
458 | run hg sink pre-conversion action |
|
458 | run hg sink pre-conversion action | |
459 | run hg sink post-conversion action |
|
459 | run hg sink post-conversion action | |
460 | run hg source post-conversion action |
|
460 | run hg source post-conversion action | |
461 |
|
461 | |||
462 | converting empty dir should fail "nicely |
|
462 | converting empty dir should fail "nicely | |
463 |
|
463 | |||
464 | $ mkdir emptydir |
|
464 | $ mkdir emptydir | |
465 |
|
465 | |||
466 | override $PATH to ensure p4 not visible; use $PYTHON in case we're |
|
466 | override $PATH to ensure p4 not visible; use $PYTHON in case we're | |
467 | running from a devel copy, not a temp installation |
|
467 | running from a devel copy, not a temp installation | |
468 |
|
468 | |||
469 | $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg convert emptydir |
|
469 | $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg convert emptydir | |
470 | assuming destination emptydir-hg |
|
470 | assuming destination emptydir-hg | |
471 | initializing destination emptydir-hg repository |
|
471 | initializing destination emptydir-hg repository | |
472 | emptydir does not look like a CVS checkout |
|
472 | emptydir does not look like a CVS checkout | |
473 | $TESTTMP/emptydir does not look like a Git repository (glob) |
|
473 | $TESTTMP/emptydir does not look like a Git repository (glob) | |
474 | emptydir does not look like a Subversion repository |
|
474 | emptydir does not look like a Subversion repository | |
475 | emptydir is not a local Mercurial repository |
|
475 | emptydir is not a local Mercurial repository | |
476 | emptydir does not look like a darcs repository |
|
476 | emptydir does not look like a darcs repository | |
477 | emptydir does not look like a monotone repository |
|
477 | emptydir does not look like a monotone repository | |
478 | emptydir does not look like a GNU Arch repository |
|
478 | emptydir does not look like a GNU Arch repository | |
479 | emptydir does not look like a Bazaar repository |
|
479 | emptydir does not look like a Bazaar repository | |
480 | cannot find required "p4" tool |
|
480 | cannot find required "p4" tool | |
481 | abort: emptydir: missing or unsupported repository |
|
481 | abort: emptydir: missing or unsupported repository | |
482 | [255] |
|
482 | [255] | |
483 |
|
483 | |||
484 | convert with imaginary source type |
|
484 | convert with imaginary source type | |
485 |
|
485 | |||
486 | $ hg convert --source-type foo a a-foo |
|
486 | $ hg convert --source-type foo a a-foo | |
487 | initializing destination a-foo repository |
|
487 | initializing destination a-foo repository | |
488 | abort: foo: invalid source repository type |
|
488 | abort: foo: invalid source repository type | |
489 | [255] |
|
489 | [255] | |
490 |
|
490 | |||
491 | convert with imaginary sink type |
|
491 | convert with imaginary sink type | |
492 |
|
492 | |||
493 | $ hg convert --dest-type foo a a-foo |
|
493 | $ hg convert --dest-type foo a a-foo | |
494 | abort: foo: invalid destination repository type |
|
494 | abort: foo: invalid destination repository type | |
495 | [255] |
|
495 | [255] | |
496 |
|
496 | |||
497 | testing: convert must not produce duplicate entries in fncache |
|
497 | testing: convert must not produce duplicate entries in fncache | |
498 |
|
498 | |||
499 | $ hg convert a b |
|
499 | $ hg convert a b | |
500 | initializing destination b repository |
|
500 | initializing destination b repository | |
501 | scanning source... |
|
501 | scanning source... | |
502 | sorting... |
|
502 | sorting... | |
503 | converting... |
|
503 | converting... | |
504 | 4 a |
|
504 | 4 a | |
505 | 3 b |
|
505 | 3 b | |
506 | 2 c |
|
506 | 2 c | |
507 | 1 d |
|
507 | 1 d | |
508 | 0 e |
|
508 | 0 e | |
509 |
|
509 | |||
510 | contents of fncache file: |
|
510 | contents of fncache file: | |
511 |
|
511 | |||
512 | $ cat b/.hg/store/fncache | sort |
|
512 | $ cat b/.hg/store/fncache | sort | |
513 | data/a.i |
|
513 | data/a.i | |
514 | data/b.i |
|
514 | data/b.i | |
515 |
|
515 | |||
516 | test bogus URL |
|
516 | test bogus URL | |
517 |
|
517 | |||
518 | $ hg convert -q bzr+ssh://foobar@selenic.com/baz baz |
|
518 | $ hg convert -q bzr+ssh://foobar@selenic.com/baz baz | |
519 | abort: bzr+ssh://foobar@selenic.com/baz: missing or unsupported repository |
|
519 | abort: bzr+ssh://foobar@selenic.com/baz: missing or unsupported repository | |
520 | [255] |
|
520 | [255] | |
521 |
|
521 | |||
522 | test revset converted() lookup |
|
522 | test revset converted() lookup | |
523 |
|
523 | |||
524 | $ hg --config convert.hg.saverev=True convert a c |
|
524 | $ hg --config convert.hg.saverev=True convert a c | |
525 | initializing destination c repository |
|
525 | initializing destination c repository | |
526 | scanning source... |
|
526 | scanning source... | |
527 | sorting... |
|
527 | sorting... | |
528 | converting... |
|
528 | converting... | |
529 | 4 a |
|
529 | 4 a | |
530 | 3 b |
|
530 | 3 b | |
531 | 2 c |
|
531 | 2 c | |
532 | 1 d |
|
532 | 1 d | |
533 | 0 e |
|
533 | 0 e | |
534 | $ echo f > c/f |
|
534 | $ echo f > c/f | |
535 | $ hg -R c ci -d'0 0' -Amf |
|
535 | $ hg -R c ci -d'0 0' -Amf | |
536 | adding f |
|
536 | adding f | |
537 | created new head |
|
537 | created new head | |
538 | $ hg -R c log -r "converted(09d945a62ce6)" |
|
538 | $ hg -R c log -r "converted(09d945a62ce6)" | |
539 | changeset: 1:98c3dd46a874 |
|
539 | changeset: 1:98c3dd46a874 | |
540 | user: test |
|
540 | user: test | |
541 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
541 | date: Thu Jan 01 00:00:01 1970 +0000 | |
542 | summary: b |
|
542 | summary: b | |
543 |
|
543 | |||
544 | $ hg -R c log -r "converted()" |
|
544 | $ hg -R c log -r "converted()" | |
545 | changeset: 0:31ed57b2037c |
|
545 | changeset: 0:31ed57b2037c | |
546 | user: test |
|
546 | user: test | |
547 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
547 | date: Thu Jan 01 00:00:00 1970 +0000 | |
548 | summary: a |
|
548 | summary: a | |
549 |
|
549 | |||
550 | changeset: 1:98c3dd46a874 |
|
550 | changeset: 1:98c3dd46a874 | |
551 | user: test |
|
551 | user: test | |
552 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
552 | date: Thu Jan 01 00:00:01 1970 +0000 | |
553 | summary: b |
|
553 | summary: b | |
554 |
|
554 | |||
555 | changeset: 2:3b9ca06ef716 |
|
555 | changeset: 2:3b9ca06ef716 | |
556 | user: test |
|
556 | user: test | |
557 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
557 | date: Thu Jan 01 00:00:02 1970 +0000 | |
558 | summary: c |
|
558 | summary: c | |
559 |
|
559 | |||
560 | changeset: 3:4e0debd37cf2 |
|
560 | changeset: 3:4e0debd37cf2 | |
561 | user: test |
|
561 | user: test | |
562 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
562 | date: Thu Jan 01 00:00:03 1970 +0000 | |
563 | summary: d |
|
563 | summary: d | |
564 |
|
564 | |||
565 | changeset: 4:9de3bc9349c5 |
|
565 | changeset: 4:9de3bc9349c5 | |
566 | user: test |
|
566 | user: test | |
567 | date: Thu Jan 01 00:00:04 1970 +0000 |
|
567 | date: Thu Jan 01 00:00:04 1970 +0000 | |
568 | summary: e |
|
568 | summary: e | |
569 |
|
569 | |||
570 |
|
570 | |||
571 | test specifying a sourcename |
|
571 | test specifying a sourcename | |
572 | $ echo g > a/g |
|
572 | $ echo g > a/g | |
573 | $ hg -R a ci -d'0 0' -Amg |
|
573 | $ hg -R a ci -d'0 0' -Amg | |
574 | adding g |
|
574 | adding g | |
575 | $ hg --config convert.hg.sourcename=mysource --config convert.hg.saverev=True convert a c |
|
575 | $ hg --config convert.hg.sourcename=mysource --config convert.hg.saverev=True convert a c | |
576 | scanning source... |
|
576 | scanning source... | |
577 | sorting... |
|
577 | sorting... | |
578 | converting... |
|
578 | converting... | |
579 | 0 g |
|
579 | 0 g | |
580 | $ hg -R c log -r tip --template '{extras % "{extra}\n"}' |
|
580 | $ hg -R c log -r tip --template '{extras % "{extra}\n"}' | |
581 | branch=default |
|
581 | branch=default | |
582 | convert_revision=a3bc6100aa8ec03e00aaf271f1f50046fb432072 |
|
582 | convert_revision=a3bc6100aa8ec03e00aaf271f1f50046fb432072 | |
583 | convert_source=mysource |
|
583 | convert_source=mysource | |
|
584 | ||||
|
585 | $ cat > branchmap.txt << EOF | |||
|
586 | > old branch new_branch | |||
|
587 | > EOF | |||
|
588 | ||||
|
589 | $ hg -R a branch -q 'old branch' | |||
|
590 | $ echo gg > a/g | |||
|
591 | $ hg -R a ci -m 'branch name with spaces' | |||
|
592 | $ hg convert --branchmap branchmap.txt a d | |||
|
593 | initializing destination d repository | |||
|
594 | scanning source... | |||
|
595 | sorting... | |||
|
596 | converting... | |||
|
597 | 6 a | |||
|
598 | 5 b | |||
|
599 | 4 c | |||
|
600 | 3 d | |||
|
601 | 2 e | |||
|
602 | 1 g | |||
|
603 | 0 branch name with spaces | |||
|
604 | ||||
|
605 | $ hg -R a branches | |||
|
606 | old branch 6:a24a66ade009 | |||
|
607 | default 5:a3bc6100aa8e (inactive) | |||
|
608 | $ hg -R d branches | |||
|
609 | new_branch 6:64ed208b732b | |||
|
610 | default 5:a3bc6100aa8e (inactive) |
General Comments 0
You need to be logged in to leave comments.
Login now