Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.7, 0.7.1, and 0.7.2

status: avoid keeping two copies of diff data in memory

cStringIO is much more efficient than the list, so this should improve memory
behavior

Changeset bb37ae30b808

Parent 3d9bc7d3ba59

by Steve Borho

Changes to one file · Browse files at bb37ae30b808 Showing diff from parent 3d9bc7d3ba59 Diff from another changeset...

Change 1 of 1 Show Entire File hggtk/​status.py Stacked
 
913
914
915
916
917
918
919
920
921
922
923
 
924
925
 
 
 
 
 
 
 
926
927
928
 
913
914
915
 
 
 
 
 
 
 
 
916
917
 
918
919
920
921
922
923
924
925
926
927
@@ -913,16 +913,15 @@
    def dohgdiff():   self.diff_model.clear() - difflines = [] - if len(files) != 0: - wfiles = [self.repo.wjoin(x) for x in files] - matcher = cmdutil.match(self.repo, wfiles, self.opts) - diffopts = mdiff.diffopts(git=True, nodates=True) - for s in patch.diff(self.repo, self._node1, self._node2, - match=matcher, opts=diffopts): - difflines.extend(s.splitlines(True)) + difftext = cStringIO.StringIO()   try: - difftext = cStringIO.StringIO(''.join(difflines)) + if len(files) != 0: + wfiles = [self.repo.wjoin(x) for x in files] + matcher = cmdutil.match(self.repo, wfiles, self.opts) + diffopts = mdiff.diffopts(git=True, nodates=True) + for s in patch.diff(self.repo, self._node1, self._node2, + match=matcher, opts=diffopts): + difftext.writelines(s.splitlines(True))   difftext.seek(0)     self._shelve_chunks = hgshelve.parsepatch(difftext)