Commits

Steve Borho  committed 315aae1

status: prevent traceback on diff failure

difftext.close() was failing in the finally clause because
difftext starts out life as a list instead of a cStringIO.
I renamed the initial list to difflines and moved the patch
iterator out of the try: finally: scope

  • Participants
  • Parent commits 6791db9

Comments (0)

Files changed (1)

File hggtk/status.py

 
         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))
             try:
-                difftext = []
-                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.extend(s.splitlines(True))
-                difftext = cStringIO.StringIO(''.join(difftext))
+                difftext = cStringIO.StringIO(''.join(difflines))
                 difftext.seek(0)
 
                 self._shelve_chunks = hgshelve.parsepatch(difftext)