[PATCH STABLE] py3: fix formatting of LookupError for workingctx

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH STABLE] py3: fix formatting of LookupError for workingctx

Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara <[hidden email]>
# Date 1599980363 -32400
#      Sun Sep 13 15:59:23 2020 +0900
# Branch stable
# Node ID 63842da54dde663b9227ca4c5e7615649073303c
# Parent  d4a83a7d132ace8e3cfe366d9ef56fb99f26ffab
py3: fix formatting of LookupError for workingctx

Spotted while writing broken tests for "hg grep -fr'wdir()'".
basectx._fileinfo() raises ManifestLookupError(self._node, ..), but _node
of the workingctx is None for historical reasons.

diff --git a/mercurial/error.py b/mercurial/error.py
--- a/mercurial/error.py
+++ b/mercurial/error.py
@@ -73,7 +73,10 @@ class LookupError(RevlogError, KeyError)
             from .node import short
 
             name = short(name)
-        RevlogError.__init__(self, b'%s@%s: %s' % (index, name, message))
+        # if name is a binary node, it can be None
+        RevlogError.__init__(
+            self, b'%s@%s: %s' % (index, pycompat.bytestr(name), message)
+        )
 
     def __bytes__(self):
         return RevlogError.__bytes__(self)
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH STABLE] py3: fix formatting of LookupError for workingctx

Pulkit Goyal
On Sun, Sep 13, 2020 at 2:02 PM Yuya Nishihara <[hidden email]> wrote:

>
> # HG changeset patch
> # User Yuya Nishihara <[hidden email]>
> # Date 1599980363 -32400
> #      Sun Sep 13 15:59:23 2020 +0900
> # Branch stable
> # Node ID 63842da54dde663b9227ca4c5e7615649073303c
> # Parent  d4a83a7d132ace8e3cfe366d9ef56fb99f26ffab
> py3: fix formatting of LookupError for workingctx
>
> Spotted while writing broken tests for "hg grep -fr'wdir()'".
> basectx._fileinfo() raises ManifestLookupError(self._node, ..), but _node
> of the workingctx is None for historical reasons.

Queued for stable, many thanks!
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel