comparison hgext/convert/bzr.py @ 24395:216fa1ba9993

convert: optimize convert of files that are unmodified from p2 in merges Conversion of a merge starts with p1 and re-adds the files that were changed in the merge or came unmodified from p2. Files that are unmodified from p1 will thus not be touched and take no time. Files that are unmodified from p2 would be retrieved and rehashed. They would end up getting the same hash as in p2 and end up reusing the filelog entry and look like the p1 case ... but it was slow. Instead, make getchanges also return 'files that are unmodified from p2' so the sink can reuse the existing p2 entry instead of calling getfile. Reuse of filelog entries can make a big difference when files are big and with long revlong chains so they take time to retrieve and hash, or when using an expensive custom getfile function (think http://mercurial.selenic.com/wiki/ConvertExtension#Customization with a code reformatter). This in combination with changes to reuse filectx entries in localrepo._filecommit make 'unchanged from p2' almost as fast as 'unchanged from p1'. This is so far only implemented for the combination of hg source and hg sink. This is a refactoring/optimization. It is covered by existing tests and show no changes - which is a good thing.
author Mads Kiilerich <madski@unity3d.com>
date Thu, 19 Mar 2015 17:40:19 +0100
parents 35ab037de989
children baea47cafe75
comparison
equal deleted inserted replaced
24394:03163826b4e6 24395:216fa1ba9993
141 self._revtree = self.sourcerepo.revision_tree(version) 141 self._revtree = self.sourcerepo.revision_tree(version)
142 # get the parentids from the cache 142 # get the parentids from the cache
143 parentids = self._parentids.pop(version) 143 parentids = self._parentids.pop(version)
144 # only diff against first parent id 144 # only diff against first parent id
145 prevtree = self.sourcerepo.revision_tree(parentids[0]) 145 prevtree = self.sourcerepo.revision_tree(parentids[0])
146 return self._gettreechanges(self._revtree, prevtree) 146 files, changes = self._gettreechanges(self._revtree, prevtree)
147 return files, changes, set()
147 148
148 def getcommit(self, version): 149 def getcommit(self, version):
149 rev = self.sourcerepo.get_revision(version) 150 rev = self.sourcerepo.get_revision(version)
150 # populate parent id cache 151 # populate parent id cache
151 if not rev.parent_ids: 152 if not rev.parent_ids: