Edgewall Software
Modify

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#11180 closed defect (fixed)

Show incorrect properties if the file has unicode path in git repository

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.0.2
Component: plugin/git Version: 1.0-stable
Severity: normal Keywords: unicode
Cc: Branch:
Release Notes:

Fix incorrect property values for file with unicode path in git repository

API Changes:
Internal Changes:

Description

If a file has unicode path in a git repository, Trac shows the incorrect properties for the file.

attachment:unicode-path-in-git-repos.png

Also, in that case, Python raises the following warning.

/home/jun66j5/src/trac/edgewall/tracopt/versioncontrol/git/PyGIT.py:884: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if next_path == [path]:

Patch:

  • tracopt/versioncontrol/git/PyGIT.py

    diff --git a/tracopt/versioncontrol/git/PyGIT.py b/tracopt/versioncontrol/git/PyGIT.py
    index 5b2354e..b33991a 100644
    a b class Storage(object):  
    866866        p = []
    867867        change = {}
    868868        next_path = []
     869        base_path = self._fs_from_unicode(base_path)
    869870
    870871        def name_status_gen():
    871872            p[:] = [self.repo.log_pipe('--pretty=format:%n%H',
    class Storage(object):  
    896897        gen = name_status_gen()
    897898
    898899        def historian(path):
     900            path = self._fs_from_unicode(path)
    899901            try:
    900902                return change[path]
    901903            except KeyError:

Attachments (1)

unicode-path-in-git-repos.png (19.6 KB ) - added by Jun Omae 12 years ago.

Download all attachments as: .zip

Change History (5)

by Jun Omae, 12 years ago

comment:1 by Jun Omae, 12 years ago

Owner: set to Jun Omae
Status: newassigned

Added the patch and unit tests in log:jomae.git:ticket11180/1.0.2dev. I'll push it.

comment:2 by Jun Omae, 12 years ago

Keywords: unicode added
Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed in [11799].

comment:3 by Ryan J Ollos, 12 years ago

The test doesn't seem to like being executed on my system (Ubuntu 12.04, Trac 1.0-stable). I'll have to do some debugging after I finish my current task, but just wanted to post this now in case the issue might be obvious.

======================================================================
FAIL: test_get_historian_with_unicode_path (tracopt.versioncontrol.git.tests.PyGIT.UnicodeNameTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/user/Workspace/t11117/trac.git/tracopt/versioncontrol/git/tests/PyGIT.py", line 300, in test_get_historian_with_unicode_path
    historian))
AssertionError: '39395ca8b6d84017a7e01fec6e113f173cc4d559' != None

----------------------------------------------------------------------
Ran 1351 tests in 25.460s

FAILED (failures=1)
Exception TypeError: "'NoneType' object is not callable" in <function <lambda> at 0xd07380c> ignored
$ git --version
git version 1.7.9.5
Last edited 12 years ago by Ryan J Ollos (previous) (diff)

comment:4 by Christian Boos, 12 years ago

Well, I haven't debugged it any further, but this is also what I've reported in #11198.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
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.