Show More
@@ -1,336 +1,336 | |||||
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 | import convcmd |
|
10 | import convcmd | |
11 | import cvsps |
|
11 | import cvsps | |
12 | import subversion |
|
12 | import subversion | |
13 | from mercurial import commands |
|
13 | from mercurial import commands | |
14 | from mercurial.i18n import _ |
|
14 | from mercurial.i18n import _ | |
15 |
|
15 | |||
16 | # Commands definition was moved elsewhere to ease demandload job. |
|
16 | # Commands definition was moved elsewhere to ease demandload job. | |
17 |
|
17 | |||
18 | def convert(ui, src, dest=None, revmapfile=None, **opts): |
|
18 | def convert(ui, src, dest=None, revmapfile=None, **opts): | |
19 | """convert a foreign SCM repository to a Mercurial one. |
|
19 | """convert a foreign SCM repository to a Mercurial one. | |
20 |
|
20 | |||
21 | Accepted source formats [identifiers]: |
|
21 | Accepted source formats [identifiers]: | |
22 |
|
22 | |||
23 | - Mercurial [hg] |
|
23 | - Mercurial [hg] | |
24 | - CVS [cvs] |
|
24 | - CVS [cvs] | |
25 | - Darcs [darcs] |
|
25 | - Darcs [darcs] | |
26 | - git [git] |
|
26 | - git [git] | |
27 | - Subversion [svn] |
|
27 | - Subversion [svn] | |
28 | - Monotone [mtn] |
|
28 | - Monotone [mtn] | |
29 | - GNU Arch [gnuarch] |
|
29 | - GNU Arch [gnuarch] | |
30 | - Bazaar [bzr] |
|
30 | - Bazaar [bzr] | |
31 | - Perforce [p4] |
|
31 | - Perforce [p4] | |
32 |
|
32 | |||
33 | Accepted destination formats [identifiers]: |
|
33 | Accepted destination formats [identifiers]: | |
34 |
|
34 | |||
35 | - Mercurial [hg] |
|
35 | - Mercurial [hg] | |
36 | - Subversion [svn] (history on branches is not preserved) |
|
36 | - Subversion [svn] (history on branches is not preserved) | |
37 |
|
37 | |||
38 | If no revision is given, all revisions will be converted. |
|
38 | If no revision is given, all revisions will be converted. | |
39 | Otherwise, convert will only import up to the named revision |
|
39 | Otherwise, convert will only import up to the named revision | |
40 | (given in a format understood by the source). |
|
40 | (given in a format understood by the source). | |
41 |
|
41 | |||
42 | If no destination directory name is specified, it defaults to the |
|
42 | If no destination directory name is specified, it defaults to the | |
43 | basename of the source with ``-hg`` appended. If the destination |
|
43 | basename of the source with ``-hg`` appended. If the destination | |
44 | repository doesn't exist, it will be created. |
|
44 | repository doesn't exist, it will be created. | |
45 |
|
45 | |||
46 | By default, all sources except Mercurial will use --branchsort. |
|
46 | By default, all sources except Mercurial will use --branchsort. | |
47 | Mercurial uses --sourcesort to preserve original revision numbers |
|
47 | Mercurial uses --sourcesort to preserve original revision numbers | |
48 | order. Sort modes have the following effects: |
|
48 | order. Sort modes have the following effects: | |
49 |
|
49 | |||
50 | --branchsort convert from parent to child revision when possible, |
|
50 | --branchsort convert from parent to child revision when possible, | |
51 | which means branches are usually converted one after |
|
51 | which means branches are usually converted one after | |
52 | the other. It generates more compact repositories. |
|
52 | the other. It generates more compact repositories. | |
53 |
|
53 | |||
54 | --datesort sort revisions by date. Converted repositories have |
|
54 | --datesort sort revisions by date. Converted repositories have | |
55 | good-looking changelogs but are often an order of |
|
55 | good-looking changelogs but are often an order of | |
56 | magnitude larger than the same ones generated by |
|
56 | magnitude larger than the same ones generated by | |
57 | --branchsort. |
|
57 | --branchsort. | |
58 |
|
58 | |||
59 | --sourcesort try to preserve source revisions order, only |
|
59 | --sourcesort try to preserve source revisions order, only | |
60 | supported by Mercurial sources. |
|
60 | supported by Mercurial sources. | |
61 |
|
61 | |||
62 |
If |
|
62 | If ``REVMAP`` isn't given, it will be put in a default location | |
63 |
(<dest>/.hg/shamap by default). The |
|
63 | (``<dest>/.hg/shamap`` by default). The ``REVMAP`` is a simple | |
64 |
that maps each source commit ID to the destination ID |
|
64 | text file that maps each source commit ID to the destination ID | |
65 | revision, like so:: |
|
65 | for that revision, like so:: | |
66 |
|
66 | |||
67 | <source ID> <destination ID> |
|
67 | <source ID> <destination ID> | |
68 |
|
68 | |||
69 | If the file doesn't exist, it's automatically created. It's |
|
69 | If the file doesn't exist, it's automatically created. It's | |
70 | updated on each commit copied, so :hg:`convert` can be interrupted |
|
70 | updated on each commit copied, so :hg:`convert` can be interrupted | |
71 | and can be run repeatedly to copy new commits. |
|
71 | and can be run repeatedly to copy new commits. | |
72 |
|
72 | |||
73 | The authormap is a simple text file that maps each source commit |
|
73 | The authormap is a simple text file that maps each source commit | |
74 | author to a destination commit author. It is handy for source SCMs |
|
74 | author to a destination commit author. It is handy for source SCMs | |
75 | that use unix logins to identify authors (eg: CVS). One line per |
|
75 | that use unix logins to identify authors (eg: CVS). One line per | |
76 | author mapping and the line format is:: |
|
76 | author mapping and the line format is:: | |
77 |
|
77 | |||
78 | source author = destination author |
|
78 | source author = destination author | |
79 |
|
79 | |||
80 | Empty lines and lines starting with a ``#`` are ignored. |
|
80 | Empty lines and lines starting with a ``#`` are ignored. | |
81 |
|
81 | |||
82 | The filemap is a file that allows filtering and remapping of files |
|
82 | The filemap is a file that allows filtering and remapping of files | |
83 | and directories. Each line can contain one of the following |
|
83 | and directories. Each line can contain one of the following | |
84 | directives:: |
|
84 | directives:: | |
85 |
|
85 | |||
86 | include path/to/file-or-dir |
|
86 | include path/to/file-or-dir | |
87 |
|
87 | |||
88 | exclude path/to/file-or-dir |
|
88 | exclude path/to/file-or-dir | |
89 |
|
89 | |||
90 | rename path/to/source path/to/destination |
|
90 | rename path/to/source path/to/destination | |
91 |
|
91 | |||
92 | Comment lines start with ``#``. A specified path matches if it |
|
92 | Comment lines start with ``#``. A specified path matches if it | |
93 | equals the full relative name of a file or one of its parent |
|
93 | equals the full relative name of a file or one of its parent | |
94 | directories. The ``include`` or ``exclude`` directive with the |
|
94 | directories. The ``include`` or ``exclude`` directive with the | |
95 | longest matching path applies, so line order does not matter. |
|
95 | longest matching path applies, so line order does not matter. | |
96 |
|
96 | |||
97 | The ``include`` directive causes a file, or all files under a |
|
97 | The ``include`` directive causes a file, or all files under a | |
98 | directory, to be included in the destination repository, and the |
|
98 | directory, to be included in the destination repository, and the | |
99 | exclusion of all other files and directories not explicitly |
|
99 | exclusion of all other files and directories not explicitly | |
100 | included. The ``exclude`` directive causes files or directories to |
|
100 | included. The ``exclude`` directive causes files or directories to | |
101 | be omitted. The ``rename`` directive renames a file or directory if |
|
101 | be omitted. The ``rename`` directive renames a file or directory if | |
102 | it is converted. To rename from a subdirectory into the root of |
|
102 | it is converted. To rename from a subdirectory into the root of | |
103 | the repository, use ``.`` as the path to rename to. |
|
103 | the repository, use ``.`` as the path to rename to. | |
104 |
|
104 | |||
105 | The splicemap is a file that allows insertion of synthetic |
|
105 | The splicemap is a file that allows insertion of synthetic | |
106 | history, letting you specify the parents of a revision. This is |
|
106 | history, letting you specify the parents of a revision. This is | |
107 | useful if you want to e.g. give a Subversion merge two parents, or |
|
107 | useful if you want to e.g. give a Subversion merge two parents, or | |
108 | graft two disconnected series of history together. Each entry |
|
108 | graft two disconnected series of history together. Each entry | |
109 | contains a key, followed by a space, followed by one or two |
|
109 | contains a key, followed by a space, followed by one or two | |
110 | comma-separated values:: |
|
110 | comma-separated values:: | |
111 |
|
111 | |||
112 | key parent1, parent2 |
|
112 | key parent1, parent2 | |
113 |
|
113 | |||
114 | The key is the revision ID in the source |
|
114 | The key is the revision ID in the source | |
115 | revision control system whose parents should be modified (same |
|
115 | revision control system whose parents should be modified (same | |
116 | format as a key in .hg/shamap). The values are the revision IDs |
|
116 | format as a key in .hg/shamap). The values are the revision IDs | |
117 | (in either the source or destination revision control system) that |
|
117 | (in either the source or destination revision control system) that | |
118 | should be used as the new parents for that node. For example, if |
|
118 | should be used as the new parents for that node. For example, if | |
119 | you have merged "release-1.0" into "trunk", then you should |
|
119 | you have merged "release-1.0" into "trunk", then you should | |
120 | specify the revision on "trunk" as the first parent and the one on |
|
120 | specify the revision on "trunk" as the first parent and the one on | |
121 | the "release-1.0" branch as the second. |
|
121 | the "release-1.0" branch as the second. | |
122 |
|
122 | |||
123 | The branchmap is a file that allows you to rename a branch when it is |
|
123 | The branchmap is a file that allows you to rename a branch when it is | |
124 | being brought in from whatever external repository. When used in |
|
124 | being brought in from whatever external repository. When used in | |
125 | conjunction with a splicemap, it allows for a powerful combination |
|
125 | conjunction with a splicemap, it allows for a powerful combination | |
126 | to help fix even the most badly mismanaged repositories and turn them |
|
126 | to help fix even the most badly mismanaged repositories and turn them | |
127 | into nicely structured Mercurial repositories. The branchmap contains |
|
127 | into nicely structured Mercurial repositories. The branchmap contains | |
128 | lines of the form:: |
|
128 | lines of the form:: | |
129 |
|
129 | |||
130 | original_branch_name new_branch_name |
|
130 | original_branch_name new_branch_name | |
131 |
|
131 | |||
132 | where "original_branch_name" is the name of the branch in the |
|
132 | where "original_branch_name" is the name of the branch in the | |
133 | source repository, and "new_branch_name" is the name of the branch |
|
133 | source repository, and "new_branch_name" is the name of the branch | |
134 | is the destination repository. No whitespace is allowed in the |
|
134 | is the destination repository. No whitespace is allowed in the | |
135 | branch names. This can be used to (for instance) move code in one |
|
135 | branch names. This can be used to (for instance) move code in one | |
136 | repository from "default" to a named branch. |
|
136 | repository from "default" to a named branch. | |
137 |
|
137 | |||
138 | Mercurial Source |
|
138 | Mercurial Source | |
139 | '''''''''''''''' |
|
139 | '''''''''''''''' | |
140 |
|
140 | |||
141 | The Mercurial source recognizes the following configuration |
|
141 | The Mercurial source recognizes the following configuration | |
142 | options, which you can set on the command line with ``--config``: |
|
142 | options, which you can set on the command line with ``--config``: | |
143 |
|
143 | |||
144 | :convert.hg.ignoreerrors: ignore integrity errors when reading. |
|
144 | :convert.hg.ignoreerrors: ignore integrity errors when reading. | |
145 | Use it to fix Mercurial repositories with missing revlogs, by |
|
145 | Use it to fix Mercurial repositories with missing revlogs, by | |
146 | converting from and to Mercurial. Default is False. |
|
146 | converting from and to Mercurial. Default is False. | |
147 |
|
147 | |||
148 | :convert.hg.saverev: store original. revision ID in changeset |
|
148 | :convert.hg.saverev: store original. revision ID in changeset | |
149 | (forces target IDs to change). It takes and boolean argument |
|
149 | (forces target IDs to change). It takes and boolean argument | |
150 | and defaults to False. |
|
150 | and defaults to False. | |
151 |
|
151 | |||
152 | :convert.hg.startrev: convert start revision and its descendants. |
|
152 | :convert.hg.startrev: convert start revision and its descendants. | |
153 | It takes a hg revision identifier and defaults to 0. |
|
153 | It takes a hg revision identifier and defaults to 0. | |
154 |
|
154 | |||
155 | CVS Source |
|
155 | CVS Source | |
156 | '''''''''' |
|
156 | '''''''''' | |
157 |
|
157 | |||
158 | CVS source will use a sandbox (i.e. a checked-out copy) from CVS |
|
158 | CVS source will use a sandbox (i.e. a checked-out copy) from CVS | |
159 | to indicate the starting point of what will be converted. Direct |
|
159 | to indicate the starting point of what will be converted. Direct | |
160 | access to the repository files is not needed, unless of course the |
|
160 | access to the repository files is not needed, unless of course the | |
161 |
repository is :local:. The conversion uses the top level |
|
161 | repository is ``:local:``. The conversion uses the top level | |
162 |
in the sandbox to find the CVS repository, and then uses |
|
162 | directory in the sandbox to find the CVS repository, and then uses | |
163 |
commands to find files to convert. This means that unless |
|
163 | CVS rlog commands to find files to convert. This means that unless | |
164 | filemap is given, all files under the starting directory will be |
|
164 | a filemap is given, all files under the starting directory will be | |
165 | converted, and that any directory reorganization in the CVS |
|
165 | converted, and that any directory reorganization in the CVS | |
166 | sandbox is ignored. |
|
166 | sandbox is ignored. | |
167 |
|
167 | |||
168 | The following options can be used with ``--config``: |
|
168 | The following options can be used with ``--config``: | |
169 |
|
169 | |||
170 | :convert.cvsps.cache: Set to False to disable remote log caching, |
|
170 | :convert.cvsps.cache: Set to False to disable remote log caching, | |
171 | for testing and debugging purposes. Default is True. |
|
171 | for testing and debugging purposes. Default is True. | |
172 |
|
172 | |||
173 | :convert.cvsps.fuzz: Specify the maximum time (in seconds) that is |
|
173 | :convert.cvsps.fuzz: Specify the maximum time (in seconds) that is | |
174 | allowed between commits with identical user and log message in |
|
174 | allowed between commits with identical user and log message in | |
175 | a single changeset. When very large files were checked in as |
|
175 | a single changeset. When very large files were checked in as | |
176 | part of a changeset then the default may not be long enough. |
|
176 | part of a changeset then the default may not be long enough. | |
177 | The default is 60. |
|
177 | The default is 60. | |
178 |
|
178 | |||
179 | :convert.cvsps.mergeto: Specify a regular expression to which |
|
179 | :convert.cvsps.mergeto: Specify a regular expression to which | |
180 | commit log messages are matched. If a match occurs, then the |
|
180 | commit log messages are matched. If a match occurs, then the | |
181 | conversion process will insert a dummy revision merging the |
|
181 | conversion process will insert a dummy revision merging the | |
182 | branch on which this log message occurs to the branch |
|
182 | branch on which this log message occurs to the branch | |
183 | indicated in the regex. Default is ``{{mergetobranch |
|
183 | indicated in the regex. Default is ``{{mergetobranch | |
184 | ([-\\w]+)}}`` |
|
184 | ([-\\w]+)}}`` | |
185 |
|
185 | |||
186 | :convert.cvsps.mergefrom: Specify a regular expression to which |
|
186 | :convert.cvsps.mergefrom: Specify a regular expression to which | |
187 | commit log messages are matched. If a match occurs, then the |
|
187 | commit log messages are matched. If a match occurs, then the | |
188 | conversion process will add the most recent revision on the |
|
188 | conversion process will add the most recent revision on the | |
189 | branch indicated in the regex as the second parent of the |
|
189 | branch indicated in the regex as the second parent of the | |
190 | changeset. Default is ``{{mergefrombranch ([-\\w]+)}}`` |
|
190 | changeset. Default is ``{{mergefrombranch ([-\\w]+)}}`` | |
191 |
|
191 | |||
192 | :hook.cvslog: Specify a Python function to be called at the end of |
|
192 | :hook.cvslog: Specify a Python function to be called at the end of | |
193 | gathering the CVS log. The function is passed a list with the |
|
193 | gathering the CVS log. The function is passed a list with the | |
194 | log entries, and can modify the entries in-place, or add or |
|
194 | log entries, and can modify the entries in-place, or add or | |
195 | delete them. |
|
195 | delete them. | |
196 |
|
196 | |||
197 | :hook.cvschangesets: Specify a Python function to be called after |
|
197 | :hook.cvschangesets: Specify a Python function to be called after | |
198 | the changesets are calculated from the the CVS log. The |
|
198 | the changesets are calculated from the the CVS log. The | |
199 | function is passed a list with the changeset entries, and can |
|
199 | function is passed a list with the changeset entries, and can | |
200 | modify the changesets in-place, or add or delete them. |
|
200 | modify the changesets in-place, or add or delete them. | |
201 |
|
201 | |||
202 | An additional "debugcvsps" Mercurial command allows the builtin |
|
202 | An additional "debugcvsps" Mercurial command allows the builtin | |
203 | changeset merging code to be run without doing a conversion. Its |
|
203 | changeset merging code to be run without doing a conversion. Its | |
204 | parameters and output are similar to that of cvsps 2.1. Please see |
|
204 | parameters and output are similar to that of cvsps 2.1. Please see | |
205 | the command help for more details. |
|
205 | the command help for more details. | |
206 |
|
206 | |||
207 | Subversion Source |
|
207 | Subversion Source | |
208 | ''''''''''''''''' |
|
208 | ''''''''''''''''' | |
209 |
|
209 | |||
210 | Subversion source detects classical trunk/branches/tags layouts. |
|
210 | Subversion source detects classical trunk/branches/tags layouts. | |
211 |
By default, the supplied |
|
211 | By default, the supplied ``svn://repo/path/`` source URL is | |
212 |
converted as a single branch. If |
|
212 | converted as a single branch. If ``svn://repo/path/trunk`` exists | |
213 |
replaces the default branch. If |
|
213 | it replaces the default branch. If ``svn://repo/path/branches`` | |
214 | its subdirectories are listed as possible branches. If |
|
214 | exists, its subdirectories are listed as possible branches. If | |
215 |
|
|
215 | ``svn://repo/path/tags`` exists, it is looked for tags referencing | |
216 |
converted branches. Default |
|
216 | converted branches. Default ``trunk``, ``branches`` and ``tags`` | |
217 | can be overridden with following options. Set them to paths |
|
217 | values can be overridden with following options. Set them to paths | |
218 | relative to the source URL, or leave them blank to disable auto |
|
218 | relative to the source URL, or leave them blank to disable auto | |
219 | detection. |
|
219 | detection. | |
220 |
|
220 | |||
221 | The following options can be set with ``--config``: |
|
221 | The following options can be set with ``--config``: | |
222 |
|
222 | |||
223 | :convert.svn.branches: specify the directory containing branches. |
|
223 | :convert.svn.branches: specify the directory containing branches. | |
224 | The defaults is branches. |
|
224 | The defaults is ``branches``. | |
225 |
|
225 | |||
226 | :convert.svn.tags: specify the directory containing tags. The |
|
226 | :convert.svn.tags: specify the directory containing tags. The | |
227 | default is tags. |
|
227 | default is ``tags``. | |
228 |
|
228 | |||
229 | :convert.svn.trunk: specify the name of the trunk branch The |
|
229 | :convert.svn.trunk: specify the name of the trunk branch The | |
230 | defauls is trunk. |
|
230 | defauls is ``trunk``. | |
231 |
|
231 | |||
232 | Source history can be retrieved starting at a specific revision, |
|
232 | Source history can be retrieved starting at a specific revision, | |
233 | instead of being integrally converted. Only single branch |
|
233 | instead of being integrally converted. Only single branch | |
234 | conversions are supported. |
|
234 | conversions are supported. | |
235 |
|
235 | |||
236 | :convert.svn.startrev: specify start Subversion revision number. |
|
236 | :convert.svn.startrev: specify start Subversion revision number. | |
237 | The default is 0. |
|
237 | The default is 0. | |
238 |
|
238 | |||
239 | Perforce Source |
|
239 | Perforce Source | |
240 | ''''''''''''''' |
|
240 | ''''''''''''''' | |
241 |
|
241 | |||
242 | The Perforce (P4) importer can be given a p4 depot path or a |
|
242 | The Perforce (P4) importer can be given a p4 depot path or a | |
243 | client specification as source. It will convert all files in the |
|
243 | client specification as source. It will convert all files in the | |
244 | source to a flat Mercurial repository, ignoring labels, branches |
|
244 | source to a flat Mercurial repository, ignoring labels, branches | |
245 | and integrations. Note that when a depot path is given you then |
|
245 | and integrations. Note that when a depot path is given you then | |
246 | usually should specify a target directory, because otherwise the |
|
246 | usually should specify a target directory, because otherwise the | |
247 | target may be named ...-hg. |
|
247 | target may be named ``...-hg``. | |
248 |
|
248 | |||
249 | It is possible to limit the amount of source history to be |
|
249 | It is possible to limit the amount of source history to be | |
250 | converted by specifying an initial Perforce revision: |
|
250 | converted by specifying an initial Perforce revision: | |
251 |
|
251 | |||
252 | :convert.p4.startrev: specify initial Perforce revision, a |
|
252 | :convert.p4.startrev: specify initial Perforce revision, a | |
253 | Perforce changelist number). |
|
253 | Perforce changelist number). | |
254 |
|
254 | |||
255 | Mercurial Destination |
|
255 | Mercurial Destination | |
256 | ''''''''''''''''''''' |
|
256 | ''''''''''''''''''''' | |
257 |
|
257 | |||
258 | The following options are supported: |
|
258 | The following options are supported: | |
259 |
|
259 | |||
260 | :convert.hg.clonebranches: dispatch source branches in separate |
|
260 | :convert.hg.clonebranches: dispatch source branches in separate | |
261 | clones. The default is False. |
|
261 | clones. The default is False. | |
262 |
|
262 | |||
263 | :convert.hg.tagsbranch: branch name for tag revisions, defaults to |
|
263 | :convert.hg.tagsbranch: branch name for tag revisions, defaults to | |
264 | ``default``. |
|
264 | ``default``. | |
265 |
|
265 | |||
266 | :convert.hg.usebranchnames: preserve branch names. The default is |
|
266 | :convert.hg.usebranchnames: preserve branch names. The default is | |
267 | True |
|
267 | True | |
268 | """ |
|
268 | """ | |
269 | return convcmd.convert(ui, src, dest, revmapfile, **opts) |
|
269 | return convcmd.convert(ui, src, dest, revmapfile, **opts) | |
270 |
|
270 | |||
271 | def debugsvnlog(ui, **opts): |
|
271 | def debugsvnlog(ui, **opts): | |
272 | return subversion.debugsvnlog(ui, **opts) |
|
272 | return subversion.debugsvnlog(ui, **opts) | |
273 |
|
273 | |||
274 | def debugcvsps(ui, *args, **opts): |
|
274 | def debugcvsps(ui, *args, **opts): | |
275 | '''create changeset information from CVS |
|
275 | '''create changeset information from CVS | |
276 |
|
276 | |||
277 | This command is intended as a debugging tool for the CVS to |
|
277 | This command is intended as a debugging tool for the CVS to | |
278 | Mercurial converter, and can be used as a direct replacement for |
|
278 | Mercurial converter, and can be used as a direct replacement for | |
279 | cvsps. |
|
279 | cvsps. | |
280 |
|
280 | |||
281 | Hg debugcvsps reads the CVS rlog for current directory (or any |
|
281 | Hg debugcvsps reads the CVS rlog for current directory (or any | |
282 | named directory) in the CVS repository, and converts the log to a |
|
282 | named directory) in the CVS repository, and converts the log to a | |
283 | series of changesets based on matching commit log entries and |
|
283 | series of changesets based on matching commit log entries and | |
284 | dates.''' |
|
284 | dates.''' | |
285 | return cvsps.debugcvsps(ui, *args, **opts) |
|
285 | return cvsps.debugcvsps(ui, *args, **opts) | |
286 |
|
286 | |||
287 | commands.norepo += " convert debugsvnlog debugcvsps" |
|
287 | commands.norepo += " convert debugsvnlog debugcvsps" | |
288 |
|
288 | |||
289 | cmdtable = { |
|
289 | cmdtable = { | |
290 | "convert": |
|
290 | "convert": | |
291 | (convert, |
|
291 | (convert, | |
292 | [('', 'authors', '', |
|
292 | [('', 'authors', '', | |
293 | _('username mapping filename (DEPRECATED, use --authormap instead)'), |
|
293 | _('username mapping filename (DEPRECATED, use --authormap instead)'), | |
294 | _('FILE')), |
|
294 | _('FILE')), | |
295 | ('s', 'source-type', '', |
|
295 | ('s', 'source-type', '', | |
296 | _('source repository type'), _('TYPE')), |
|
296 | _('source repository type'), _('TYPE')), | |
297 | ('d', 'dest-type', '', |
|
297 | ('d', 'dest-type', '', | |
298 | _('destination repository type'), _('TYPE')), |
|
298 | _('destination repository type'), _('TYPE')), | |
299 | ('r', 'rev', '', |
|
299 | ('r', 'rev', '', | |
300 | _('import up to target revision REV'), _('REV')), |
|
300 | _('import up to target revision REV'), _('REV')), | |
301 | ('A', 'authormap', '', |
|
301 | ('A', 'authormap', '', | |
302 | _('remap usernames using this file'), _('FILE')), |
|
302 | _('remap usernames using this file'), _('FILE')), | |
303 | ('', 'filemap', '', |
|
303 | ('', 'filemap', '', | |
304 | _('remap file names using contents of file'), _('FILE')), |
|
304 | _('remap file names using contents of file'), _('FILE')), | |
305 | ('', 'splicemap', '', |
|
305 | ('', 'splicemap', '', | |
306 | _('splice synthesized history into place'), _('FILE')), |
|
306 | _('splice synthesized history into place'), _('FILE')), | |
307 | ('', 'branchmap', '', |
|
307 | ('', 'branchmap', '', | |
308 | _('change branch names while converting'), _('FILE')), |
|
308 | _('change branch names while converting'), _('FILE')), | |
309 | ('', 'branchsort', None, _('try to sort changesets by branches')), |
|
309 | ('', 'branchsort', None, _('try to sort changesets by branches')), | |
310 | ('', 'datesort', None, _('try to sort changesets by date')), |
|
310 | ('', 'datesort', None, _('try to sort changesets by date')), | |
311 | ('', 'sourcesort', None, _('preserve source changesets order'))], |
|
311 | ('', 'sourcesort', None, _('preserve source changesets order'))], | |
312 | _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]')), |
|
312 | _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]')), | |
313 | "debugsvnlog": |
|
313 | "debugsvnlog": | |
314 | (debugsvnlog, |
|
314 | (debugsvnlog, | |
315 | [], |
|
315 | [], | |
316 | 'hg debugsvnlog'), |
|
316 | 'hg debugsvnlog'), | |
317 | "debugcvsps": |
|
317 | "debugcvsps": | |
318 | (debugcvsps, |
|
318 | (debugcvsps, | |
319 | [ |
|
319 | [ | |
320 | # Main options shared with cvsps-2.1 |
|
320 | # Main options shared with cvsps-2.1 | |
321 | ('b', 'branches', [], _('only return changes on specified branches')), |
|
321 | ('b', 'branches', [], _('only return changes on specified branches')), | |
322 | ('p', 'prefix', '', _('prefix to remove from file names')), |
|
322 | ('p', 'prefix', '', _('prefix to remove from file names')), | |
323 | ('r', 'revisions', [], |
|
323 | ('r', 'revisions', [], | |
324 | _('only return changes after or between specified tags')), |
|
324 | _('only return changes after or between specified tags')), | |
325 | ('u', 'update-cache', None, _("update cvs log cache")), |
|
325 | ('u', 'update-cache', None, _("update cvs log cache")), | |
326 | ('x', 'new-cache', None, _("create new cvs log cache")), |
|
326 | ('x', 'new-cache', None, _("create new cvs log cache")), | |
327 | ('z', 'fuzz', 60, _('set commit time fuzz in seconds')), |
|
327 | ('z', 'fuzz', 60, _('set commit time fuzz in seconds')), | |
328 | ('', 'root', '', _('specify cvsroot')), |
|
328 | ('', 'root', '', _('specify cvsroot')), | |
329 | # Options specific to builtin cvsps |
|
329 | # Options specific to builtin cvsps | |
330 | ('', 'parents', '', _('show parent changesets')), |
|
330 | ('', 'parents', '', _('show parent changesets')), | |
331 | ('', 'ancestors', '', _('show current changeset in ancestor branches')), |
|
331 | ('', 'ancestors', '', _('show current changeset in ancestor branches')), | |
332 | # Options that are ignored for compatibility with cvsps-2.1 |
|
332 | # Options that are ignored for compatibility with cvsps-2.1 | |
333 | ('A', 'cvs-direct', None, _('ignored for compatibility')), |
|
333 | ('A', 'cvs-direct', None, _('ignored for compatibility')), | |
334 | ], |
|
334 | ], | |
335 | _('hg debugcvsps [OPTION]... [PATH]...')), |
|
335 | _('hg debugcvsps [OPTION]... [PATH]...')), | |
336 | } |
|
336 | } |
@@ -1,392 +1,392 | |||||
1 |
|
1 | |||
2 | $ cat >> $HGRCPATH <<EOF |
|
2 | $ cat >> $HGRCPATH <<EOF | |
3 | > [extensions] |
|
3 | > [extensions] | |
4 | > convert= |
|
4 | > convert= | |
5 | > [convert] |
|
5 | > [convert] | |
6 | > hg.saverev=False |
|
6 | > hg.saverev=False | |
7 | > EOF |
|
7 | > EOF | |
8 | $ hg help convert |
|
8 | $ hg help convert | |
9 | hg convert [OPTION]... SOURCE [DEST [REVMAP]] |
|
9 | hg convert [OPTION]... SOURCE [DEST [REVMAP]] | |
10 |
|
10 | |||
11 | convert a foreign SCM repository to a Mercurial one. |
|
11 | convert a foreign SCM repository to a Mercurial one. | |
12 |
|
12 | |||
13 | Accepted source formats [identifiers]: |
|
13 | Accepted source formats [identifiers]: | |
14 |
|
14 | |||
15 | - Mercurial [hg] |
|
15 | - Mercurial [hg] | |
16 | - CVS [cvs] |
|
16 | - CVS [cvs] | |
17 | - Darcs [darcs] |
|
17 | - Darcs [darcs] | |
18 | - git [git] |
|
18 | - git [git] | |
19 | - Subversion [svn] |
|
19 | - Subversion [svn] | |
20 | - Monotone [mtn] |
|
20 | - Monotone [mtn] | |
21 | - GNU Arch [gnuarch] |
|
21 | - GNU Arch [gnuarch] | |
22 | - Bazaar [bzr] |
|
22 | - Bazaar [bzr] | |
23 | - Perforce [p4] |
|
23 | - Perforce [p4] | |
24 |
|
24 | |||
25 | Accepted destination formats [identifiers]: |
|
25 | Accepted destination formats [identifiers]: | |
26 |
|
26 | |||
27 | - Mercurial [hg] |
|
27 | - Mercurial [hg] | |
28 | - Subversion [svn] (history on branches is not preserved) |
|
28 | - Subversion [svn] (history on branches is not preserved) | |
29 |
|
29 | |||
30 | If no revision is given, all revisions will be converted. Otherwise, |
|
30 | If no revision is given, all revisions will be converted. Otherwise, | |
31 | convert will only import up to the named revision (given in a format |
|
31 | convert will only import up to the named revision (given in a format | |
32 | understood by the source). |
|
32 | understood by the source). | |
33 |
|
33 | |||
34 | If no destination directory name is specified, it defaults to the basename |
|
34 | If no destination directory name is specified, it defaults to the basename | |
35 | of the source with "-hg" appended. If the destination repository doesn't |
|
35 | of the source with "-hg" appended. If the destination repository doesn't | |
36 | exist, it will be created. |
|
36 | exist, it will be created. | |
37 |
|
37 | |||
38 | By default, all sources except Mercurial will use --branchsort. Mercurial |
|
38 | By default, all sources except Mercurial will use --branchsort. Mercurial | |
39 | uses --sourcesort to preserve original revision numbers order. Sort modes |
|
39 | uses --sourcesort to preserve original revision numbers order. Sort modes | |
40 | have the following effects: |
|
40 | have the following effects: | |
41 |
|
41 | |||
42 | --branchsort convert from parent to child revision when possible, which |
|
42 | --branchsort convert from parent to child revision when possible, which | |
43 | means branches are usually converted one after the other. It |
|
43 | means branches are usually converted one after the other. It | |
44 | generates more compact repositories. |
|
44 | generates more compact repositories. | |
45 | --datesort sort revisions by date. Converted repositories have good- |
|
45 | --datesort sort revisions by date. Converted repositories have good- | |
46 | looking changelogs but are often an order of magnitude |
|
46 | looking changelogs but are often an order of magnitude | |
47 | larger than the same ones generated by --branchsort. |
|
47 | larger than the same ones generated by --branchsort. | |
48 | --sourcesort try to preserve source revisions order, only supported by |
|
48 | --sourcesort try to preserve source revisions order, only supported by | |
49 | Mercurial sources. |
|
49 | Mercurial sources. | |
50 |
|
50 | |||
51 |
If |
|
51 | If "REVMAP" isn't given, it will be put in a default location | |
52 |
(<dest>/.hg/shamap by default). The |
|
52 | ("<dest>/.hg/shamap" by default). The "REVMAP" is a simple text file that | |
53 | maps each source commit ID to the destination ID for that revision, like |
|
53 | maps each source commit ID to the destination ID for that revision, like | |
54 | so: |
|
54 | so: | |
55 |
|
55 | |||
56 | <source ID> <destination ID> |
|
56 | <source ID> <destination ID> | |
57 |
|
57 | |||
58 | If the file doesn't exist, it's automatically created. It's updated on |
|
58 | If the file doesn't exist, it's automatically created. It's updated on | |
59 | each commit copied, so "hg convert" can be interrupted and can be run |
|
59 | each commit copied, so "hg convert" can be interrupted and can be run | |
60 | repeatedly to copy new commits. |
|
60 | repeatedly to copy new commits. | |
61 |
|
61 | |||
62 | The authormap is a simple text file that maps each source commit author to |
|
62 | The authormap is a simple text file that maps each source commit author to | |
63 | a destination commit author. It is handy for source SCMs that use unix |
|
63 | a destination commit author. It is handy for source SCMs that use unix | |
64 | logins to identify authors (eg: CVS). One line per author mapping and the |
|
64 | logins to identify authors (eg: CVS). One line per author mapping and the | |
65 | line format is: |
|
65 | line format is: | |
66 |
|
66 | |||
67 | source author = destination author |
|
67 | source author = destination author | |
68 |
|
68 | |||
69 | Empty lines and lines starting with a "#" are ignored. |
|
69 | Empty lines and lines starting with a "#" are ignored. | |
70 |
|
70 | |||
71 | The filemap is a file that allows filtering and remapping of files and |
|
71 | The filemap is a file that allows filtering and remapping of files and | |
72 | directories. Each line can contain one of the following directives: |
|
72 | directories. Each line can contain one of the following directives: | |
73 |
|
73 | |||
74 | include path/to/file-or-dir |
|
74 | include path/to/file-or-dir | |
75 |
|
75 | |||
76 | exclude path/to/file-or-dir |
|
76 | exclude path/to/file-or-dir | |
77 |
|
77 | |||
78 | rename path/to/source path/to/destination |
|
78 | rename path/to/source path/to/destination | |
79 |
|
79 | |||
80 | Comment lines start with "#". A specified path matches if it equals the |
|
80 | Comment lines start with "#". A specified path matches if it equals the | |
81 | full relative name of a file or one of its parent directories. The |
|
81 | full relative name of a file or one of its parent directories. The | |
82 | "include" or "exclude" directive with the longest matching path applies, |
|
82 | "include" or "exclude" directive with the longest matching path applies, | |
83 | so line order does not matter. |
|
83 | so line order does not matter. | |
84 |
|
84 | |||
85 | The "include" directive causes a file, or all files under a directory, to |
|
85 | The "include" directive causes a file, or all files under a directory, to | |
86 | be included in the destination repository, and the exclusion of all other |
|
86 | be included in the destination repository, and the exclusion of all other | |
87 | files and directories not explicitly included. The "exclude" directive |
|
87 | files and directories not explicitly included. The "exclude" directive | |
88 | causes files or directories to be omitted. The "rename" directive renames |
|
88 | causes files or directories to be omitted. The "rename" directive renames | |
89 | a file or directory if it is converted. To rename from a subdirectory into |
|
89 | a file or directory if it is converted. To rename from a subdirectory into | |
90 | the root of the repository, use "." as the path to rename to. |
|
90 | the root of the repository, use "." as the path to rename to. | |
91 |
|
91 | |||
92 | The splicemap is a file that allows insertion of synthetic history, |
|
92 | The splicemap is a file that allows insertion of synthetic history, | |
93 | letting you specify the parents of a revision. This is useful if you want |
|
93 | letting you specify the parents of a revision. This is useful if you want | |
94 | to e.g. give a Subversion merge two parents, or graft two disconnected |
|
94 | to e.g. give a Subversion merge two parents, or graft two disconnected | |
95 | series of history together. Each entry contains a key, followed by a |
|
95 | series of history together. Each entry contains a key, followed by a | |
96 | space, followed by one or two comma-separated values: |
|
96 | space, followed by one or two comma-separated values: | |
97 |
|
97 | |||
98 | key parent1, parent2 |
|
98 | key parent1, parent2 | |
99 |
|
99 | |||
100 | The key is the revision ID in the source revision control system whose |
|
100 | The key is the revision ID in the source revision control system whose | |
101 | parents should be modified (same format as a key in .hg/shamap). The |
|
101 | parents should be modified (same format as a key in .hg/shamap). The | |
102 | values are the revision IDs (in either the source or destination revision |
|
102 | values are the revision IDs (in either the source or destination revision | |
103 | control system) that should be used as the new parents for that node. For |
|
103 | control system) that should be used as the new parents for that node. For | |
104 | example, if you have merged "release-1.0" into "trunk", then you should |
|
104 | example, if you have merged "release-1.0" into "trunk", then you should | |
105 | specify the revision on "trunk" as the first parent and the one on the |
|
105 | specify the revision on "trunk" as the first parent and the one on the | |
106 | "release-1.0" branch as the second. |
|
106 | "release-1.0" branch as the second. | |
107 |
|
107 | |||
108 | The branchmap is a file that allows you to rename a branch when it is |
|
108 | The branchmap is a file that allows you to rename a branch when it is | |
109 | being brought in from whatever external repository. When used in |
|
109 | being brought in from whatever external repository. When used in | |
110 | conjunction with a splicemap, it allows for a powerful combination to help |
|
110 | conjunction with a splicemap, it allows for a powerful combination to help | |
111 | fix even the most badly mismanaged repositories and turn them into nicely |
|
111 | fix even the most badly mismanaged repositories and turn them into nicely | |
112 | structured Mercurial repositories. The branchmap contains lines of the |
|
112 | structured Mercurial repositories. The branchmap contains lines of the | |
113 | form: |
|
113 | form: | |
114 |
|
114 | |||
115 | original_branch_name new_branch_name |
|
115 | original_branch_name new_branch_name | |
116 |
|
116 | |||
117 | where "original_branch_name" is the name of the branch in the source |
|
117 | where "original_branch_name" is the name of the branch in the source | |
118 | repository, and "new_branch_name" is the name of the branch is the |
|
118 | repository, and "new_branch_name" is the name of the branch is the | |
119 | destination repository. No whitespace is allowed in the branch names. This |
|
119 | destination repository. No whitespace is allowed in the branch names. This | |
120 | can be used to (for instance) move code in one repository from "default" |
|
120 | can be used to (for instance) move code in one repository from "default" | |
121 | to a named branch. |
|
121 | to a named branch. | |
122 |
|
122 | |||
123 | Mercurial Source |
|
123 | Mercurial Source | |
124 | '''''''''''''''' |
|
124 | '''''''''''''''' | |
125 |
|
125 | |||
126 | The Mercurial source recognizes the following configuration options, which |
|
126 | The Mercurial source recognizes the following configuration options, which | |
127 | you can set on the command line with "--config": |
|
127 | you can set on the command line with "--config": | |
128 |
|
128 | |||
129 | convert.hg.ignoreerrors |
|
129 | convert.hg.ignoreerrors | |
130 | ignore integrity errors when reading. Use it to fix Mercurial |
|
130 | ignore integrity errors when reading. Use it to fix Mercurial | |
131 | repositories with missing revlogs, by converting from and to |
|
131 | repositories with missing revlogs, by converting from and to | |
132 | Mercurial. Default is False. |
|
132 | Mercurial. Default is False. | |
133 | convert.hg.saverev |
|
133 | convert.hg.saverev | |
134 | store original. revision ID in changeset (forces target IDs to |
|
134 | store original. revision ID in changeset (forces target IDs to | |
135 | change). It takes and boolean argument and defaults to False. |
|
135 | change). It takes and boolean argument and defaults to False. | |
136 | convert.hg.startrev |
|
136 | convert.hg.startrev | |
137 | convert start revision and its descendants. It takes a hg |
|
137 | convert start revision and its descendants. It takes a hg | |
138 | revision identifier and defaults to 0. |
|
138 | revision identifier and defaults to 0. | |
139 |
|
139 | |||
140 | CVS Source |
|
140 | CVS Source | |
141 | '''''''''' |
|
141 | '''''''''' | |
142 |
|
142 | |||
143 | CVS source will use a sandbox (i.e. a checked-out copy) from CVS to |
|
143 | CVS source will use a sandbox (i.e. a checked-out copy) from CVS to | |
144 | indicate the starting point of what will be converted. Direct access to |
|
144 | indicate the starting point of what will be converted. Direct access to | |
145 | the repository files is not needed, unless of course the repository is |
|
145 | the repository files is not needed, unless of course the repository is | |
146 | :local:. The conversion uses the top level directory in the sandbox to |
|
146 | ":local:". The conversion uses the top level directory in the sandbox to | |
147 | find the CVS repository, and then uses CVS rlog commands to find files to |
|
147 | find the CVS repository, and then uses CVS rlog commands to find files to | |
148 | convert. This means that unless a filemap is given, all files under the |
|
148 | convert. This means that unless a filemap is given, all files under the | |
149 | starting directory will be converted, and that any directory |
|
149 | starting directory will be converted, and that any directory | |
150 | reorganization in the CVS sandbox is ignored. |
|
150 | reorganization in the CVS sandbox is ignored. | |
151 |
|
151 | |||
152 | The following options can be used with "--config": |
|
152 | The following options can be used with "--config": | |
153 |
|
153 | |||
154 | convert.cvsps.cache |
|
154 | convert.cvsps.cache | |
155 | Set to False to disable remote log caching, for testing and |
|
155 | Set to False to disable remote log caching, for testing and | |
156 | debugging purposes. Default is True. |
|
156 | debugging purposes. Default is True. | |
157 | convert.cvsps.fuzz |
|
157 | convert.cvsps.fuzz | |
158 | Specify the maximum time (in seconds) that is allowed between |
|
158 | Specify the maximum time (in seconds) that is allowed between | |
159 | commits with identical user and log message in a single |
|
159 | commits with identical user and log message in a single | |
160 | changeset. When very large files were checked in as part of a |
|
160 | changeset. When very large files were checked in as part of a | |
161 | changeset then the default may not be long enough. The default |
|
161 | changeset then the default may not be long enough. The default | |
162 | is 60. |
|
162 | is 60. | |
163 | convert.cvsps.mergeto |
|
163 | convert.cvsps.mergeto | |
164 | Specify a regular expression to which commit log messages are |
|
164 | Specify a regular expression to which commit log messages are | |
165 | matched. If a match occurs, then the conversion process will |
|
165 | matched. If a match occurs, then the conversion process will | |
166 | insert a dummy revision merging the branch on which this log |
|
166 | insert a dummy revision merging the branch on which this log | |
167 | message occurs to the branch indicated in the regex. Default |
|
167 | message occurs to the branch indicated in the regex. Default | |
168 | is "{{mergetobranch ([-\w]+)}}" |
|
168 | is "{{mergetobranch ([-\w]+)}}" | |
169 | convert.cvsps.mergefrom |
|
169 | convert.cvsps.mergefrom | |
170 | Specify a regular expression to which commit log messages are |
|
170 | Specify a regular expression to which commit log messages are | |
171 | matched. If a match occurs, then the conversion process will |
|
171 | matched. If a match occurs, then the conversion process will | |
172 | add the most recent revision on the branch indicated in the |
|
172 | add the most recent revision on the branch indicated in the | |
173 | regex as the second parent of the changeset. Default is |
|
173 | regex as the second parent of the changeset. Default is | |
174 | "{{mergefrombranch ([-\w]+)}}" |
|
174 | "{{mergefrombranch ([-\w]+)}}" | |
175 | hook.cvslog |
|
175 | hook.cvslog | |
176 | Specify a Python function to be called at the end of gathering |
|
176 | Specify a Python function to be called at the end of gathering | |
177 | the CVS log. The function is passed a list with the log |
|
177 | the CVS log. The function is passed a list with the log | |
178 | entries, and can modify the entries in-place, or add or delete |
|
178 | entries, and can modify the entries in-place, or add or delete | |
179 | them. |
|
179 | them. | |
180 | hook.cvschangesets |
|
180 | hook.cvschangesets | |
181 | Specify a Python function to be called after the changesets |
|
181 | Specify a Python function to be called after the changesets | |
182 | are calculated from the the CVS log. The function is passed a |
|
182 | are calculated from the the CVS log. The function is passed a | |
183 | list with the changeset entries, and can modify the changesets |
|
183 | list with the changeset entries, and can modify the changesets | |
184 | in-place, or add or delete them. |
|
184 | in-place, or add or delete them. | |
185 |
|
185 | |||
186 | An additional "debugcvsps" Mercurial command allows the builtin changeset |
|
186 | An additional "debugcvsps" Mercurial command allows the builtin changeset | |
187 | merging code to be run without doing a conversion. Its parameters and |
|
187 | merging code to be run without doing a conversion. Its parameters and | |
188 | output are similar to that of cvsps 2.1. Please see the command help for |
|
188 | output are similar to that of cvsps 2.1. Please see the command help for | |
189 | more details. |
|
189 | more details. | |
190 |
|
190 | |||
191 | Subversion Source |
|
191 | Subversion Source | |
192 | ''''''''''''''''' |
|
192 | ''''''''''''''''' | |
193 |
|
193 | |||
194 | Subversion source detects classical trunk/branches/tags layouts. By |
|
194 | Subversion source detects classical trunk/branches/tags layouts. By | |
195 | default, the supplied "svn://repo/path/" source URL is converted as a |
|
195 | default, the supplied "svn://repo/path/" source URL is converted as a | |
196 | single branch. If "svn://repo/path/trunk" exists it replaces the default |
|
196 | single branch. If "svn://repo/path/trunk" exists it replaces the default | |
197 | branch. If "svn://repo/path/branches" exists, its subdirectories are |
|
197 | branch. If "svn://repo/path/branches" exists, its subdirectories are | |
198 | listed as possible branches. If "svn://repo/path/tags" exists, it is |
|
198 | listed as possible branches. If "svn://repo/path/tags" exists, it is | |
199 | looked for tags referencing converted branches. Default "trunk", |
|
199 | looked for tags referencing converted branches. Default "trunk", | |
200 | "branches" and "tags" values can be overridden with following options. Set |
|
200 | "branches" and "tags" values can be overridden with following options. Set | |
201 | them to paths relative to the source URL, or leave them blank to disable |
|
201 | them to paths relative to the source URL, or leave them blank to disable | |
202 | auto detection. |
|
202 | auto detection. | |
203 |
|
203 | |||
204 | The following options can be set with "--config": |
|
204 | The following options can be set with "--config": | |
205 |
|
205 | |||
206 | convert.svn.branches |
|
206 | convert.svn.branches | |
207 | specify the directory containing branches. The defaults is |
|
207 | specify the directory containing branches. The defaults is | |
208 | branches. |
|
208 | "branches". | |
209 | convert.svn.tags |
|
209 | convert.svn.tags | |
210 | specify the directory containing tags. The default is tags. |
|
210 | specify the directory containing tags. The default is "tags". | |
211 | convert.svn.trunk |
|
211 | convert.svn.trunk | |
212 | specify the name of the trunk branch The defauls is trunk. |
|
212 | specify the name of the trunk branch The defauls is "trunk". | |
213 |
|
213 | |||
214 | Source history can be retrieved starting at a specific revision, instead |
|
214 | Source history can be retrieved starting at a specific revision, instead | |
215 | of being integrally converted. Only single branch conversions are |
|
215 | of being integrally converted. Only single branch conversions are | |
216 | supported. |
|
216 | supported. | |
217 |
|
217 | |||
218 | convert.svn.startrev |
|
218 | convert.svn.startrev | |
219 | specify start Subversion revision number. The default is 0. |
|
219 | specify start Subversion revision number. The default is 0. | |
220 |
|
220 | |||
221 | Perforce Source |
|
221 | Perforce Source | |
222 | ''''''''''''''' |
|
222 | ''''''''''''''' | |
223 |
|
223 | |||
224 | The Perforce (P4) importer can be given a p4 depot path or a client |
|
224 | The Perforce (P4) importer can be given a p4 depot path or a client | |
225 | specification as source. It will convert all files in the source to a flat |
|
225 | specification as source. It will convert all files in the source to a flat | |
226 | Mercurial repository, ignoring labels, branches and integrations. Note |
|
226 | Mercurial repository, ignoring labels, branches and integrations. Note | |
227 | that when a depot path is given you then usually should specify a target |
|
227 | that when a depot path is given you then usually should specify a target | |
228 | directory, because otherwise the target may be named ...-hg. |
|
228 | directory, because otherwise the target may be named "...-hg". | |
229 |
|
229 | |||
230 | It is possible to limit the amount of source history to be converted by |
|
230 | It is possible to limit the amount of source history to be converted by | |
231 | specifying an initial Perforce revision: |
|
231 | specifying an initial Perforce revision: | |
232 |
|
232 | |||
233 | convert.p4.startrev |
|
233 | convert.p4.startrev | |
234 | specify initial Perforce revision, a Perforce changelist |
|
234 | specify initial Perforce revision, a Perforce changelist | |
235 | number). |
|
235 | number). | |
236 |
|
236 | |||
237 | Mercurial Destination |
|
237 | Mercurial Destination | |
238 | ''''''''''''''''''''' |
|
238 | ''''''''''''''''''''' | |
239 |
|
239 | |||
240 | The following options are supported: |
|
240 | The following options are supported: | |
241 |
|
241 | |||
242 | convert.hg.clonebranches |
|
242 | convert.hg.clonebranches | |
243 | dispatch source branches in separate clones. The default is |
|
243 | dispatch source branches in separate clones. The default is | |
244 | False. |
|
244 | False. | |
245 | convert.hg.tagsbranch |
|
245 | convert.hg.tagsbranch | |
246 | branch name for tag revisions, defaults to "default". |
|
246 | branch name for tag revisions, defaults to "default". | |
247 | convert.hg.usebranchnames |
|
247 | convert.hg.usebranchnames | |
248 | preserve branch names. The default is True |
|
248 | preserve branch names. The default is True | |
249 |
|
249 | |||
250 | options: |
|
250 | options: | |
251 |
|
251 | |||
252 | -s --source-type TYPE source repository type |
|
252 | -s --source-type TYPE source repository type | |
253 | -d --dest-type TYPE destination repository type |
|
253 | -d --dest-type TYPE destination repository type | |
254 | -r --rev REV import up to target revision REV |
|
254 | -r --rev REV import up to target revision REV | |
255 | -A --authormap FILE remap usernames using this file |
|
255 | -A --authormap FILE remap usernames using this file | |
256 | --filemap FILE remap file names using contents of file |
|
256 | --filemap FILE remap file names using contents of file | |
257 | --splicemap FILE splice synthesized history into place |
|
257 | --splicemap FILE splice synthesized history into place | |
258 | --branchmap FILE change branch names while converting |
|
258 | --branchmap FILE change branch names while converting | |
259 | --branchsort try to sort changesets by branches |
|
259 | --branchsort try to sort changesets by branches | |
260 | --datesort try to sort changesets by date |
|
260 | --datesort try to sort changesets by date | |
261 | --sourcesort preserve source changesets order |
|
261 | --sourcesort preserve source changesets order | |
262 |
|
262 | |||
263 | use "hg -v help convert" to show global options |
|
263 | use "hg -v help convert" to show global options | |
264 | $ hg init a |
|
264 | $ hg init a | |
265 | $ cd a |
|
265 | $ cd a | |
266 | $ echo a > a |
|
266 | $ echo a > a | |
267 | $ hg ci -d'0 0' -Ama |
|
267 | $ hg ci -d'0 0' -Ama | |
268 | adding a |
|
268 | adding a | |
269 | $ hg cp a b |
|
269 | $ hg cp a b | |
270 | $ hg ci -d'1 0' -mb |
|
270 | $ hg ci -d'1 0' -mb | |
271 | $ hg rm a |
|
271 | $ hg rm a | |
272 | $ hg ci -d'2 0' -mc |
|
272 | $ hg ci -d'2 0' -mc | |
273 | $ hg mv b a |
|
273 | $ hg mv b a | |
274 | $ hg ci -d'3 0' -md |
|
274 | $ hg ci -d'3 0' -md | |
275 | $ echo a >> a |
|
275 | $ echo a >> a | |
276 | $ hg ci -d'4 0' -me |
|
276 | $ hg ci -d'4 0' -me | |
277 | $ cd .. |
|
277 | $ cd .. | |
278 | $ hg convert a 2>&1 | grep -v 'subversion python bindings could not be loaded' |
|
278 | $ hg convert a 2>&1 | grep -v 'subversion python bindings could not be loaded' | |
279 | assuming destination a-hg |
|
279 | assuming destination a-hg | |
280 | initializing destination a-hg repository |
|
280 | initializing destination a-hg repository | |
281 | scanning source... |
|
281 | scanning source... | |
282 | sorting... |
|
282 | sorting... | |
283 | converting... |
|
283 | converting... | |
284 | 4 a |
|
284 | 4 a | |
285 | 3 b |
|
285 | 3 b | |
286 | 2 c |
|
286 | 2 c | |
287 | 1 d |
|
287 | 1 d | |
288 | 0 e |
|
288 | 0 e | |
289 | $ hg --cwd a-hg pull ../a |
|
289 | $ hg --cwd a-hg pull ../a | |
290 | pulling from ../a |
|
290 | pulling from ../a | |
291 | searching for changes |
|
291 | searching for changes | |
292 | no changes found |
|
292 | no changes found | |
293 | $ touch bogusfile |
|
293 | $ touch bogusfile | |
294 |
|
294 | |||
295 | should fail |
|
295 | should fail | |
296 |
|
296 | |||
297 | $ hg convert a bogusfile |
|
297 | $ hg convert a bogusfile | |
298 | initializing destination bogusfile repository |
|
298 | initializing destination bogusfile repository | |
299 | abort: cannot create new bundle repository |
|
299 | abort: cannot create new bundle repository | |
300 | [255] |
|
300 | [255] | |
301 | $ mkdir bogusdir |
|
301 | $ mkdir bogusdir | |
302 | $ chmod 000 bogusdir |
|
302 | $ chmod 000 bogusdir | |
303 |
|
303 | |||
304 | should fail |
|
304 | should fail | |
305 |
|
305 | |||
306 | $ hg convert a bogusdir |
|
306 | $ hg convert a bogusdir | |
307 | abort: Permission denied: bogusdir |
|
307 | abort: Permission denied: bogusdir | |
308 | [255] |
|
308 | [255] | |
309 |
|
309 | |||
310 | should succeed |
|
310 | should succeed | |
311 |
|
311 | |||
312 | $ chmod 700 bogusdir |
|
312 | $ chmod 700 bogusdir | |
313 | $ hg convert a bogusdir |
|
313 | $ hg convert a bogusdir | |
314 | initializing destination bogusdir repository |
|
314 | initializing destination bogusdir repository | |
315 | scanning source... |
|
315 | scanning source... | |
316 | sorting... |
|
316 | sorting... | |
317 | converting... |
|
317 | converting... | |
318 | 4 a |
|
318 | 4 a | |
319 | 3 b |
|
319 | 3 b | |
320 | 2 c |
|
320 | 2 c | |
321 | 1 d |
|
321 | 1 d | |
322 | 0 e |
|
322 | 0 e | |
323 |
|
323 | |||
324 | test pre and post conversion actions |
|
324 | test pre and post conversion actions | |
325 |
|
325 | |||
326 | $ echo 'include b' > filemap |
|
326 | $ echo 'include b' > filemap | |
327 | $ hg convert --debug --filemap filemap a partialb | \ |
|
327 | $ hg convert --debug --filemap filemap a partialb | \ | |
328 | > grep 'run hg' |
|
328 | > grep 'run hg' | |
329 | run hg source pre-conversion action |
|
329 | run hg source pre-conversion action | |
330 | run hg sink pre-conversion action |
|
330 | run hg sink pre-conversion action | |
331 | run hg sink post-conversion action |
|
331 | run hg sink post-conversion action | |
332 | run hg source post-conversion action |
|
332 | run hg source post-conversion action | |
333 |
|
333 | |||
334 | converting empty dir should fail "nicely |
|
334 | converting empty dir should fail "nicely | |
335 |
|
335 | |||
336 | $ mkdir emptydir |
|
336 | $ mkdir emptydir | |
337 |
|
337 | |||
338 | override $PATH to ensure p4 not visible; use $PYTHON in case we're |
|
338 | override $PATH to ensure p4 not visible; use $PYTHON in case we're | |
339 | running from a devel copy, not a temp installation |
|
339 | running from a devel copy, not a temp installation | |
340 |
|
340 | |||
341 | $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg convert emptydir |
|
341 | $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg convert emptydir | |
342 | assuming destination emptydir-hg |
|
342 | assuming destination emptydir-hg | |
343 | initializing destination emptydir-hg repository |
|
343 | initializing destination emptydir-hg repository | |
344 | emptydir does not look like a CVS checkout |
|
344 | emptydir does not look like a CVS checkout | |
345 | emptydir does not look like a Git repository |
|
345 | emptydir does not look like a Git repository | |
346 | emptydir does not look like a Subversion repository |
|
346 | emptydir does not look like a Subversion repository | |
347 | emptydir is not a local Mercurial repository |
|
347 | emptydir is not a local Mercurial repository | |
348 | emptydir does not look like a darcs repository |
|
348 | emptydir does not look like a darcs repository | |
349 | emptydir does not look like a monotone repository |
|
349 | emptydir does not look like a monotone repository | |
350 | emptydir does not look like a GNU Arch repository |
|
350 | emptydir does not look like a GNU Arch repository | |
351 | emptydir does not look like a Bazaar repository |
|
351 | emptydir does not look like a Bazaar repository | |
352 | cannot find required "p4" tool |
|
352 | cannot find required "p4" tool | |
353 | abort: emptydir: missing or unsupported repository |
|
353 | abort: emptydir: missing or unsupported repository | |
354 | [255] |
|
354 | [255] | |
355 |
|
355 | |||
356 | convert with imaginary source type |
|
356 | convert with imaginary source type | |
357 |
|
357 | |||
358 | $ hg convert --source-type foo a a-foo |
|
358 | $ hg convert --source-type foo a a-foo | |
359 | initializing destination a-foo repository |
|
359 | initializing destination a-foo repository | |
360 | abort: foo: invalid source repository type |
|
360 | abort: foo: invalid source repository type | |
361 | [255] |
|
361 | [255] | |
362 |
|
362 | |||
363 | convert with imaginary sink type |
|
363 | convert with imaginary sink type | |
364 |
|
364 | |||
365 | $ hg convert --dest-type foo a a-foo |
|
365 | $ hg convert --dest-type foo a a-foo | |
366 | abort: foo: invalid destination repository type |
|
366 | abort: foo: invalid destination repository type | |
367 | [255] |
|
367 | [255] | |
368 |
|
368 | |||
369 | testing: convert must not produce duplicate entries in fncache |
|
369 | testing: convert must not produce duplicate entries in fncache | |
370 |
|
370 | |||
371 | $ hg convert a b |
|
371 | $ hg convert a b | |
372 | initializing destination b repository |
|
372 | initializing destination b repository | |
373 | scanning source... |
|
373 | scanning source... | |
374 | sorting... |
|
374 | sorting... | |
375 | converting... |
|
375 | converting... | |
376 | 4 a |
|
376 | 4 a | |
377 | 3 b |
|
377 | 3 b | |
378 | 2 c |
|
378 | 2 c | |
379 | 1 d |
|
379 | 1 d | |
380 | 0 e |
|
380 | 0 e | |
381 |
|
381 | |||
382 | contents of fncache file: |
|
382 | contents of fncache file: | |
383 |
|
383 | |||
384 | $ cat b/.hg/store/fncache |
|
384 | $ cat b/.hg/store/fncache | |
385 | data/a.i |
|
385 | data/a.i | |
386 | data/b.i |
|
386 | data/b.i | |
387 |
|
387 | |||
388 | test bogus URL |
|
388 | test bogus URL | |
389 |
|
389 | |||
390 | $ hg convert -q bzr+ssh://foobar@selenic.com/baz baz |
|
390 | $ hg convert -q bzr+ssh://foobar@selenic.com/baz baz | |
391 | abort: bzr+ssh://foobar@selenic.com/baz: missing or unsupported repository |
|
391 | abort: bzr+ssh://foobar@selenic.com/baz: missing or unsupported repository | |
392 | [255] |
|
392 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now