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