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