Patchwork [v2] bashcompletion: allow skipping completion for 'hg status'

login
register
mail settings
Submitter Mathias De Maré
Date Oct. 17, 2016, 7:14 a.m.
Message ID <b1a58a479b5af23c7224.1476688499@waste.org>
Download mbox | patch
Permalink /patch/17151/
State Accepted
Headers show

Comments

Mathias De Maré - Oct. 17, 2016, 7:14 a.m.
# HG changeset patch
# User Mathias De Maré <mathias.de_mare@nokia.com>
# Date 1474879657 -7200
#      Mon Sep 26 10:47:37 2016 +0200
# Node ID b1a58a479b5af23c7224b58413477daa007728e0
# Parent  1779dde4c9ef97cb242f8d501655f236f66e5439
bashcompletion: allow skipping completion for 'hg status'

On systems with large repositories and slow disks,
the calls to 'hg status' make autocomplete annoyingly slow.
This fix makes it possible to avoid the slowdown.
Yuya Nishihara - Oct. 17, 2016, 2:43 p.m.
On Mon, 17 Oct 2016 02:14:59 -0500, Mathias De Maré wrote:
> # HG changeset patch
> # User Mathias De Maré <mathias.de_mare@nokia.com>
> # Date 1474879657 -7200
> #      Mon Sep 26 10:47:37 2016 +0200
> # Node ID b1a58a479b5af23c7224b58413477daa007728e0
> # Parent  1779dde4c9ef97cb242f8d501655f236f66e5439
> bashcompletion: allow skipping completion for 'hg status'
> 
> On systems with large repositories and slow disks,
> the calls to 'hg status' make autocomplete annoyingly slow.
> This fix makes it possible to avoid the slowdown.

Queued this. Thanks for updating the commit message.

Patch

diff --git a/contrib/bash_completion b/contrib/bash_completion
--- a/contrib/bash_completion
+++ b/contrib/bash_completion
@@ -89,9 +89,11 @@ 
 
 _hg_status()
 {
-    local files="$(_hg_cmd status -n$1 "glob:$cur**")"
-    local IFS=$'\n'
-    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur"))
+    if [ -z "$HGCOMPLETE_NOSTATUS" ]; then
+        local files="$(_hg_cmd status -n$1 "glob:$cur**")"
+        local IFS=$'\n'
+        COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur"))
+    fi
 }
 
 _hg_branches()