Patchwork [1,of,3] error: add a new exception named WdirRevNotSupportedError

login
register
mail settings
Submitter Pulkit Goyal
Date May 19, 2017, 3:07 p.m.
Message ID <10bab5388a7f11060a76.1495206472@workspace>
Download mbox | patch
Permalink /patch/20717/
State Accepted
Headers show

Comments

Pulkit Goyal - May 19, 2017, 3:07 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1495201237 -19800
#      Fri May 19 19:10:37 2017 +0530
# Node ID 10bab5388a7f11060a76c10d28d60578b428fdb0
# Parent  67026d65a4fcea1a121930b9736469687c095e3e
error: add a new exception named WdirRevNotSupportedError

This error will be raised when we try to use the 'wdir()' revset and support
for it has not added yet.
Yuya Nishihara - May 21, 2017, noon
On Fri, 19 May 2017 20:37:52 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1495201237 -19800
> #      Fri May 19 19:10:37 2017 +0530
> # Node ID 10bab5388a7f11060a76c10d28d60578b428fdb0
> # Parent  67026d65a4fcea1a121930b9736469687c095e3e
> error: add a new exception named WdirRevNotSupportedError

general direction seems fine and is quite similar to my draft patches.
Can you include more details in commit message? (e.g. why it makes sense
to raise an exception.)

> --- a/mercurial/error.py
> +++ b/mercurial/error.py
> @@ -177,6 +177,9 @@
>  class ProgrammingError(RuntimeError):
>      """Raised if a mercurial (core or extension) developer made a mistake"""
>  
> +class WdirRevNotSupportedError(IndexError):
> +    """An exception which is raised when 'wdir()' is not supported"""

Nit: Strictly speaking, this isn't an error but an indication that a storage
class can't process wdir() so upper layer should do in place. So I would name
it WdirUnsupported or something, and make it not be inherited from IndexError.

Patch

diff --git a/mercurial/error.py b/mercurial/error.py
--- a/mercurial/error.py
+++ b/mercurial/error.py
@@ -177,6 +177,9 @@ 
 class ProgrammingError(RuntimeError):
     """Raised if a mercurial (core or extension) developer made a mistake"""
 
+class WdirRevNotSupportedError(IndexError):
+    """An exception which is raised when 'wdir()' is not supported"""
+
 # bundle2 related errors
 class BundleValueError(ValueError):
     """error raised when bundle2 cannot be processed"""