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