[PATCH hg-experimental-ext] chistedit: fail only when attempting to run if curses is not found

Jun Wu quark at fb.com
Tue May 23 02:02:41 EDT 2017


Pushed. Thanks!

Excerpts from Martin von Zweigbergk's message of 2017-05-22 22:17:49 -0700:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1495516223 25200
> #      Mon May 22 22:10:23 2017 -0700
> # Node ID 53bbe5f3591b2fde3aba487b8d548f44d49478d4
> # Parent  e32ef07e0de21267a964a3298e3144701a6a98e7
> chistedit: fail only when attempting to run if curses is not found
> 
> If curses is not available, we can still be nice and not fail until
> the user actually tries to run the chistedit command.
> 
> diff --git a/hgext3rd/chistedit.py b/hgext3rd/chistedit.py
> --- a/hgext3rd/chistedit.py
> +++ b/hgext3rd/chistedit.py
> @@ -43,7 +43,7 @@
>  try:
>      import curses
>  except ImportError:
> -    print("Python curses library required", file=sys.stderr)
> +    curses = None
>  
>  KEY_LIST = ['pick', 'edit', 'fold', 'drop', 'mess', 'roll']
>  ACTION_LABELS = {
> @@ -548,6 +548,9 @@
>      """Provides a ncurses interface to histedit. Press ? in chistedit mode
>      to see an extensive help. Requires python-curses to be installed."""
>  
> +    if curses is None:
> +        raise error.Abort(_("Python curses library required"))
> +
>      # disable color
>      ui._colormode = None
>  


More information about the Mercurial-devel mailing list