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

wctxactions: fix menu lambda functions by building them in local scope

Closes #94

Changeset aa36eb998bc1

Parent c612b5d74548

by Steve Borho

Changes to one file · Browse files at aa36eb998bc1 Showing diff from parent c612b5d74548 Diff from another changeset...

 
67
68
69
70
71
72
73
 
 
 
 
74
75
76
 
83
84
85
86
87
88
89
 
 
 
 
90
91
92
 
67
68
69
 
 
 
 
70
71
72
73
74
75
76
 
83
84
85
 
 
 
 
86
87
88
89
90
91
92
@@ -67,10 +67,10 @@
  if t & frozenset('?') and wctx.deleted():   rmenu = QMenu(_('Was renamed from'))   for d in wctx.deleted()[:15]: - action = rmenu.addAction(hglib.tounicode(d)) - action.args = (repo, d, path) - action.run = lambda: renamefromto(*action.args) - action.triggered.connect(action.run) + def mkaction(deleted): + a = rmenu.addAction(hglib.tounicode(deleted)) + a.triggered.connect(lambda: renamefromto(repo, deleted, path)) + mkaction(d)   menu.addMenu(rmenu)   else:   make(_('&Copy...'), copy, frozenset('MC')) @@ -83,10 +83,10 @@
  files = [f for t, f in selrows if 'u' in t]   rmenu = QMenu(_('Restart merge with'))   for tool in hglib.mergetools(repo.ui): - action = rmenu.addAction(tool) - action.args = (tool, repo, files) - action.run = lambda: resolve_with(*action.args) - action.triggered.connect(action.run) + def mkaction(rtool): + a = rmenu.addAction(hglib.tounicode(rtool)) + a.triggered.connect(lambda: resolve_with(rtool, repo, files)) + mkaction(tool)   menu.addMenu(rmenu)   return menu.exec_(point)