[PATCH] allow hash-copy to clipboard to be disabled

6 views
Skip to first unread message

Steve Borho

unread,
Jun 28, 2021, 1:04:58 PM6/28/21
to thg...@googlegroups.com
# HG changeset patch
# User Steve Borho <st...@borho.org>
# Date 1624898843 18000
# Mon Jun 28 11:47:23 2021 -0500
# Node ID a58b2c4c2817443cd9fa9c030b780e2437f9534f
# Parent e45c1f60eb91b0fd15e43889099dd26c1c5119fc
allow hash-copy to clipboard to be disabled

diff -r e45c1f60eb91 -r a58b2c4c2817 tortoisehg/hgqt/repoview.py
--- a/tortoisehg/hgqt/repoview.py Tue Jun 01 20:28:27 2021 +0900
+++ b/tortoisehg/hgqt/repoview.py Mon Jun 28 11:47:23 2021 -0500
@@ -131,7 +131,8 @@
self.setSelectionBehavior(QAbstractItemView.SelectRows)

self.doubleClicked.connect(self.revActivated)
- self.clicked.connect(self.revClicked)
+ if repoagent.configBool('tortoisehg', 'clipboard_hash', True):
+ self.clicked.connect(self.revClicked)

@property
def repo(self):
diff -r e45c1f60eb91 -r a58b2c4c2817 tortoisehg/hgqt/settings.py
--- a/tortoisehg/hgqt/settings.py Tue Jun 01 20:28:27 2021 +0900
+++ b/tortoisehg/hgqt/settings.py Mon Jun 28 11:47:23 2021 -0500
@@ -823,6 +823,10 @@
'<b>Note</b>: This layouter colors edges using branch information '
'and does not display graft edges, regardless of whether they are '
'requested or not.')),
+ _fi(_('Copy hash to clipboard'), 'tortoisehg.clipboard_hash',
+ genBoolRBGroup,
+ _('When a revision is selected in Workbench, copy hash to clipboard. '
+ 'Default: True')),
)),
({'name': 'commit', 'label': _('Commit', 'config item'), 'icon': 'hg-commit'},
(

Mads Kiilerich

unread,
Jun 28, 2021, 4:26:05 PM6/28/21
to thg...@googlegroups.com, Steve Borho
This hash-to-clipboard feature is indeed surprising. In some cases
convenient, but for me it is more often annoying.

Is automatic hash copying a feature that is worth keeping? If so, should
it perhaps be disabled by default?

I think it would be better if hashes only were copied to clipboard when
pressing ctrl+c (perhaps after selecting the hash) or clicking a button
/ context menu.

/Mads

Steve Borho

unread,
Jun 28, 2021, 4:57:36 PM6/28/21
to Mads Kiilerich, thg...@googlegroups.com
Indeed, I meant to amend the commit before sending the email; the rest of the commit message was:

I've long found this behavior irritating; my clipboard is important to my
workflow. In those instances where I want a hash, I will copy it out of the rev
details or use the context menu


Steve Borho
st...@borho.org


PS: Hey Mads! Long time no hear.

Matt Harbison

unread,
Jun 28, 2021, 10:25:30 PM6/28/21
to TortoiseHg Developers
On Monday, June 28, 2021 at 4:57:36 PM UTC-4 Steve Borho wrote:
Indeed, I meant to amend the commit before sending the email; the rest of the commit message was:

I've long found this behavior irritating; my clipboard is important to my
workflow. In those instances where I want a hash, I will copy it out of the rev
details or use the context menu

I wasn't even aware this was a thing.  It doesn't seem to happen on Windows or macOS (with py2exe or py2app based installations).  I don't have a Linux system handy to try there.

Aay Jay Chan

unread,
Jun 28, 2021, 11:33:24 PM6/28/21
to 'Matt Harbison' via TortoiseHg Developers
On 29/06/2021 10:25, 'Matt Harbison' via TortoiseHg Developers wrote:
> I wasn't even aware this was a thing.  It doesn't seem to happen on
Windows or macOS (with py2exe or py2app based installations).  I don't
have a Linux system handy to try there.

on Linux the hash is written to primary selection (usually pasted with
middle
mouse button).  this behaviour is unexpected, and it took me a while to
figure
out why sometimes the pasted content is not what i expect it to be. i
think the
feature is unnecessary when the hash can be copied with both context
menu and
keyboard shortcut.


Yuya Nishihara

unread,
Jun 29, 2021, 6:19:52 AM6/29/21
to thg...@googlegroups.com, Aay Jay Chan, st...@borho.org
On Tue, 29 Jun 2021 11:33:20 +0800, Aay Jay Chan wrote:
> On 29/06/2021 10:25, 'Matt Harbison' via TortoiseHg Developers wrote:
> > I wasn't even aware this was a thing.  It doesn't seem to happen on
> Windows or macOS (with py2exe or py2app based installations).  I don't
> have a Linux system handy to try there.
>
> on Linux the hash is written to primary selection (usually pasted with
> middle
> mouse button).

Yep. I like this feature, but I'm fine with disabling it by default.

Anyway, primary selection isn't the clipboard which most GUI users would
expect, so better to rephrase the config name/description.

> + if repoagent.configBool('tortoisehg', 'clipboard_hash', True):
> + self.clicked.connect(self.revClicked)

Can you rename the revClicked function to e.g. _copyHashToSelection?
Reply all
Reply to author
Forward
0 new messages