Modify

Opened 7 years ago

Closed 7 years ago

#12927 closed enhancement (fixed)

Suggest shortrev instead of full hash.

Reported by: Peter Suter Owned by: Peter Suter
Priority: normal Component: WikiAutoCompletePlugin
Severity: normal Keywords:
Cc: Trac Release:

Description

Suggesting the shortrev is more convenient.

Also suggest it for log:reponame@.

  • wikiautocomplete/web_ui.py

    diff -r d34b18bfc55a -r fb04791b695e wikiautocomplete/web_ui.py
    a b  
    127127        elif strategy == 'source':
    128128            rm = RepositoryManager(self.env)
    129129            completions = []
    130             if term.find('/') == -1:
     130            if term.find('/') == -1 and term.find('@') == -1:
    131131                for reponame, repoinfo in rm.get_all_repositories().iteritems():
    132132                    if 'BROWSER_VIEW' in req.perm(Resource('repository', reponame)):
    133133                        if len(term) == 0 or reponame.lower().startswith(term.lower()):
    134134                            completions.append(reponame+'/')
    135135            else:
    136                 reponame, path = term.split('/', 1)
     136                pos = term.find('/')
     137                if pos == -1:
     138                    pos = term.find('@')
     139                reponame, path = term[:pos], term[pos:]
    137140                repos = rm.get_repository(reponame)
    138141                if repos is not None:
    139142                    if path.find('@') != -1:
     
    141144                        node = repos.get_node(path, repos.youngest_rev)
    142145                        if node.can_view(req.perm):
    143146                            for r in node.get_history(10):
    144                                 if str(r[1]).startswith(search_rev):
    145                                     completions.append('%s/%s@%s' % (reponame, path, r[1]))
     147                                rev = repos.short_rev(r[1])
     148                                if str(rev).startswith(search_rev):
     149                                    completions.append('%s%s@%s' % (reponame, path, rev))
    146150                    else:
    147                         if path.find('/') != -1:
    148                             dir, filename = path.rsplit('/', 1)
    149                         else:
    150                             dir, filename = '/', path
     151                        dir, filename = path.rsplit('/', 1)
     152                        if dir == '':
     153                            dir = '/'
    151154                        node = repos.get_node(dir, repos.youngest_rev)
    152155                        completions = ['%s/%s%s' % (reponame, n.path, '/' if n.isdir else '')
    153156                                       for n in node.get_entries()

Attachments (0)

Change History (2)

comment:1 Changed 7 years ago by Peter Suter

In 15954:

WikiAutoCompletePlugin: Also suggest revision for just log:reponame@ without sub-path.
And instead of suggesting the full revision, just suggest the shortrev. That seems more convenient usually.
(see #12927)

comment:2 Changed 7 years ago by Peter Suter

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Peter Suter.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.