Commits

Steve Borho committed e677dec

changeset: copy hash to clipboard is now optional, default: False

Comments (0)

Files changed (2)

hggtk/changeset.py

         # TODO: Add toggle for gmtime/localtime
         eob = buf.get_end_iter()
         date = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(ctx.date()[0]))
-        self.clipboard.set_text(short(ctx.node()))
+        if self.clipboard:
+            self.clipboard.set_text(short(ctx.node()))
         change = str(rev) + ':' + short(ctx.node())
         tags = ' '.join(ctx.tags())
         parents = self.parents
         return _menu
 
     def get_body(self):
-        sel = (os.name == 'nt') and 'CLIPBOARD' or 'PRIMARY'
-        self.clipboard = gtk.Clipboard(selection=sel)
+        if self.repo.ui.configbool('tortoisehg', 'copyhash'):
+            sel = (os.name == 'nt') and 'CLIPBOARD' or 'PRIMARY'
+            self.clipboard = gtk.Clipboard(selection=sel)
+        else:
+            self.clipboard = None
         self._filemenu = self.file_context_menu()
 
         details_frame = gtk.Frame()

hggtk/thgconfig.py

                 ('Log Batch Size', 'tortoisehg.graphlimit', ['500'],
                     'The number of revisions to read and display in the'
                     ' changelog viewer in a single batch. Default: 500'),
+                ('Copy Hash', 'tortoisehg.copyhash', ['False', 'True'],
+                    'Allow the changelog viewer to copy hash of currently'
+                    ' selected changeset into the clipboard. Default: False'),
                 ('Overlay Icons', 'tortoisehg.overlayicons',
                     ['False', 'True', 'localdisks'],
                     'Display overlay icons in Explorer windows.'
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.