Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

Merge with stable

Changeset 602d012a678e

Parents 9ba2ff2d944a

Parents 9592a5ea3c41

by Steve Borho

Changes to 9 files · Browse files at 602d012a678e Showing diff from parent 9ba2ff2d944a 9592a5ea3c41 Diff from another changeset...

 
628
629
630
 
631
632
633
 
628
629
630
631
632
633
634
@@ -628,6 +628,7 @@
  self.commitButtonEnable.emit(True)   self.repo.decrementBusyCount()   if ret == 0: + self.branchop = None   umsg = self.msgte.text()   if umsg:   self.addMessageToHistory(umsg)
 
626
627
628
 
 
 
629
630
631
 
626
627
628
629
630
631
632
633
634
@@ -626,6 +626,9 @@
  olddata = ctx.p1()[wfile].data()   if '\0' in olddata:   self.error = 'binary file' + elif len(olddata) > ctx._repo.maxdiff: + p = _('File or diffs not displayed: ') + self.error = p + _('File is larger than the specified max size.\n')   else:   self.contents = hglib.tounicode(olddata)   self.flabel += _(' <i>(was deleted)</i>')
 
226
227
228
229
230
 
231
232
233
 
458
459
460
461
 
 
 
 
 
 
462
463
464
 
226
227
228
 
 
229
230
231
232
 
457
458
459
 
460
461
462
463
464
465
466
467
468
@@ -226,8 +226,7 @@
  def stopClicked(self):   if self.thread and self.thread.isRunning():   self.thread.cancel() - if self.thread.wait( 2000 ): - self.thread = None + self.thread.wait(2000)     def keyPressEvent(self, event):   if event.key() == Qt.Key_Escape: @@ -458,7 +457,12 @@
  count += 1   if not matchfn(wfile):   continue - data = ctx[wfile].data() # load file data + try: + data = ctx[wfile].data() # load file data + except EnvironmentError: + self.showMessage.emit(_('Skipping %s, unable to read') % + hglib.tounicode(wfile)) + continue   if util.binary(data):   continue   for i, line in enumerate(data.splitlines()):
 
41
42
43
44
45
 
46
47
48
 
109
110
111
112
113
 
114
115
116
117
118
 
136
137
138
139
140
 
141
142
143
 
41
42
43
 
 
44
45
46
47
 
108
109
110
 
 
111
112
 
113
114
115
 
133
134
135
 
 
136
137
138
139
@@ -41,8 +41,7 @@
  settings = opts['settings']   slist = settings.value('settings/'+opts['cpath']).toStringList()   self.previous = [s for s in slist if s] - self.setFixedWidth(ENTRY_WIDTH) - + self.setMinimumWidth(ENTRY_WIDTH)   def resetList(self):   self.clear()   ucur = hglib.tounicode(self.curvalue) @@ -109,10 +108,8 @@
  self.opts = opts   self.curvalue = None   self.setEchoMode(QLineEdit.Password) - self.setFixedWidth(ENTRY_WIDTH) - + self.setMinimumWidth(ENTRY_WIDTH)   ## common APIs for all edit widgets -   def setValue(self, curvalue):   self.curvalue = curvalue   if curvalue: @@ -136,8 +133,7 @@
  cpath = self.opts['cpath']   assert cpath.startswith('tortoisehg.')   self.fname = cpath[11:] - self.setFixedWidth(ENTRY_WIDTH) - + self.setMinimumWidth(ENTRY_WIDTH)   def on_clicked(self, checked):   def newFont(font):   self.setText(font.toString())
 
151
152
153
154
 
 
155
156
 
 
157
158
159
 
151
152
153
 
154
155
156
 
157
158
159
160
161
@@ -151,9 +151,11 @@
  notify = func(parent, hu, repo, files)   o, e = hu.getdata()   if e: - QMessageBox.warning(parent, name + _(' errors'), str(e)) + QMessageBox.warning(parent, name + _(' errors'), + hglib.tounicode(str(e)))   elif o: - QMessageBox.information(parent, name + _(' output'), str(o)) + QMessageBox.information(parent, name + _(' output'), + hglib.tounicode(str(o)))   elif notify:   wfiles = [repo.wjoin(x) for x in files]   shlib.shell_notify(wfiles)
 
