[PATCH] Added 'rebase' command support into bash_completion

Kevin Bullock kbullock+mercurial at ringworld.org
Fri Aug 31 12:30:51 CDT 2012


On 31 Aug 2012, at 12:21 PM, Kevin Bullock wrote:

> On 31 Aug 2012, at 10:19 AM, Dmitry Oksenchuk wrote:
> 
>> # HG changeset patch
>> # User Dmitry Oksenchuk <dmitryok at cqg.com>
>> # Date 1346426334 -14400
>> # Node ID b1043234a431b81a8556475b45290b40cd7bb24d
>> # Parent  fc14953e8e34667181cd0d492825342b5e1e880b
>> Added 'rebase' command support into bash_completion.
>> 
>> diff -r fc14953e8e34 -r b1043234a431 contrib/bash_completion
>> --- a/contrib/bash_completion	Tue Aug 28 17:59:08 2012 -0500
>> +++ b/contrib/bash_completion	Fri Aug 31 19:18:54 2012 +0400
>> @@ -235,7 +235,7 @@
>> 	    fi
>> 	    _hg_labels
>> 	;;
>> -	manifest|update)
>> +	manifest|update|rebase)
> 
> Unfortunately this won't work right. The rebase command only takes a rev with one of the -s, -d, or -b options, so the completion needs to be a little bit smarter.

Okay, to clarify, it *will* work, but it will also generate incorrect completions. We should instead define a _hg_cmd_rebase function that checks to see if the current completion is after one of the aforementioned options. This works for me:

function _hg_cmd_rebase() {
    if [[ "$prev" = @(-s|--source|-d|--dest|-b|--base|-r|--rev) ]]; then
        _hg_labels
        return
    fi
}

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list