##// END OF EJS Templates
convert: some tidyups, doc improvements, and test fixes...
Bryan O'Sullivan -
r5556:61fdf255 default
parent child Browse files
Show More
@@ -332,6 +332,24 b' def convert(ui, src, dest=None, revmapfi'
332 332 The 'rename' directive renames a file or directory. To rename from a
333 333 subdirectory into the root of the repository, use '.' as the path to
334 334 rename to.
335
336 Back end options:
337
338 --config convert.hg.clonebranches=False (boolean)
339 hg target: XXX not documented
340 --config convert.hg.saverev=True (boolean)
341 hg source: allow target to preserve source revision ID
342 --config convert.hg.tagsbranch=default (branch name)
343 hg target: XXX not documented
344 --config convert.hg.usebranchnames=True (boolean)
345 hg target: preserve branch names
346
347 --config convert.svn.branches=branches (directory name)
348 svn source: specify the directory containing branches
349 --config convert.svn.tags=tags (directory name)
350 svn source: specify the directory containing tags
351 --config convert.svn.trunk=trunk (directory name)
352 svn source: specify the name of the trunk branch
335 353 """
336 354
337 355 util._encoding = 'UTF-8'
@@ -40,7 +40,7 b' class commit(object):'
40 40 class converter_source(object):
41 41 """Conversion source interface"""
42 42
43 def __init__(self, ui, path, rev=None):
43 def __init__(self, ui, path=None, rev=None):
44 44 """Initialize conversion source (or raise NoRepo("message")
45 45 exception if path is not a valid repository)"""
46 46 self.ui = ui
@@ -7,7 +7,7 b''
7 7 import shlex
8 8 from mercurial.i18n import _
9 9 from mercurial import util
10 from common import SKIPREV
10 from common import SKIPREV, converter_source
11 11
12 12 def rpairs(name):
13 13 e = len(name)
@@ -110,9 +110,9 b' class filemapper(object):'
110 110 # touch files we're interested in, but also merges that merge two
111 111 # or more interesting revisions.
112 112
113 class filemap_source(object):
113 class filemap_source(converter_source):
114 114 def __init__(self, ui, baseconverter, filemap):
115 self.ui = ui
115 super(filemap_source, self).__init__(ui)
116 116 self.base = baseconverter
117 117 self.filemapper = filemapper(ui, filemap)
118 118 self.commits = {}
@@ -344,9 +344,3 b' class filemap_source(object):'
344 344
345 345 def gettags(self):
346 346 return self.base.gettags()
347
348 def before(self):
349 pass
350
351 def after(self):
352 pass
@@ -1,10 +1,16 b''
1 1 # hg backend for convert extension
2 2
3 # Note for hg->hg conversion: Old versions of Mercurial didn't trim
4 # the whitespace from the ends of commit messages, but new versions
5 # do. Changesets created by those older versions, then converted, may
6 # thus have different hashes for changesets that are otherwise
7 # identical.
3 # Notes for hg->hg conversion:
4 #
5 # * Old versions of Mercurial didn't trim the whitespace from the ends
6 # of commit messages, but new versions do. Changesets created by
7 # those older versions, then converted, may thus have different
8 # hashes for changesets that are otherwise identical.
9 #
10 # * By default, the source revision is stored in the converted
11 # revision. This will cause the converted revision to have a
12 # different identity than the source. To avoid this, use the
13 # following option: "--config convert.hg.saverev=false"
8 14
9 15
10 16 import os, time
@@ -181,6 +187,7 b' class mercurial_sink(converter_sink):'
181 187 class mercurial_source(converter_source):
182 188 def __init__(self, ui, path, rev=None):
183 189 converter_source.__init__(self, ui, path, rev)
190 self.saverev = ui.configbool('convert', 'hg.saverev', True)
184 191 try:
185 192 self.repo = hg.repository(self.ui, path)
186 193 # try to provoke an exception if this isn't really a hg
@@ -239,8 +246,12 b' class mercurial_source(converter_source)'
239 246 def getcommit(self, rev):
240 247 ctx = self.changectx(rev)
241 248 parents = [hex(p.node()) for p in ctx.parents() if p.node() != nullid]
249 if self.saverev:
250 crev = rev
251 else:
252 crev = None
242 253 return commit(author=ctx.user(), date=util.datestr(ctx.date()),
243 desc=ctx.description(), rev=rev, parents=parents,
254 desc=ctx.description(), rev=crev, parents=parents,
244 255 branch=ctx.branch(), extra=ctx.extra())
245 256
246 257 def gettags(self):
@@ -1,7 +1,11 b''
1 1 #!/bin/sh
2 2
3 echo "[extensions]" >> $HGRCPATH
4 echo "convert=" >> $HGRCPATH
3 cat >> $HGRCPATH <<EOF
4 [extensions]
5 convert=
6 [convert]
7 hg.saverev=False
8 EOF
5 9
6 10 hg help convert
7 11
@@ -44,7 +44,6 b' 0 Initial revision files: b/c'
44 44 checking in src/a,v
45 45 checking in src/b/c,v
46 46 % convert again
47 destination src-hg is a Mercurial repository
48 47 connecting to cvsrepo
49 48 scanning source...
50 49 sorting...
@@ -56,7 +55,6 b' c'
56 55 c
57 56 c
58 57 % convert again with --filemap
59 destination src-filemap is a Mercurial repository
60 58 connecting to cvsrepo
61 59 scanning source...
62 60 sorting...
@@ -1,7 +1,11 b''
1 1 #!/bin/sh
2 2
3 echo "[extensions]" >> $HGRCPATH
4 echo "hgext.convert=" >> $HGRCPATH
3 cat >> $HGRCPATH <<EOF
4 [extensions]
5 convert=
6 [convert]
7 hg.saverev=False
8 EOF
5 9
6 10 hg init orig
7 11 cd orig
@@ -37,7 +37,6 b' 3 files updated, 0 files merged, 0 files'
37 37 a 0 -1 unset baz
38 38 copy: bar -> baz
39 39 % add a new revision in the original repo
40 destination new is a Mercurial repository
41 40 scanning source...
42 41 sorting...
43 42 converting...
@@ -1,7 +1,11 b''
1 1 #!/bin/sh
2 2
3 echo "[extensions]" >> $HGRCPATH
4 echo "hgext.convert=" >> $HGRCPATH
3 cat >> $HGRCPATH <<EOF
4 [extensions]
5 convert=
6 [convert]
7 hg.saverev=False
8 EOF
5 9
6 10 hg init orig
7 11 cd orig
@@ -25,7 +25,6 b' Transmitting file data ..'
25 25 Committed revision 3.
26 26 % test incremental conversion
27 27 assuming destination trunk-hg
28 destination trunk-hg is a Mercurial repository
29 28 scanning source...
30 29 sorting...
31 30 converting...
@@ -86,7 +85,6 b' Sending letter2.txt'
86 85 Transmitting file data .
87 86 Committed revision 11.
88 87 % test incremental conversion
89 destination A-hg is a Mercurial repository
90 88 scanning source...
91 89 sorting...
92 90 converting...
@@ -55,6 +55,24 b' Convert a foreign SCM repository to a Me'
55 55 subdirectory into the root of the repository, use '.' as the path to
56 56 rename to.
57 57
58 Back end options:
59
60 --config convert.hg.clonebranches=False (boolean)
61 hg target: XXX not documented
62 --config convert.hg.saverev=True (boolean)
63 hg source: allow target to preserve source revision ID
64 --config convert.hg.tagsbranch=default (branch name)
65 hg target: XXX not documented
66 --config convert.hg.usebranchnames=True (boolean)
67 hg target: preserve branch names
68
69 --config convert.svn.branches=branches (directory name)
70 svn source: specify the directory containing branches
71 --config convert.svn.tags=tags (directory name)
72 svn source: specify the directory containing tags
73 --config convert.svn.trunk=trunk (directory name)
74 svn source: specify the name of the trunk branch
75
58 76 options:
59 77
60 78 -A --authors username mapping filename
General Comments 0
You need to be logged in to leave comments. Login now