diff options
Diffstat (limited to 'hgext/convert/filemap.py')
-rw-r--r-- | hgext/convert/filemap.py | 52 |
1 files changed, 19 insertions, 33 deletions
diff --git a/hgext/convert/filemap.py b/hgext/convert/filemap.py index c14df16..34033c7 100644 --- a/hgext/convert/filemap.py +++ b/hgext/convert/filemap.py @@ -99,8 +99,6 @@ class filemapper(object): if newpre == '.': return suf if suf: - if newpre.endswith('/'): - return newpre + suf return newpre + '/' + suf return newpre return name @@ -294,34 +292,23 @@ class filemap_source(converter_source): # A parent p is interesting if its mapped version (self.parentmap[p]): # - is not SKIPREV # - is still not in the list of parents (we don't want duplicates) - # - is not an ancestor of the mapped versions of the other parents or - # there is no parent in the same branch than the current revision. + # - is not an ancestor of the mapped versions of the other parents mparents = [] - knownparents = set() - branch = self.commits[rev].branch - hasbranchparent = False + wp = None for i, p1 in enumerate(parents): mp1 = self.parentmap[p1] - if mp1 == SKIPREV or mp1 in knownparents: + if mp1 == SKIPREV or mp1 in mparents: continue - isancestor = util.any(p2 for p2 in parents - if p1 != p2 and mp1 != self.parentmap[p2] - and mp1 in self.wantedancestors[p2]) - if not isancestor and not hasbranchparent and len(parents) > 1: - # This could be expensive, avoid unnecessary calls. - if self._cachedcommit(p1).branch == branch: - hasbranchparent = True - mparents.append((p1, mp1, i, isancestor)) - knownparents.add(mp1) - # Discard parents ancestors of other parents if there is a - # non-ancestor one on the same branch than current revision. - if hasbranchparent: - mparents = [p for p in mparents if not p[3]] - wp = None - if mparents: - wp = max(p[2] for p in mparents) - mparents = [p[1] for p in mparents] - elif parents: + for p2 in parents: + if p1 == p2 or mp1 == self.parentmap[p2]: + continue + if mp1 in self.wantedancestors[p2]: + break + else: + mparents.append(mp1) + wp = i + + if wp is None and parents: wp = 0 self.origparents[rev] = parents @@ -330,6 +317,7 @@ class filemap_source(converter_source): if 'close' in self.commits[rev].extra: # A branch closing revision is only useful if one of its # parents belong to the branch being closed + branch = self.commits[rev].branch pbranches = [self._cachedcommit(p).branch for p in mparents] if branch in pbranches: closed = True @@ -357,12 +345,13 @@ class filemap_source(converter_source): # able to get the files later on in getfile, we hide the # original filename in the rev part of the return value. changes, copies = self.base.getchanges(rev) - files = {} + newnames = {} + files = [] for f, r in changes: newf = self.filemapper(f) - if newf and (newf != f or newf not in files): - files[newf] = (f, r) - files = sorted(files.items()) + if newf: + files.append((newf, (f, r))) + newnames[f] = newf ncopies = {} for c in copies: @@ -386,6 +375,3 @@ class filemap_source(converter_source): def lookuprev(self, rev): return self.base.lookuprev(rev) - - def getbookmarks(self): - return self.base.getbookmarks() |