Show More
@@ -382,6 +382,7 b' def convert(ui, src, dest=None, revmapfi' | |||||
382 | fmap = opts.get('filemap') |
|
382 | fmap = opts.get('filemap') | |
383 | if fmap: |
|
383 | if fmap: | |
384 | srcc = filemap.filemap_source(ui, srcc, fmap) |
|
384 | srcc = filemap.filemap_source(ui, srcc, fmap) | |
|
385 | destc.setfilemapmode(True) | |||
385 |
|
386 | |||
386 | if not revmapfile: |
|
387 | if not revmapfile: | |
387 | try: |
|
388 | try: |
@@ -167,3 +167,13 b' class converter_sink(object):' | |||||
167 | pbranch: branch name of parent commit |
|
167 | pbranch: branch name of parent commit | |
168 | parents: destination revisions of parent""" |
|
168 | parents: destination revisions of parent""" | |
169 | pass |
|
169 | pass | |
|
170 | ||||
|
171 | def setfilemapmode(self, active): | |||
|
172 | """Tell the destination that we're using a filemap | |||
|
173 | ||||
|
174 | Some converter_sources (svn in particular) can claim that a file | |||
|
175 | was changed in a revision, even if there was no change. This method | |||
|
176 | tells the destination that we're using a filemap and that it should | |||
|
177 | filter empty revisions. | |||
|
178 | """ | |||
|
179 | pass |
@@ -28,6 +28,7 b' class mercurial_sink(converter_sink):' | |||||
28 | raise NoRepo("could not open hg repo %s as sink" % path) |
|
28 | raise NoRepo("could not open hg repo %s as sink" % path) | |
29 | self.lock = None |
|
29 | self.lock = None | |
30 | self.wlock = None |
|
30 | self.wlock = None | |
|
31 | self.filemapmode = False | |||
31 |
|
32 | |||
32 | def before(self): |
|
33 | def before(self): | |
33 | self.wlock = self.repo.wlock() |
|
34 | self.wlock = self.repo.wlock() | |
@@ -96,6 +97,10 b' class mercurial_sink(converter_sink):' | |||||
96 | pl.append(p) |
|
97 | pl.append(p) | |
97 | seen[p] = 1 |
|
98 | seen[p] = 1 | |
98 | parents = pl |
|
99 | parents = pl | |
|
100 | nparents = len(parents) | |||
|
101 | if self.filemapmode and nparents == 1: | |||
|
102 | m1node = self.repo.changelog.read(bin(parents[0]))[0] | |||
|
103 | parent = parents[0] | |||
99 |
|
104 | |||
100 | if len(parents) < 2: parents.append("0" * 40) |
|
105 | if len(parents) < 2: parents.append("0" * 40) | |
101 | if len(parents) < 2: parents.append("0" * 40) |
|
106 | if len(parents) < 2: parents.append("0" * 40) | |
@@ -117,6 +122,13 b' class mercurial_sink(converter_sink):' | |||||
117 | text = "(octopus merge fixup)\n" |
|
122 | text = "(octopus merge fixup)\n" | |
118 | p2 = hg.hex(self.repo.changelog.tip()) |
|
123 | p2 = hg.hex(self.repo.changelog.tip()) | |
119 |
|
124 | |||
|
125 | if self.filemapmode and nparents == 1: | |||
|
126 | man = self.repo.manifest | |||
|
127 | mnode = self.repo.changelog.read(bin(p2))[0] | |||
|
128 | if not man.cmp(m1node, man.revision(mnode)): | |||
|
129 | self.repo.rollback() | |||
|
130 | self.repo.dirstate.clear() | |||
|
131 | return parent | |||
120 | return p2 |
|
132 | return p2 | |
121 |
|
133 | |||
122 | def puttags(self, tags): |
|
134 | def puttags(self, tags): | |
@@ -153,6 +165,9 b' class mercurial_sink(converter_sink):' | |||||
153 | date, tagparent, nullid) |
|
165 | date, tagparent, nullid) | |
154 | return hex(self.repo.changelog.tip()) |
|
166 | return hex(self.repo.changelog.tip()) | |
155 |
|
167 | |||
|
168 | def setfilemapmode(self, active): | |||
|
169 | self.filemapmode = active | |||
|
170 | ||||
156 | class mercurial_source(converter_source): |
|
171 | class mercurial_source(converter_source): | |
157 | def __init__(self, ui, path, rev=None): |
|
172 | def __init__(self, ui, path, rev=None): | |
158 | converter_source.__init__(self, ui, path, rev) |
|
173 | converter_source.__init__(self, ui, path, rev) |
General Comments 0
You need to be logged in to leave comments.
Login now