Edgewall Software
Modify

Opened 7 years ago

Closed 7 years ago

#11864 closed defect (fixed)

[git] trac_user_rlookup is ineffective with cached repository

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.0.3
Component: plugin/git Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Improved documentation for [git] trac_user_rlookup.

API Changes:
Internal Changes:

Description

The [git] trac_user_rlookup has not effect when [git] cached_repository is true.

Attachments (0)

Change History (7)

comment:1 by Jun Omae, 7 years ago

Works for me….

$ git --git-dir /dev/shm/tmp/t11864-git/.git show e370d900fa0a0b9c67b23e1ea0b53b7c28bdb376 | head -3
commit e370d900fa0a0b9c67b23e1ea0b53b7c28bdb376
Author: jomae <jun66j5@gmail.com>
Date:   Thu Dec 4 03:59:19 2014 +0900
Trac [/dev/shm/tmp/t11864]> session list

SID                 Auth  Last Visit  Name      Email
-----------------------------------------------------------------
rlookuped-username  1     2014-12-05  Jun Omae  jun66j5@gmail.com

Trac [/dev/shm/tmp/t11864]> config get git cached_repository
enabled
Trac [/dev/shm/tmp/t11864]> config get git trac_user_rlookup
enabled
Trac [/dev/shm/tmp/t11864]> repository list

Name       Type  Alias  Directory
-----------------------------------------------
(default)  git          /dev/shm/tmp/t11864-git

Trac [/dev/shm/tmp/t11864]> repository resync ''
Resyncing repository history for (default)...
10494 revisions cached.29c0c9bc1cd9c451b13]
Done.
$ sqlite3 /dev/shm/tmp/t11864/db/trac.db
sqlite> .mode line
sqlite> select * from revision where rev='e370d900fa0a0b9c67b23e1ea0b53b7c28bdb376';
  repos = 1
    rev = e370d900fa0a0b9c67b23e1ea0b53b7c28bdb376
   time = 1417633159000000
 author = rlookuped-username
message = [#11503] 1.0.3dev: fixed raising `UnicodeDecodeError` when url has no handler and unicode characters with trailing slash

comment:2 by Jun Omae, 7 years ago

After disabling [git] trac_user_rlookup and syncing the commit, its git author is stored in revision.author with no changes.

Trac [/dev/shm/tmp/t11864]> config get git trac_user_rlookup
disabled
Trac [/dev/shm/tmp/t11864]> repository sync '' e370d900fa0a0b9c67b23e1ea0b53b7c28bdb376
e370d900fa0a0b9c67b23e1ea0b53b7c28bdb376 resynced on (default).
Trac [/dev/shm/tmp/t11864]>
$ sqlite3 /dev/shm/tmp/t11864/db/trac.db
SQLite version 3.7.9 2011-11-01 00:52:41
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .mode line
sqlite> select * from revision where rev='e370d900fa0a0b9c67b23e1ea0b53b7c28bdb376';
  repos = 1
    rev = e370d900fa0a0b9c67b23e1ea0b53b7c28bdb376
   time = 1417633159000000
 author = jomae <jun66j5@gmail.com>
message = [#11503] 1.0.3dev: fixed raising `UnicodeDecodeError` when url has no handler and unicode characters with trailing slash

in reply to:  2 ; comment:3 by Ryan J Ollos, 7 years ago

Replying to jomae:

After disabling [git] trac_user_rlookup and syncing the commit, its git author is stored in revision.author with no changes.

You are right, it works. I was expecting the lookup to occur dynamically regardless of whether the changeset is cached or not. Just changing trac_user_rlookup from falsetrue is not enough, the repository must be resynced.

Since the replaced username is saved in the Revision table, the option documentation that states costly if you have many users seem slightly misleading because while it might slow down the sync, it shouldn't slow down any of the views, right? I'm assuming costly implies that requests might be slower.

Last edited 7 years ago by Ryan J Ollos (previous) (diff)

in reply to:  3 comment:4 by Jun Omae, 7 years ago

You are right, it works. I was expecting the lookup to occur dynamically regardless of whether the changeset is cached or not. Just changing trac_user_rlookup from falsetrue is not enough, the repository must be resynced.

Okay. I understand this issue.

Since the replaced username is saved in the Revision table, the option documentation that states costly if you have many users seem slightly misleading because while it might slow down the sync, it shouldn't slow down any of the views, right? I'm assuming costly implies that requests might be slower.

Enabling the option on cached repository would lead slowness of sync. Because usernames and emails are retrieved from sessions using Environment.get_known_users().

If the option is disabled and cached_repository is enabled, I suppose that requests wouldn't be slow because GitCachedChangeset.author property just returns revision.author column with no changes. But if cached_repository is disabled, requests would be very slow because GitChangeset.author property calls git cat-file and Environment.get_known_user() every time.

comment:5 by Ryan J Ollos, 7 years ago

Thanks, I'll propose a documentation patch before closing this ticket.

comment:6 by Ryan J Ollos, 7 years ago

Milestone: next-dev-1.1.x1.0.3
Owner: set to Ryan J Ollos
Status: newassigned

Proposed patch:

  • tracopt/versioncontrol/git/git_fs.py

    diff --git a/tracopt/versioncontrol/git/git_fs.py b/tracopt/versioncontrol/git/g
    index 9a28f63..9924587 100644
    a b class GitConnector(Component):  
    282282        """)
    283283
    284284    trac_user_rlookup = BoolOption('git', 'trac_user_rlookup', 'false',
    285         """Enable reverse mapping of git email addresses to trac user ids
    286         (costly if you have many users).""")
     285        """Enable reverse mapping of git email addresses to trac user ids.
     286        Performance will be reduced if there are many users and the
     287        `cached_repository` option is `disabled`.
     288
     289        A repository resync is required after changing the value of this
     290        option.
     291        """)
    287292
    288293    use_committer_id = BoolOption('git', 'use_committer_id', 'true',
    289294        """Use git-committer id instead of git-author id for the

comment:7 by Ryan J Ollos, 7 years ago

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

Committed to 1.0-stable in [13467], merged to trunk in [13468].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos 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.