Steve Borho avatar Steve Borho committed 74b5067

history, etc: add workarounds for all tracebacks reported in #969

Sadly, there were only a few actual places that needed workarounds. I should
have done this early on in 1.0. Though perhaps with these leaks plugged users
will find new ones.

Interestingly, I noticed the easiest way to reproduce the parents() problem
was to simply 'hg qref' from the command line. You wouldn't think this would
be a big deal, but it does change the hash of the top patch.

Closes #969

Comments (0)

Files changed (3)

tortoisehg/hgtk/changeset.py

 
         self._filelist.clear()
         self._filelist.append(('*', _('[All Files]'), ''))
-        modified, added, removed = self.repo.status(parent, ctx.node())[:3]
+        try:
+            modified, added, removed = self.repo.status(parent, ctx.node())[:3]
+        except error.LookupError:
+            modified, added, removed = [], [], []
         selrow = None
         for f in modified:
             if f in pats:

tortoisehg/hgtk/history.py

 
         # disable/enable menus as required
         parents = self.repo.parents()
+
         if len(parents) > 1:
             can_merge = False
             can_backout = False
         return False
 
     def tree_popup_menu(self, treeview, button=0, time=0):
+        try:
+            self.repo.parents()
+        except error.Abort, e:
+            self.stbar.set_text(_('Refresh required'))
+            return True
         menu = self.tree_context_menu()
         menu.popup(None, None, None, button, time)
         return True
 
     def tree_popup_menu_diff(self, treeview, button=0, time=0):
+        try:
+            self.repo.parents()
+        except error.Abort, e:
+            self.stbar.set_text(_('Refresh required'))
+            return True
         menu = self.tree_diff_context_menu()
         menu.popup(None, None, None, button, time)
         return True

tortoisehg/hgtk/p4pending.py

     def changelist_selected(self, combo):
         'User has selected a changelist, fill cslist'
         curcl = combo.get_active_text()
-        revs = [self.repo[hash] for hash in self.pending[curcl]]
+        try:
+            revs = [self.repo[hash] for hash in self.pending[curcl]]
+        except error.Abort, e:
+            revs = []
         self.cslist.clear()
         self.cslist.update(revs, self.repo)
         sensitive = not curcl.endswith('(submitted)')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.