[PATCH] allow hash-copy to clipboard to be configured; change default to off

5 views
Skip to first unread message

Steve Borho

unread,
Jul 12, 2021, 2:11:16 PM7/12/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 85d79894cb6b82f4e6136190f141e53c5bc0b412
# Parent c2bde63d7559abba0a2ccbe82ef3ccc13cb2d9f4
allow hash-copy to clipboard to be configured; change default to off

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

diff -r c2bde63d7559 -r 85d79894cb6b tortoisehg/hgqt/repoview.py
--- a/tortoisehg/hgqt/repoview.py Fri Jul 09 19:05:11 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', 'copy_hash_selection'):
+ self.clicked.connect(self._copyHashToSelection)

@property
def repo(self):
@@ -321,7 +322,7 @@
def context(self, rev):
return self.repo[rev]

- def revClicked(self, index):
+ def _copyHashToSelection(self, index):
rev = self.revFromindex(index)
if rev is not None:
clip = QApplication.clipboard()
diff -r c2bde63d7559 -r 85d79894cb6b tortoisehg/hgqt/settings.py
--- a/tortoisehg/hgqt/settings.py Fri Jul 09 19:05:11 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 Selection'), 'tortoisehg.copy_hash_selection',
+ genBoolRBGroup,
+ _('When a revision is selected in Workbench, copy hash to primary '
+ 'selection clipboard (X11). Default: False')),
)),
({'name': 'commit', 'label': _('Commit', 'config item'), 'icon': 'hg-commit'},
(

Yuya Nishihara

unread,
Jul 13, 2021, 6:57:44 AM7/13/21
to thg...@googlegroups.com, Steve Borho
On Mon, 12 Jul 2021 13:10:45 -0500, Steve Borho wrote:
> # HG changeset patch
> # User Steve Borho <st...@borho.org>
> # Date 1624898843 18000
> # Mon Jun 28 11:47:23 2021 -0500
> # Node ID 85d79894cb6b82f4e6136190f141e53c5bc0b412
> # Parent c2bde63d7559abba0a2ccbe82ef3ccc13cb2d9f4
> allow hash-copy to clipboard to be configured; change default to off

Queued, thanks.

> + if repoagent.configBool('tortoisehg', 'copy_hash_selection'):

Updated configitems.py in flight to silence the devel-warn.
Reply all
Reply to author
Forward
0 new messages