# HG changeset patch
# User Matt Harbison <
matt_h...@yahoo.com>
# Date 1691962091 14400
# Sun Aug 13 17:28:11 2023 -0400
# Branch stable
# Node ID 2cbbab6928594f9003c57bb083902a38243770a9
# Parent 9e63cbbba0ee735f27403f4ec839c5f2135e8806
repowidget: restore applying MQ patches with a double click (fixes #5924)
Back in the python2 days, this did an `isinstance` check against `basestring`,
which could be either bytes or unicode. 70ea875f3f83 introduced `isbasestring`
for py3 support. While most of its users are happy with unicode, the MQ patch
names are bytes (from `
repo.mq` in core). Therefore, double clicking attempted
a visual diff, `visdiff.visualdiff` caught a `LookupError` or `RepoError`, and
put up a nonsense messagebox that the application needs to be refreshed.
It looks like double clicking a normal revision or an applied patch causes an
`int` to be passed in here. I'm not sure that this would ever be `str`, but
let's just restore the status quo.
Double clicking `qparent` unapplies the patch, which seems a little inconistent,
but that appears to be the intended behavior.
diff --git a/tortoisehg/hgqt/repowidget.py b/tortoisehg/hgqt/repowidget.py
--- a/tortoisehg/hgqt/repowidget.py
+++ b/tortoisehg/hgqt/repowidget.py
@@ -1017,7 +1017,7 @@
def onRevisionActivated(self, rev):
qgoto = False
- if hglib.isbasestring(rev):
+ if isinstance(rev, (bytes, str)):
qgoto = True
else:
ctx = self.repo[rev]