Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.0, 2.0.1, and 2.0.2

stable wctxactions: Add 'Copy patch' context menu option for working directory files.

Changeset 4885a3836e6c

Parent 66d9445c8c46

by Waqas Hussain

Changes to one file · Browse files at 4885a3836e6c Showing diff from parent 66d9445c8c46 Diff from another changeset...

 
15
16
17
18
 
19
20
21
 
43
44
45
 
46
47
48
 
134
135
136
 
 
 
 
 
 
 
 
 
 
 
 
 
137
138
139
 
15
16
17
 
18
19
20
21
 
43
44
45
46
47
48
49
 
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
@@ -15,7 +15,7 @@
 from tortoisehg.hgqt.i18n import _    from PyQt4.QtCore import Qt -from PyQt4.QtGui import QAction, QMenu, QMessageBox, QFileDialog, QDialog +from PyQt4.QtGui import *    def wctxactions(parent, point, repo, selrows):   if not selrows: @@ -43,6 +43,7 @@
  menu = QMenu(parent)   parent.contextmenu = menu   make(_('&Visual Diff'), vdiff, frozenset('MAR!')) + make(_('Copy patch'), copyPatch, frozenset('MAR!'))   make(_('Edit'), edit, frozenset('MACI?'))   make(_('View missing'), viewmissing, frozenset('R!'))   if len(repo.parents()) > 1: @@ -134,6 +135,19 @@
  repo[None].copy(deleted, unknown)   repo[None].remove([deleted], unlink=False) # !->R   +def copyPatch(parent, ui, repo, files): + ui.pushbuffer() + try: + commands.diff(ui, repo, *files) + except Exception, e: + ui.popbuffer() + if 'THGDEBUG' in os.environ: + import traceback + traceback.print_exc() + return + output = ui.popbuffer() + QApplication.clipboard().setText(output) +  def vdiff(parent, ui, repo, files):   dlg = visdiff.visualdiff(ui, repo, files, {})   if dlg: