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