17
18
19
20
 
21
22
23
 
122
123
124
125
126
127
128
129
130
 
131
132
133
 
134
135
136
 
169
170
171
172
 
173
174
175
176
177
178
179
180
 
181
182
183
 
198
199
200
201
 
202
203
204
205
206
 
207
208
209
 
309
310
311
312
313
314
315
316
 
 
317
318
319
 
321
322
323
324
 
325
326
327
 
583
584
585
586
587
 
 
588
589
590
 
636
637
638
639
640
 
 
641
642
643
 
17
18
19
 
20
21
22
23
 
122
123
124
 
 
 
 
 
 
125
126
127
 
128
129
130
131
 
164
165
166
 
167
168
 
 
 
 
 
 
 
169
170
171
172
 
187
188
189
 
190
191
192
193
194
 
195
196
197
198
 
298
299
300
 
 
 
 
 
301
302
303
304
305
 
307
308
309
 
310
311
312
313
 
569
570
571
 
 
572
573
574
575
576
 
622
623
624
 
 
625
626
627
628
629
@@ -17,7 +17,7 @@
 // According to http://msdn.microsoft.com/en-us/library/bb776094%28VS.85%29.aspx  // the help texts for the commands should be reasonably short (under 40 characters)   -static MenuDescription CMenuMenuDescList[] = +static const MenuDescription CMenuMenuDescList[] =  {   {"commit", L"Commit...",   L"Commit changes in repository", @@ -122,15 +122,10 @@
 ;     -typedef std::map<UINT, MenuDescription> MenuIdCmdMap; - -static MenuDescriptionMap CMenuMenuDescMap; -static MenuIdCmdMap MenuIdMap; - -void AddMenuList(UINT idCmd, const std::string& name, MenuDescriptionMap& menuDescMap) +void CShellExtCMenu::AddMenuList(UINT idCmd, const std::string& name)  {   TDEBUG_TRACE("AddMenuList: idCmd = " << idCmd << " name = " << name); - MenuIdMap[idCmd] = menuDescMap[name]; + myMenuIdMap[idCmd] = myDescMap[name];  }     @@ -169,15 +164,9 @@
  RegCloseKey(hkey);  }   -MenuDescriptionMap& CShellExtCMenu::GetMenuDescriptionMap() +void CShellExtCMenu::InitMenuMaps(const MenuDescription *menuDescs, std::size_t sz)  { - return CMenuMenuDescMap; -} - -void CShellExtCMenu::InitMenuMaps(MenuDescription *menuDescs, std::size_t sz) -{ - MenuDescriptionMap& menuDescMap = GetMenuDescriptionMap(); - if (menuDescMap.empty()) + if (myDescMap.empty())   {   std::string lang;   GetRegistryConfig("CMenuLang", lang); @@ -198,12 +187,12 @@
  if (!lang.empty())   GetCMenuTranslation(lang, md.name, md.menuText, md.helpText);   - menuDescMap[md.name] = md; + myDescMap[md.name] = md;   }     }   - MenuIdMap.clear(); + myMenuIdMap.clear();  }     @@ -309,11 +298,8 @@
  HMENU hMenu, const std::string& name, UINT indexMenu,   UINT idCmd, UINT idCmdFirst, const std::wstring& prefix)  { - - MenuDescriptionMap& menuDescMap = GetMenuDescriptionMap(); - - MenuDescriptionMap::iterator iter = menuDescMap.find(name); - if (iter == menuDescMap.end()) + MenuDescriptionMap::iterator iter = myDescMap.find(name); + if (iter == myDescMap.end())   {   TDEBUG_TRACE("***** InsertMenuItemByName: can't find menu info for " << name);   return; @@ -321,7 +307,7 @@
      MenuDescription md = iter->second; - AddMenuList(idCmd - idCmdFirst, name, menuDescMap); + AddMenuList(idCmd - idCmdFirst, name);   InsertMenuItemWithIcon1(   hMenu, indexMenu, idCmd, prefix + md.menuText, md.iconName);  } @@ -583,8 +569,8 @@
  {   UINT idCmd = LOWORD(lpcmi->lpVerb);   TDEBUG_TRACE("CShellExtCMenu::InvokeCommand: idCmd = " << idCmd); - MenuIdCmdMap::iterator iter = MenuIdMap.find(idCmd); - if (iter != MenuIdMap.end()) + MenuIdCmdMap::iterator iter = myMenuIdMap.find(idCmd); + if (iter != myMenuIdMap.end())   {   RunDialog(iter->second.name);   hr = S_OK; @@ -636,8 +622,8 @@
  << ", cchMax = " << cchMax   );   - MenuIdCmdMap::iterator iter = MenuIdMap.find(static_cast<UINT>(idCmd)); - if (iter == MenuIdMap.end()) + MenuIdCmdMap::iterator iter = myMenuIdMap.find(static_cast<UINT>(idCmd)); + if (iter == myMenuIdMap.end())   {   TDEBUG_TRACE("***** CShellExtCMenu::GetCommandString: idCmd not found");   }
 
16
17
18
 
 
 
19
20
21
 
23
24
25
 
 
26
27
28
29
30
31
32
 
33
34
35
 
36
37
38
 
16
17
18
19
20
21
22
23
24
 
26
27
28
29
30
31
32
 
33
34
35
 
36
37
38
39
40
41
42
43
@@ -16,6 +16,9 @@
   typedef std::map<std::string, MenuDescription> MenuDescriptionMap;   +typedef std::map<UINT, MenuDescription> MenuIdCmdMap; + +  class CShellExtCMenu: public IContextMenu3, IShellExtInit  {   @@ -23,16 +26,18 @@
  ULONG m_cRef;   std::vector<std::string> myFiles;   std::string myFolder; + MenuDescriptionMap myDescMap; + MenuIdCmdMap myMenuIdMap;     virtual void RunDialog(const std::string&); - virtual MenuDescriptionMap& GetMenuDescriptionMap();     void TweakMenuForVista(HMENU menu);   void PrintDebugHeader(LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj); - void InitMenuMaps(MenuDescription *menuDescs, std::size_t sz); + void InitMenuMaps(const MenuDescription *menuDescs, std::size_t sz);   void InsertMenuItemByName(   HMENU hMenu, const std::string& name, UINT indexMenu,   UINT idCmd, UINT idCmdFirst, const std::wstring& prefix); + void AddMenuList(UINT idCmd, const std::string& name);    public:   explicit CShellExtCMenu(const char dummy);
1
2
3
4
5
6
7
8
9
10
 
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
1
2
3
4
5
6
7
8
9
 
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 
 
 
 
 
 
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
 #include "stdafx.h"  #include "TortoiseUtils.h"    #include "CShellExtDnd.h"      // According to http://msdn.microsoft.com/en-us/library/bb776094%28VS.85%29.aspx  // the help texts for the commands should be reasonably short (under 40 characters)   -static MenuDescription CDndMenuDescList[] = +static const MenuDescription CDndMenuDescList[] =  {   {"drag_move", L"Hg Move versioned item(s) here",   L"", "hg.ico", 0},   {"drag_copy", L"Hg Copy versioned item(s) here",   L"", "hg.ico", 0},   /* Add new items here */     // template   //{"", L"", L"", ".ico", 0},  };      static const char* const DropMenu =   "drag_move drag_copy"  ;   -static MenuDescriptionMap CDndMenuDescMap; - -MenuDescriptionMap& CShellExtDnd::GetMenuDescriptionMap() -{ - return CDndMenuDescMap; -}    #define ResultFromShort(i) ResultFromScode(MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i)))    // IContextMenu  STDMETHODIMP  CShellExtDnd::QueryContextMenu(   HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)  {   TDEBUG_TRACE("CShellExtDnd::QueryContextMenu");     if ((uFlags & CMF_DEFAULTONLY)!=0)   return S_OK; //we don't change the default action     if (((uFlags & 0x000f)!=CMF_NORMAL)&&(!(uFlags & CMF_EXPLORE))&&(!(uFlags & CMF_VERBSONLY)))   return S_OK;       UINT idCmd = idCmdFirst;     InitMenuMaps(CDndMenuDescList, sizeof(CDndMenuDescList) / sizeof(MenuDescription));     typedef std::vector<std::string> entriesT;   typedef entriesT::const_iterator entriesIter;     const char* entries_string = DropMenu;   entriesT entries;   Tokenize(entries_string, entries, " ");     for (entriesIter i = entries.begin(); i != entries.end(); i++)   {   std::string name = *i;   InsertMenuItemByName(   hMenu, name, indexMenu++,   idCmd++, idCmdFirst, L""   );   }     // separator   if (idCmd != idCmdFirst)   InsertMenu(hMenu, indexMenu++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL);     TweakMenuForVista(hMenu);     return ResultFromShort(idCmd - idCmdFirst);  }      void CShellExtDnd::RunDialog(const std::string &cmd)  {   if (cmd == "drag_move" || cmd == "drag_copy") {   //Append the current directory as the dest   myFiles.push_back(myFolder);   }   CShellExtCMenu::RunDialog(cmd);  }      STDMETHODIMP CShellExtDnd::Initialize(   LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj, HKEY hRegKey)  {   TCHAR name[MAX_PATH+1];     PrintDebugHeader(pIDFolder, pDataObj);     myFolder.clear();   myFiles.clear();     // if a directory background   if (pIDFolder)   {   SHGetPathFromIDList(pIDFolder, name);   TDEBUG_TRACE(" Folder " << name);   myFolder = name;   }     std::string root;     //short circuit if we're dragging into a non-Hg repository   if (myFolder.empty() || (root = GetHgRepoRoot(myFolder)).empty())   {   TDEBUG_TRACE(" drag into a non-Hg repos directory");   return E_FAIL;   }     if (pDataObj)   {   FORMATETC fmt = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };   STGMEDIUM stg = { TYMED_HGLOBAL };   if (SUCCEEDED(pDataObj->GetData(&fmt, &stg)) && stg.hGlobal)   {   HDROP hDrop = (HDROP) GlobalLock(stg.hGlobal);     if (hDrop)   {   UINT uNumFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);   TDEBUG_TRACE(" hDrop uNumFiles = " << uNumFiles);   for (UINT i = 0; i < uNumFiles; ++i) {   if (DragQueryFile(hDrop, i, name, MAX_PATH) > 0)   {   TDEBUG_TRACE(" DragQueryFile [" << i << "] = " << name);   if (GetHgRepoRoot(name) != root)   {   TDEBUG_TRACE(" " << name << " isn't in target dir repository");   myFiles.clear();   break;   }   myFiles.push_back(name);   }   }   }   else   {   TDEBUG_TRACE(" hDrop is NULL ");   }     GlobalUnlock(stg.hGlobal);   if (stg.pUnkForRelease)   {   IUnknown* relInterface = (IUnknown*) stg.pUnkForRelease;   relInterface->Release();   }   }   else   {   TDEBUG_TRACE(" pDataObj->GetData failed");   }   }     // disable context menu if neither the folder nor the files   // have been found   if (myFiles.empty()) {   TDEBUG_TRACE(" shell extension not available on this object");   return E_FAIL;   } else {   return S_OK;   }  }      CShellExtDnd::CShellExtDnd(const char dummy) :   CShellExtCMenu(dummy)  {  }      CShellExtDnd::~CShellExtDnd()  {  }
 
10
11
12
13
14
15
16
 
10
11
12
 
13
14
15
@@ -10,7 +10,6 @@
   protected:   virtual void RunDialog(const std::string&); - virtual MenuDescriptionMap& GetMenuDescriptionMap();    public:   explicit CShellExtDnd(const char dummy);