Show More
@@ -332,6 +332,24 b' def convert(ui, src, dest=None, revmapfi' | |||||
332 | The 'rename' directive renames a file or directory. To rename from a |
|
332 | The 'rename' directive renames a file or directory. To rename from a | |
333 | subdirectory into the root of the repository, use '.' as the path to |
|
333 | subdirectory into the root of the repository, use '.' as the path to | |
334 | rename to. |
|
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 | util._encoding = 'UTF-8' |
|
355 | util._encoding = 'UTF-8' |
@@ -40,7 +40,7 b' class commit(object):' | |||||
40 | class converter_source(object): |
|
40 | class converter_source(object): | |
41 | """Conversion source interface""" |
|
41 | """Conversion source interface""" | |
42 |
|
42 | |||
43 | def __init__(self, ui, path, rev=None): |
|
43 | def __init__(self, ui, path=None, rev=None): | |
44 | """Initialize conversion source (or raise NoRepo("message") |
|
44 | """Initialize conversion source (or raise NoRepo("message") | |
45 | exception if path is not a valid repository)""" |
|
45 | exception if path is not a valid repository)""" | |
46 | self.ui = ui |
|
46 | self.ui = ui |
@@ -7,7 +7,7 b'' | |||||
7 | import shlex |
|
7 | import shlex | |
8 | from mercurial.i18n import _ |
|
8 | from mercurial.i18n import _ | |
9 | from mercurial import util |
|
9 | from mercurial import util | |
10 | from common import SKIPREV |
|
10 | from common import SKIPREV, converter_source | |
11 |
|
11 | |||
12 | def rpairs(name): |
|
12 | def rpairs(name): | |
13 | e = len(name) |
|
13 | e = len(name) | |
@@ -110,9 +110,9 b' class filemapper(object):' | |||||
110 | # touch files we're interested in, but also merges that merge two |
|
110 | # touch files we're interested in, but also merges that merge two | |
111 | # or more interesting revisions. |
|
111 | # or more interesting revisions. | |
112 |
|
112 | |||
113 |
class filemap_source( |
|
113 | class filemap_source(converter_source): | |
114 | def __init__(self, ui, baseconverter, filemap): |
|
114 | def __init__(self, ui, baseconverter, filemap): | |
115 | self.ui = ui |
|
115 | super(filemap_source, self).__init__(ui) | |
116 | self.base = baseconverter |
|
116 | self.base = baseconverter | |
117 | self.filemapper = filemapper(ui, filemap) |
|
117 | self.filemapper = filemapper(ui, filemap) | |
118 | self.commits = {} |
|
118 | self.commits = {} | |
@@ -344,9 +344,3 b' class filemap_source(object):' | |||||
344 |
|
344 | |||
345 | def gettags(self): |
|
345 | def gettags(self): | |
346 | return self.base.gettags() |
|
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 | # hg backend for convert extension |
|
1 | # hg backend for convert extension | |
2 |
|
2 | |||
3 | # Note for hg->hg conversion: Old versions of Mercurial didn't trim |
|
3 | # Notes for hg->hg conversion: | |
4 | # the whitespace from the ends of commit messages, but new versions |
|
4 | # | |
5 | # do. Changesets created by those older versions, then converted, may |
|
5 | # * Old versions of Mercurial didn't trim the whitespace from the ends | |
6 | # thus have different hashes for changesets that are otherwise |
|
6 | # of commit messages, but new versions do. Changesets created by | |
7 | # identical. |
|
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 | import os, time |
|
16 | import os, time | |
@@ -181,6 +187,7 b' class mercurial_sink(converter_sink):' | |||||
181 | class mercurial_source(converter_source): |
|
187 | class mercurial_source(converter_source): | |
182 | def __init__(self, ui, path, rev=None): |
|
188 | def __init__(self, ui, path, rev=None): | |
183 | converter_source.__init__(self, ui, path, rev) |
|
189 | converter_source.__init__(self, ui, path, rev) | |
|
190 | self.saverev = ui.configbool('convert', 'hg.saverev', True) | |||
184 | try: |
|
191 | try: | |
185 | self.repo = hg.repository(self.ui, path) |
|
192 | self.repo = hg.repository(self.ui, path) | |
186 | # try to provoke an exception if this isn't really a hg |
|
193 | # try to provoke an exception if this isn't really a hg | |
@@ -239,8 +246,12 b' class mercurial_source(converter_source)' | |||||
239 | def getcommit(self, rev): |
|
246 | def getcommit(self, rev): | |
240 | ctx = self.changectx(rev) |
|
247 | ctx = self.changectx(rev) | |
241 | parents = [hex(p.node()) for p in ctx.parents() if p.node() != nullid] |
|
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 | return commit(author=ctx.user(), date=util.datestr(ctx.date()), |
|
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 | branch=ctx.branch(), extra=ctx.extra()) |
|
255 | branch=ctx.branch(), extra=ctx.extra()) | |
245 |
|
256 | |||
246 | def gettags(self): |
|
257 | def gettags(self): |
@@ -1,7 +1,11 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | echo "[extensions]" >> $HGRCPATH |
|
3 | cat >> $HGRCPATH <<EOF | |
4 | echo "convert=" >> $HGRCPATH |
|
4 | [extensions] | |
|
5 | convert= | |||
|
6 | [convert] | |||
|
7 | hg.saverev=False | |||
|
8 | EOF | |||
5 |
|
9 | |||
6 | hg help convert |
|
10 | hg help convert | |
7 |
|
11 |
@@ -44,7 +44,6 b' 0 Initial revision files: b/c' | |||||
44 | checking in src/a,v |
|
44 | checking in src/a,v | |
45 | checking in src/b/c,v |
|
45 | checking in src/b/c,v | |
46 | % convert again |
|
46 | % convert again | |
47 | destination src-hg is a Mercurial repository |
|
|||
48 | connecting to cvsrepo |
|
47 | connecting to cvsrepo | |
49 | scanning source... |
|
48 | scanning source... | |
50 | sorting... |
|
49 | sorting... | |
@@ -56,7 +55,6 b' c' | |||||
56 | c |
|
55 | c | |
57 | c |
|
56 | c | |
58 | % convert again with --filemap |
|
57 | % convert again with --filemap | |
59 | destination src-filemap is a Mercurial repository |
|
|||
60 | connecting to cvsrepo |
|
58 | connecting to cvsrepo | |
61 | scanning source... |
|
59 | scanning source... | |
62 | sorting... |
|
60 | sorting... |
@@ -1,7 +1,11 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | echo "[extensions]" >> $HGRCPATH |
|
3 | cat >> $HGRCPATH <<EOF | |
4 | echo "hgext.convert=" >> $HGRCPATH |
|
4 | [extensions] | |
|
5 | convert= | |||
|
6 | [convert] | |||
|
7 | hg.saverev=False | |||
|
8 | EOF | |||
5 |
|
9 | |||
6 | hg init orig |
|
10 | hg init orig | |
7 | cd orig |
|
11 | cd orig |
@@ -37,7 +37,6 b' 3 files updated, 0 files merged, 0 files' | |||||
37 | a 0 -1 unset baz |
|
37 | a 0 -1 unset baz | |
38 | copy: bar -> baz |
|
38 | copy: bar -> baz | |
39 | % add a new revision in the original repo |
|
39 | % add a new revision in the original repo | |
40 | destination new is a Mercurial repository |
|
|||
41 | scanning source... |
|
40 | scanning source... | |
42 | sorting... |
|
41 | sorting... | |
43 | converting... |
|
42 | converting... |
@@ -1,7 +1,11 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | echo "[extensions]" >> $HGRCPATH |
|
3 | cat >> $HGRCPATH <<EOF | |
4 | echo "hgext.convert=" >> $HGRCPATH |
|
4 | [extensions] | |
|
5 | convert= | |||
|
6 | [convert] | |||
|
7 | hg.saverev=False | |||
|
8 | EOF | |||
5 |
|
9 | |||
6 | hg init orig |
|
10 | hg init orig | |
7 | cd orig |
|
11 | cd orig |
@@ -25,7 +25,6 b' Transmitting file data ..' | |||||
25 | Committed revision 3. |
|
25 | Committed revision 3. | |
26 | % test incremental conversion |
|
26 | % test incremental conversion | |
27 | assuming destination trunk-hg |
|
27 | assuming destination trunk-hg | |
28 | destination trunk-hg is a Mercurial repository |
|
|||
29 | scanning source... |
|
28 | scanning source... | |
30 | sorting... |
|
29 | sorting... | |
31 | converting... |
|
30 | converting... | |
@@ -86,7 +85,6 b' Sending letter2.txt' | |||||
86 | Transmitting file data . |
|
85 | Transmitting file data . | |
87 | Committed revision 11. |
|
86 | Committed revision 11. | |
88 | % test incremental conversion |
|
87 | % test incremental conversion | |
89 | destination A-hg is a Mercurial repository |
|
|||
90 | scanning source... |
|
88 | scanning source... | |
91 | sorting... |
|
89 | sorting... | |
92 | converting... |
|
90 | converting... |
@@ -55,6 +55,24 b' Convert a foreign SCM repository to a Me' | |||||
55 | subdirectory into the root of the repository, use '.' as the path to |
|
55 | subdirectory into the root of the repository, use '.' as the path to | |
56 | rename to. |
|
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 | options: |
|
76 | options: | |
59 |
|
77 | |||
60 | -A --authors username mapping filename |
|
78 | -A --authors username mapping filename |
General Comments 0
You need to be logged in to leave comments.
Login now