# HG changeset patch # User Matt Harbison # Date 1360209249 18000 # Node ID ca480d710fe6c711364e9554cc655d00bb1ee059 # Parent c31b8dc9de679ff7b7603012a1c24f29cda4de7d subrepo: chain the original exception to SubrepoAbort The tracebacks in subrepos are truncated at the point where the original exception is caught and SubrepoAbort is raised in its place since 9e3910db4e78. That hides the most relevant subrepo methods when an error occurs. Python 2.x doesn't support chaining exceptions, so it is manually done here for manual printing later. diff -r c31b8dc9de67 -r ca480d710fe6 mercurial/subrepo.py --- a/mercurial/subrepo.py Mon Apr 15 01:41:47 2013 +0200 +++ b/mercurial/subrepo.py Wed Feb 06 22:54:09 2013 -0500 @@ -5,7 +5,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -import errno, os, re, xml.dom.minidom, shutil, posixpath +import errno, os, re, xml.dom.minidom, shutil, posixpath, sys import stat, subprocess, tarfile from i18n import _ import config, scmutil, util, node, error, cmdutil, bookmarks, match as matchmod @@ -41,6 +41,7 @@ def __init__(self, *args, **kw): error.Abort.__init__(self, *args, **kw) self.subrepo = kw.get('subrepo') + self.cause = kw.get('cause') def annotatesubrepoerror(func): def decoratedmethod(self, *args, **kargs): @@ -53,7 +54,8 @@ subrepo = subrelpath(self) errormsg = str(ex) + ' ' + _('(in subrepo %s)') % subrepo # avoid handling this exception by raising a SubrepoAbort exception - raise SubrepoAbort(errormsg, hint=ex.hint, subrepo=subrepo) + raise SubrepoAbort(errormsg, hint=ex.hint, subrepo=subrepo, + cause=sys.exc_info()) return res return decoratedmethod