[Bug 5515] New: zsh completion: after abbreviation 'bo' for 'bookmarks' the wrong set of completions is offered.

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Mon Mar 27 03:21:50 EDT 2017


https://bz.mercurial-scm.org/show_bug.cgi?id=5515

            Bug ID: 5515
           Summary: zsh completion: after abbreviation 'bo' for
                    'bookmarks' the wrong set of completions is offered.
           Product: Mercurial
           Version: 4.1.1
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: third-party
          Assignee: bugzilla at mercurial-scm.org
          Reporter: mtietze at gmx.com
                CC: mercurial-devel at mercurial-scm.org

Hi, 

Summary:
I use zsh completion provided in contrib/.
A minor issue I found is when using the abbreviation 'bo' for 'bookmarks'
the set of completions offered are the 'global' ones instead of the 
'bookmarks'-specific ones.

Example:
when typing
$ hg bo --re<TAB>
it completes to
$ hg bo --repository=

Instead it should offer the same completions as when using 'bookmark'
$ hg bookmark --re<TAB>
 -- option --
--rename      -- rename a given bookmark
--repository  -- repository root directory
--rev         -- revision

Analysis:
In
https://www.mercurial-scm.org/repo/hg-stable/file/ed5b25874d99/contrib/zsh_completion
it goes wrong in lines 96/97:
In l.96 it searches for 'bo*' from the front of the list of all command
finding 'bookmarks'.
In the condition in l.97 it compares the previously found match with the first
match starting from the back of the list of all commands ('bookmark'). The 
condition is therefore not fulfilled and the original command ('bo') is not
replaced with 'bookmarks'. This leads to the completion offering the 'normal'
completions in l.122/123. 

To me it is not obvious why the implementation uses once the first match from 
the start the list of all commands and once from the end. Using the always
the first one works for me in my daily work but I do not know enough about
Mercurial to be sure that this is the way to go.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list