##// END OF EJS Templates
convert: marked string for translation
Martin Geisler -
r7735:2e48668b default
parent child Browse files
Show More
@@ -1,233 +1,233 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
5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference.
6 # of the GNU General Public License, incorporated herein by reference.
7 '''converting foreign VCS repositories to Mercurial'''
7 '''converting foreign VCS repositories to Mercurial'''
8
8
9 import convcmd
9 import convcmd
10 import cvsps
10 import cvsps
11 from mercurial import commands
11 from mercurial import commands
12 from mercurial.i18n import _
12 from mercurial.i18n import _
13
13
14 # Commands definition was moved elsewhere to ease demandload job.
14 # Commands definition was moved elsewhere to ease demandload job.
15
15
16 def convert(ui, src, dest=None, revmapfile=None, **opts):
16 def convert(ui, src, dest=None, revmapfile=None, **opts):
17 """convert a foreign SCM repository to a Mercurial one.
17 """convert a foreign SCM repository to a Mercurial one.
18
18
19 Accepted source formats [identifiers]:
19 Accepted source formats [identifiers]:
20 - Mercurial [hg]
20 - Mercurial [hg]
21 - CVS [cvs]
21 - CVS [cvs]
22 - Darcs [darcs]
22 - Darcs [darcs]
23 - git [git]
23 - git [git]
24 - Subversion [svn]
24 - Subversion [svn]
25 - Monotone [mtn]
25 - Monotone [mtn]
26 - GNU Arch [gnuarch]
26 - GNU Arch [gnuarch]
27 - Bazaar [bzr]
27 - Bazaar [bzr]
28
28
29 Accepted destination formats [identifiers]:
29 Accepted destination formats [identifiers]:
30 - Mercurial [hg]
30 - Mercurial [hg]
31 - Subversion [svn] (history on branches is not preserved)
31 - Subversion [svn] (history on branches is not preserved)
32
32
33 If no revision is given, all revisions will be converted. Otherwise,
33 If no revision is given, all revisions will be converted. Otherwise,
34 convert will only import up to the named revision (given in a format
34 convert will only import up to the named revision (given in a format
35 understood by the source).
35 understood by the source).
36
36
37 If no destination directory name is specified, it defaults to the
37 If no destination directory name is specified, it defaults to the
38 basename of the source with '-hg' appended. If the destination
38 basename of the source with '-hg' appended. If the destination
39 repository doesn't exist, it will be created.
39 repository doesn't exist, it will be created.
40
40
41 If <REVMAP> isn't given, it will be put in a default location
41 If <REVMAP> isn't given, it will be put in a default location
42 (<dest>/.hg/shamap by default). The <REVMAP> is a simple text
42 (<dest>/.hg/shamap by default). The <REVMAP> is a simple text
43 file that maps each source commit ID to the destination ID for
43 file that maps each source commit ID to the destination ID for
44 that revision, like so:
44 that revision, like so:
45 <source ID> <destination ID>
45 <source ID> <destination ID>
46
46
47 If the file doesn't exist, it's automatically created. It's updated
47 If the file doesn't exist, it's automatically created. It's updated
48 on each commit copied, so convert-repo can be interrupted and can
48 on each commit copied, so convert-repo can be interrupted and can
49 be run repeatedly to copy new commits.
49 be run repeatedly to copy new commits.
50
50
51 The [username mapping] file is a simple text file that maps each source
51 The [username mapping] file is a simple text file that maps each source
52 commit author to a destination commit author. It is handy for source SCMs
52 commit author to a destination commit author. It is handy for source SCMs
53 that use unix logins to identify authors (eg: CVS). One line per author
53 that use unix logins to identify authors (eg: CVS). One line per author
54 mapping and the line format is:
54 mapping and the line format is:
55 srcauthor=whatever string you want
55 srcauthor=whatever string you want
56
56
57 The filemap is a file that allows filtering and remapping of files
57 The filemap is a file that allows filtering and remapping of files
58 and directories. Comment lines start with '#'. Each line can
58 and directories. Comment lines start with '#'. Each line can
59 contain one of the following directives:
59 contain one of the following directives:
60
60
61 include path/to/file
61 include path/to/file
62
62
63 exclude path/to/file
63 exclude path/to/file
64
64
65 rename from/file to/file
65 rename from/file to/file
66
66
67 The 'include' directive causes a file, or all files under a
67 The 'include' directive causes a file, or all files under a
68 directory, to be included in the destination repository, and the
68 directory, to be included in the destination repository, and the
69 exclusion of all other files and dirs not explicitely included.
69 exclusion of all other files and dirs not explicitely included.
70 The 'exclude' directive causes files or directories to be omitted.
70 The 'exclude' directive causes files or directories to be omitted.
71 The 'rename' directive renames a file or directory. To rename from a
71 The 'rename' directive renames a file or directory. To rename from a
72 subdirectory into the root of the repository, use '.' as the path to
72 subdirectory into the root of the repository, use '.' as the path to
73 rename to.
73 rename to.
74
74
75 The splicemap is a file that allows insertion of synthetic
75 The splicemap is a file that allows insertion of synthetic
76 history, letting you specify the parents of a revision. This is
76 history, letting you specify the parents of a revision. This is
77 useful if you want to e.g. give a Subversion merge two parents, or
77 useful if you want to e.g. give a Subversion merge two parents, or
78 graft two disconnected series of history together. Each entry
78 graft two disconnected series of history together. Each entry
79 contains a key, followed by a space, followed by one or two
79 contains a key, followed by a space, followed by one or two
80 values, separated by spaces. The key is the revision ID in the
80 values, separated by spaces. The key is the revision ID in the
81 source revision control system whose parents should be modified
81 source revision control system whose parents should be modified
82 (same format as a key in .hg/shamap). The values are the revision
82 (same format as a key in .hg/shamap). The values are the revision
83 IDs (in either the source or destination revision control system)
83 IDs (in either the source or destination revision control system)
84 that should be used as the new parents for that node.
84 that should be used as the new parents for that node.
85
85
86 Mercurial Source
86 Mercurial Source
87 -----------------
87 -----------------
88
88
89 --config convert.hg.ignoreerrors=False (boolean)
89 --config convert.hg.ignoreerrors=False (boolean)
90 ignore integrity errors when reading. Use it to fix Mercurial
90 ignore integrity errors when reading. Use it to fix Mercurial
91 repositories with missing revlogs, by converting from and to
91 repositories with missing revlogs, by converting from and to
92 Mercurial.
92 Mercurial.
93 --config convert.hg.saverev=True (boolean)
93 --config convert.hg.saverev=True (boolean)
94 allow target to preserve source revision ID
94 allow target to preserve source revision ID
95 --config convert.hg.startrev=0 (hg revision identifier)
95 --config convert.hg.startrev=0 (hg revision identifier)
96 convert start revision and its descendants
96 convert start revision and its descendants
97
97
98 CVS Source
98 CVS Source
99 ----------
99 ----------
100
100
101 CVS source will use a sandbox (i.e. a checked-out copy) from CVS
101 CVS source will use a sandbox (i.e. a checked-out copy) from CVS
102 to indicate the starting point of what will be converted. Direct
102 to indicate the starting point of what will be converted. Direct
103 access to the repository files is not needed, unless of course
103 access to the repository files is not needed, unless of course
104 the repository is :local:. The conversion uses the top level
104 the repository is :local:. The conversion uses the top level
105 directory in the sandbox to find the CVS repository, and then uses
105 directory in the sandbox to find the CVS repository, and then uses
106 CVS rlog commands to find files to convert. This means that unless
106 CVS rlog commands to find files to convert. This means that unless
107 a filemap is given, all files under the starting directory will be
107 a filemap is given, all files under the starting directory will be
108 converted, and that any directory reorganisation in the CVS
108 converted, and that any directory reorganisation in the CVS
109 sandbox is ignored.
109 sandbox is ignored.
110
110
111 Because CVS does not have changesets, it is necessary to collect
111 Because CVS does not have changesets, it is necessary to collect
112 individual commits to CVS and merge them into changesets. CVS
112 individual commits to CVS and merge them into changesets. CVS
113 source uses its internal changeset merging code by default but can
113 source uses its internal changeset merging code by default but can
114 be configured to call the external 'cvsps' program by setting:
114 be configured to call the external 'cvsps' program by setting:
115 --config convert.cvsps='cvsps -A -u --cvs-direct -q'
115 --config convert.cvsps='cvsps -A -u --cvs-direct -q'
116 This is a legacy option and may be removed in future.
116 This is a legacy option and may be removed in future.
117
117
118 The options shown are the defaults.
118 The options shown are the defaults.
119
119
120 Internal cvsps is selected by setting
120 Internal cvsps is selected by setting
121 --config convert.cvsps=builtin
121 --config convert.cvsps=builtin
122 and has a few more configurable options:
122 and has a few more configurable options:
123 --config convert.cvsps.fuzz=60 (integer)
123 --config convert.cvsps.fuzz=60 (integer)
124 Specify the maximum time (in seconds) that is allowed between
124 Specify the maximum time (in seconds) that is allowed between
125 commits with identical user and log message in a single
125 commits with identical user and log message in a single
126 changeset. When very large files were checked in as part
126 changeset. When very large files were checked in as part
127 of a changeset then the default may not be long enough.
127 of a changeset then the default may not be long enough.
128 --config convert.cvsps.mergeto='{{mergetobranch ([-\w]+)}}'
128 --config convert.cvsps.mergeto='{{mergetobranch ([-\w]+)}}'
129 Specify a regular expression to which commit log messages are
129 Specify a regular expression to which commit log messages are
130 matched. If a match occurs, then the conversion process will
130 matched. If a match occurs, then the conversion process will
131 insert a dummy revision merging the branch on which this log
131 insert a dummy revision merging the branch on which this log
132 message occurs to the branch indicated in the regex.
132 message occurs to the branch indicated in the regex.
133 --config convert.cvsps.mergefrom='{{mergefrombranch ([-\w]+)}}'
133 --config convert.cvsps.mergefrom='{{mergefrombranch ([-\w]+)}}'
134 Specify a regular expression to which commit log messages are
134 Specify a regular expression to which commit log messages are
135 matched. If a match occurs, then the conversion process will
135 matched. If a match occurs, then the conversion process will
136 add the most recent revision on the branch indicated in the
136 add the most recent revision on the branch indicated in the
137 regex as the second parent of the changeset.
137 regex as the second parent of the changeset.
138
138
139 The hgext/convert/cvsps wrapper script allows the builtin changeset
139 The hgext/convert/cvsps wrapper script allows the builtin changeset
140 merging code to be run without doing a conversion. Its parameters and
140 merging code to be run without doing a conversion. Its parameters and
141 output are similar to that of cvsps 2.1.
141 output are similar to that of cvsps 2.1.
142
142
143 Subversion Source
143 Subversion Source
144 -----------------
144 -----------------
145
145
146 Subversion source detects classical trunk/branches/tags layouts.
146 Subversion source detects classical trunk/branches/tags layouts.
147 By default, the supplied "svn://repo/path/" source URL is
147 By default, the supplied "svn://repo/path/" source URL is
148 converted as a single branch. If "svn://repo/path/trunk" exists
148 converted as a single branch. If "svn://repo/path/trunk" exists
149 it replaces the default branch. If "svn://repo/path/branches"
149 it replaces the default branch. If "svn://repo/path/branches"
150 exists, its subdirectories are listed as possible branches. If
150 exists, its subdirectories are listed as possible branches. If
151 "svn://repo/path/tags" exists, it is looked for tags referencing
151 "svn://repo/path/tags" exists, it is looked for tags referencing
152 converted branches. Default "trunk", "branches" and "tags" values
152 converted branches. Default "trunk", "branches" and "tags" values
153 can be overriden with following options. Set them to paths
153 can be overriden with following options. Set them to paths
154 relative to the source URL, or leave them blank to disable
154 relative to the source URL, or leave them blank to disable
155 autodetection.
155 autodetection.
156
156
157 --config convert.svn.branches=branches (directory name)
157 --config convert.svn.branches=branches (directory name)
158 specify the directory containing branches
158 specify the directory containing branches
159 --config convert.svn.tags=tags (directory name)
159 --config convert.svn.tags=tags (directory name)
160 specify the directory containing tags
160 specify the directory containing tags
161 --config convert.svn.trunk=trunk (directory name)
161 --config convert.svn.trunk=trunk (directory name)
162 specify the name of the trunk branch
162 specify the name of the trunk branch
163
163
164 Source history can be retrieved starting at a specific revision,
164 Source history can be retrieved starting at a specific revision,
165 instead of being integrally converted. Only single branch
165 instead of being integrally converted. Only single branch
166 conversions are supported.
166 conversions are supported.
167
167
168 --config convert.svn.startrev=0 (svn revision number)
168 --config convert.svn.startrev=0 (svn revision number)
169 specify start Subversion revision.
169 specify start Subversion revision.
170
170
171 Mercurial Destination
171 Mercurial Destination
172 ---------------------
172 ---------------------
173
173
174 --config convert.hg.clonebranches=False (boolean)
174 --config convert.hg.clonebranches=False (boolean)
175 dispatch source branches in separate clones.
175 dispatch source branches in separate clones.
176 --config convert.hg.tagsbranch=default (branch name)
176 --config convert.hg.tagsbranch=default (branch name)
177 tag revisions branch name
177 tag revisions branch name
178 --config convert.hg.usebranchnames=True (boolean)
178 --config convert.hg.usebranchnames=True (boolean)
179 preserve branch names
179 preserve branch names
180
180
181 """
181 """
182 return convcmd.convert(ui, src, dest, revmapfile, **opts)
182 return convcmd.convert(ui, src, dest, revmapfile, **opts)
183
183
184 def debugsvnlog(ui, **opts):
184 def debugsvnlog(ui, **opts):
185 return convcmd.debugsvnlog(ui, **opts)
185 return convcmd.debugsvnlog(ui, **opts)
186
186
187 def debugcvsps(ui, *args, **opts):
187 def debugcvsps(ui, *args, **opts):
188 '''create changeset information from CVS
188 '''create changeset information from CVS
189
189
190 This command is intended as a debugging tool for the CVS to Mercurial
190 This command is intended as a debugging tool for the CVS to Mercurial
191 converter, and can be used as a direct replacement for cvsps.
191 converter, and can be used as a direct replacement for cvsps.
192
192
193 Hg debugcvsps reads the CVS rlog for current directory (or any named
193 Hg debugcvsps reads the CVS rlog for current directory (or any named
194 directory) in the CVS repository, and converts the log to a series of
194 directory) in the CVS repository, and converts the log to a series of
195 changesets based on matching commit log entries and dates.'''
195 changesets based on matching commit log entries and dates.'''
196 return cvsps.debugcvsps(ui, *args, **opts)
196 return cvsps.debugcvsps(ui, *args, **opts)
197
197
198 commands.norepo += " convert debugsvnlog debugcvsps"
198 commands.norepo += " convert debugsvnlog debugcvsps"
199
199
200 cmdtable = {
200 cmdtable = {
201 "convert":
201 "convert":
202 (convert,
202 (convert,
203 [('A', 'authors', '', _('username mapping filename')),
203 [('A', 'authors', '', _('username mapping filename')),
204 ('d', 'dest-type', '', _('destination repository type')),
204 ('d', 'dest-type', '', _('destination repository type')),
205 ('', 'filemap', '', _('remap file names using contents of file')),
205 ('', 'filemap', '', _('remap file names using contents of file')),
206 ('r', 'rev', '', _('import up to target revision REV')),
206 ('r', 'rev', '', _('import up to target revision REV')),
207 ('s', 'source-type', '', _('source repository type')),
207 ('s', 'source-type', '', _('source repository type')),
208 ('', 'splicemap', '', _('splice synthesized history into place')),
208 ('', 'splicemap', '', _('splice synthesized history into place')),
209 ('', 'datesort', None, _('try to sort changesets by date'))],
209 ('', 'datesort', None, _('try to sort changesets by date'))],
210 _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]')),
210 _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]')),
211 "debugsvnlog":
211 "debugsvnlog":
212 (debugsvnlog,
212 (debugsvnlog,
213 [],
213 [],
214 'hg debugsvnlog'),
214 'hg debugsvnlog'),
215 "debugcvsps":
215 "debugcvsps":
216 (debugcvsps,
216 (debugcvsps,
217 [
217 [
218 # Main options shared with cvsps-2.1
218 # Main options shared with cvsps-2.1
219 ('b', 'branches', [], _('only return changes on specified branches')),
219 ('b', 'branches', [], _('only return changes on specified branches')),
220 ('p', 'prefix', '', _('prefix to remove from file names')),
220 ('p', 'prefix', '', _('prefix to remove from file names')),
221 ('r', 'revisions', [], _('only return changes after or between specified tags')),
221 ('r', 'revisions', [], _('only return changes after or between specified tags')),
222 ('u', 'update-cache', None, _("update cvs log cache")),
222 ('u', 'update-cache', None, _("update cvs log cache")),
223 ('x', 'new-cache', None, _("create new cvs log cache")),
223 ('x', 'new-cache', None, _("create new cvs log cache")),
224 ('z', 'fuzz', 60, _('set commit time fuzz in seconds')),
224 ('z', 'fuzz', 60, _('set commit time fuzz in seconds')),
225 ('', 'root', '', _('specify cvsroot')),
225 ('', 'root', '', _('specify cvsroot')),
226 # Options specific to builtin cvsps
226 # Options specific to builtin cvsps
227 ('', 'parents', '', _('show parent changesets')),
227 ('', 'parents', '', _('show parent changesets')),
228 ('', 'ancestors', '', _('show current changeset in ancestor branches')),
228 ('', 'ancestors', '', _('show current changeset in ancestor branches')),
229 # Options that are ignored for compatibility with cvsps-2.1
229 # Options that are ignored for compatibility with cvsps-2.1
230 ('A', 'cvs-direct', None, 'ignored for compatibility'),
230 ('A', 'cvs-direct', None, _('ignored for compatibility')),
231 ],
231 ],
232 'hg debugcvsps [OPTION]... [PATH]...'),
232 _('hg debugcvsps [OPTION]... [PATH]...')),
233 }
233 }
General Comments 0
You need to be logged in to leave comments. Login now