Edgewall Software

Opened 4 years ago

Closed 9 months ago

#12176 closed enhancement (fixed)

MercurialConnector should log the import errors

Reported by: anonymous Owned by: Jun Omae
Priority: normal Milestone: plugin - mercurial
Component: plugin/mercurial Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Log import errors.

API Changes:


If the Browse Source main item is not shown because get_real_repositories() no errors are logged.

With the mercurial plugin it's hard to figure out why it's not working. Nowhere is it logged if the mercurial module can not be imported.

Attachments (0)

Change History (4)

comment:1 by Jun Omae, 4 years ago

Component: version controlplugin/mercurial
Milestone: plugin - mercurial

TracMercurial should log the import errors, not IRepositoryConnector component.

comment:2 by Jun Omae, 4 years ago

Owner: set to Jun Omae
Status: newassigned
Summary: Log IRepositoryConnector errorMercurialConnector should log the import errors
  • tracext/hg/backend.py

    diff -r 7be798c48b82 tracext/hg/backend.py
    a b  
    118118    has_phasestr = None
    120120except ImportError, e:
    121     hg_import_error = e
     121    hg_import_error = exception_to_unicode(e)
    122122    ui = object
    391391        locale_dir = pkg_resources.resource_filename(__name__, 'locale')
    392392        add_domain(self.env.path, locale_dir)
    393393        self._version = self._version_info = None
    394         if not hg_import_error:
     394        if hg_import_error:
     395            self.log.warn('Failed to load Mercurial bindings (%s)',
     396                          hg_import_error)
     397        else:
    395398            try:
    396399                from mercurial.version import get_version
    397400                self._version = get_version()

After the patch, the following warning would be logged.

11:00:43 PM Trac[backend] WARNING: Failed to load Mercurial bindings (ImportError: No module named mercurial)
Last edited 4 years ago by Jun Omae (previous) (diff)

comment:3 by Jun Omae, 3 years ago

#11911 was closed as duplicate.

comment:4 by Peter Suter, 9 months ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Pushed changes from comment:2 in [59/mercurial-plugin].

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Jun Omae.
The resolution will be deleted.
to The owner will be changed from Jun Omae to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.