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