258 def cleanup(self): |
258 def cleanup(self): |
259 if self.mapfilefd: |
259 if self.mapfilefd: |
260 self.mapfilefd.close() |
260 self.mapfilefd.close() |
261 |
261 |
262 def _convert(ui, src, dest=None, mapfile=None, **opts): |
262 def _convert(ui, src, dest=None, mapfile=None, **opts): |
263 '''Convert a foreign SCM repository to a Mercurial one. |
263 """Convert a foreign SCM repository to a Mercurial one. |
264 |
264 |
265 Accepted source formats: |
265 Accepted source formats: |
266 - GIT |
266 - GIT |
267 - CVS |
267 - CVS |
268 - SVN |
268 - SVN |
273 If no revision is given, all revisions will be converted. Otherwise, |
273 If no revision is given, all revisions will be converted. Otherwise, |
274 convert will only import up to the named revision (given in a format |
274 convert will only import up to the named revision (given in a format |
275 understood by the source). |
275 understood by the source). |
276 |
276 |
277 If no destination directory name is specified, it defaults to the |
277 If no destination directory name is specified, it defaults to the |
278 basename of the source with \'-hg\' appended. If the destination |
278 basename of the source with '-hg' appended. If the destination |
279 repository doesn\'t exist, it will be created. |
279 repository doesn't exist, it will be created. |
280 |
280 |
281 If <mapfile> isn\'t given, it will be put in a default location |
281 If <mapfile> isn't given, it will be put in a default location |
282 (<dest>/.hg/shamap by default). The <mapfile> is a simple text |
282 (<dest>/.hg/shamap by default). The <mapfile> is a simple text |
283 file that maps each source commit ID to the destination ID for |
283 file that maps each source commit ID to the destination ID for |
284 that revision, like so: |
284 that revision, like so: |
285 <source ID> <destination ID> |
285 <source ID> <destination ID> |
286 |
286 |
287 If the file doesn\'t exist, it\'s automatically created. It\'s updated |
287 If the file doesn't exist, it's automatically created. It's updated |
288 on each commit copied, so convert-repo can be interrupted and can |
288 on each commit copied, so convert-repo can be interrupted and can |
289 be run repeatedly to copy new commits. |
289 be run repeatedly to copy new commits. |
290 |
290 |
291 The [username mapping] file is a simple text file that maps each source |
291 The [username mapping] file is a simple text file that maps each source |
292 commit author to a destination commit author. It is handy for source SCMs |
292 commit author to a destination commit author. It is handy for source SCMs |
293 that use unix logins to identify authors (eg: CVS). One line per author |
293 that use unix logins to identify authors (eg: CVS). One line per author |
294 mapping and the line format is: |
294 mapping and the line format is: |
295 srcauthor=whatever string you want |
295 srcauthor=whatever string you want |
296 ''' |
296 """ |
297 |
297 |
298 util._encoding = 'UTF-8' |
298 util._encoding = 'UTF-8' |
299 |
299 |
300 if not dest: |
300 if not dest: |
301 dest = hg.defaultdest(src) + "-hg" |
301 dest = hg.defaultdest(src) + "-hg" |