Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

merge with stable

Changeset 9d3da274f8a2

Parents 2c2a1a633735

Parents 4e02beaf36d8

by Steve Borho

Changes to 11 files · Browse files at 9d3da274f8a2 Showing diff from parent 2c2a1a633735 4e02beaf36d8 Diff from another changeset...

Change 1 of 1 Show Entire File hggtk/​hgcmd.py Stacked
 
17
18
19
20
 
 
 
 
 
 
21
22
23
 
17
18
19
 
20
21
22
23
24
25
26
27
28
@@ -17,7 +17,12 @@
   class CmdDialog(gtk.Dialog):   def __init__(self, cmdline, progressbar=True, width=520, height=400): - title = 'hg ' + ' '.join(cmdline[1:]) + if progressbar: + title = 'hg ' + ' '.join(cmdline[1:]) + else: + # use short title if progressbar is not in use. The + # calling code may not want to show the complete command + title = 'hg ' + ' '.join(cmdline[1:2])   if len(title) > 80:   title = title[:80] + '...'   title = hglib.toutf(title.replace('\n', ' '))
Show Entire File hggtk/​hgtk.py Stacked
(No changes)
Change 1 of 1 Show Entire File hggtk/​synch.py Stacked
 
453
454
455
456
 
457
458
459
 
453
454
455
 
456
457
458
459
@@ -453,7 +453,7 @@
  dlg = thgconfig.ConfigDialog(True)   dlg.show_all()   if newpath: - dlg.new_path(newpath) + dlg.new_path(newpath, 'default')   else:   dlg.focus_field('tortoisehg.postpull')   dlg.run()
 
573
574
575
576
 
577
578
579
580
581
582
583
 
 
 
 
 
584
585
586
 
655
656
657
658
 
 
659
660
661
 
573
574
575
 
576
577
578
579
 
 
 
 
580
581
582
583
584
585
586
587
 
656
657
658
 
659
660
661
662
663
@@ -573,14 +573,15 @@
  widgets[w].grab_focus()   return   - def new_path(self, newpath): + def new_path(self, newpath, alias='new'):   '''Add a new path to [paths], give default name, focus'''   i = self.pathdata.insert_before(None, None)   safepath = url.hidepassword(newpath) - alias, num = 'new', 0 - while len([row for row in self.pathdata if row[0] == alias]) > 0: - num += 1 - alias = 'new_%d' % num + if alias in [row[0] for row in self.pathdata]: + num = 0 + while len([row for row in self.pathdata if row[0] == alias]) > 0: + num += 1 + alias = 'new_%d' % num   self.pathdata.set_value(i, 0, alias)   self.pathdata.set_value(i, 1, '%s' % hglib.toutf(safepath))   self.pathdata.set_value(i, 2, '%s' % hglib.toutf(newpath)) @@ -655,7 +656,8 @@
  if testpath[0] == '~':   testpath = os.path.expanduser(testpath)   cmdline = ['hg', 'incoming', '--verbose', testpath] - dlg = hgcmd.CmdDialog(cmdline) + # Do not use progressbar, as it may show plaintext passwords + dlg = hgcmd.CmdDialog(cmdline, progressbar=False)   dlg.run()   dlg.hide()  
Change 1 of 1 Show Entire File hggtk/​update.py Stacked
 
44
45
46
47
48
 
 
49
50
51
 
44
45
46
 
 
47
48
49
50
51
@@ -44,8 +44,8 @@
  lbl = gtk.Label(_('Update to:'))   hbox.pack_start(lbl, False, False, 2)   - # revisions combo box - combo = gtk.combo_box_new_text() + # revisions editable combo box + combo = gtk.combo_box_entry_new_text()   hbox.pack_start(combo, True, True, 2)   vbox.pack_start(hbox, False, False, 10)   if rev != None:
Change 1 of 1 Show Entire File hgtk Stacked
 
46
47
48
49
50
 
 
51
52
53
 
 
54
55
56
57
58
 
 
59
60
61
 
46
47
48
 
 
49
50
51
 
 
52
53
54
55
56
 
 
57
58
59
60
61
@@ -46,16 +46,16 @@
 if not capt or 'THGDEBUG' in os.environ:   sys.exit(hggtk.hgtk.dispatch(sys.argv[1:]))  else: - import cStringIO - sys.stderr = cStringIO.StringIO() + mystderr = cStringIO.StringIO() + sys.stderr = mystderr   ret = hggtk.hgtk.dispatch(sys.argv[1:]) - sys.stderr.seek(0) - for l in sys.stderr.readlines(): + mystderr.seek(0) + for l in mystderr.readlines():   if l.startswith('Traceback') or l.startswith('TypeError'):   from hggtk.bugreport import run   from hggtk.hgtk import gtkrun - sys.stderr.seek(0) - error = 'Recoverable runtime error (stderr):\n' + sys.stderr.read() + mystderr.seek(0) + error = 'Recoverable runtime error (stderr):\n' + mystderr.read()   opts = {}   opts['cmd'] = ' '.join(sys.argv[1:])   opts['error'] = error
 
18
19
20
 
 
 
21
22
23
 
251
252
253
254
255
256
257
 
451
452
453
 
 
 
 
454
455
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
456
457
458
459
 
 
460
461
462
 
463
464
465
466
 
467
468
469
470
471
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
472
473
474
 
 
 
 
 
 
 
475
476
477
478
479
480
481
 
 
 
 
482
483
484
485
486
487
488
489
490
491
 
 
 
492
493
494
495
496
497
498
499
500
 
 
 
 
501
502
503
504
 
 
505
506
507
 
508
509
510
 
520
521
522
523
524
525
526
 
18
19
20
21
22
23
24
25
26
 
254
255
256
 
257
258
259
 
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
 
 
 
480
481
482
483
 
484
485
 
 
 
486
487
488
489
490
 
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
 
518
519
520
521
522
523
524
525
526
527
528
529
 
530
531
532
533
534
535
 
 
 
 
 
536
537
538
 
539
540
541
542
 
 
 
 
 
543
544
 
545
546
547
548
549
550
 
 
551
552
553
554
 
555
556
557
558
 
568
569
570
 
571
572
573
@@ -18,6 +18,9 @@
  UINT idCmd;  };   +// 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) +  MenuDescription menuDescList[] =  {   {"commit", "Commit...", @@ -251,7 +254,6 @@
  HMENU hMenu, const std::string& name, UINT indexMenu,   UINT idCmd, UINT idCmdFirst, const std::string& prefix)  { - TDEBUG_TRACE("InsertMenuItemByName: name = " << name);   MenuDescriptionMap::iterator iter = MenuDescMap.find(name);   if (iter == MenuDescMap.end())   { @@ -451,60 +453,106 @@
  UINT_PTR idCmd, UINT uFlags, UINT FAR *reserved,   LPSTR pszName, UINT cchMax)  { + // see http://msdn.microsoft.com/en-us/library/bb776094%28VS.85%29.aspx + + HRESULT res = S_FALSE; +   const char *psz = "";   + std::string sflags = "?"; + switch (uFlags) + { + case GCS_HELPTEXTW: + sflags = "GCS_HELPTEXTW"; break; + case GCS_HELPTEXTA: + sflags = "GCS_HELPTEXTA"; break; + case GCS_VALIDATEW: + sflags = "GCS_VALIDATEW"; break; + case GCS_VALIDATEA: + sflags = "GCS_VALIDATEA"; break; + case GCS_VERBW: + sflags = "GCS_VERBW"; break; + case GCS_VERBA: + sflags = "GCS_VERBA"; break; + } +   TDEBUG_TRACE( - "CShellExt::GetCommandString: idCmd = " << idCmd - << ", uFlags = " << uFlags - ); + "CShellExt::GetCommandString: idCmd = " << idCmd + << ", uFlags = " << uFlags << " (" << sflags << ")");     MenuIdCmdMap::iterator iter = MenuIdMap.find(static_cast<UINT>(idCmd)); - if (iter != MenuIdMap.end()) + if (iter == MenuIdMap.end())   { - TDEBUG_TRACE( - "CShellExt::GetCommandString: name = " << iter->second.name); - psz = iter->second.helpText.c_str(); + TDEBUG_TRACE("CShellExt::GetCommandString: idCmd not found");   }   else   {   TDEBUG_TRACE( - "CShellExt::GetCommandString: can't find idCmd " << idCmd); + "CShellExt::GetCommandString: name = \"" << iter->second.name << "\""); + + if (uFlags == GCS_HELPTEXTW || uFlags == GCS_HELPTEXTA) + { + psz = iter->second.helpText.c_str(); + res = S_OK; + + size_t size = iter->second.helpText.size(); + if (size >= 40) + { + TDEBUG_TRACE( + "CShellExt::GetCommandString: warning:" + << " length of help text is " << size + << ", which is not reasonably short (<40)"); + } + } + else if (uFlags == GCS_VERBW || uFlags == GCS_VERBA) + { + psz = iter->second.name.c_str(); + res = S_OK; + } + else if (uFlags == GCS_VALIDATEW || uFlags == GCS_VALIDATEA) + { + res = S_OK; + }   }   - bool copied = false; + if (cchMax < 1) + { + TDEBUG_TRACE("CShellExt::GetCommandString: cchMax = " + << cchMax << " (is <1)"); + return res; + } +   size_t size = 0;     if (uFlags & GCS_UNICODE)   {   wchar_t* const dest = reinterpret_cast<wchar_t*>(pszName); - *dest = 0;   const wchar_t* const src = _WCSTR(psz); + + wcsncpy(dest, src, cchMax-1); + *(dest + cchMax-1) = 0; +   size = wcslen(src); - if (size < cchMax) - { - wcscpy(dest, src); - copied = true; - }   }   else   { - *pszName = 0; + strncpy(pszName, psz, cchMax-1); + *(pszName + cchMax-1) = 0; +   size = strlen(psz); - if (size < cchMax) - { - strcpy(pszName, psz); - copied = true; - }   }   - if (!copied) + TDEBUG_TRACE("CShellExt::GetCommandString: res = " << res + << ", pszName = \"" << psz << "\""); + + if (size > cchMax-1)   {   TDEBUG_TRACE( - "CShellExt::GetCommandString: error: source string length (" - << size << ") exceeds target buffer size (" << cchMax << ")"); + "CShellExt::GetCommandString: string was truncated: size = " + << size << ", cchMax = " << cchMax);   }   - return NOERROR; + return res;  }     @@ -520,7 +568,6 @@
 CShellExt::HandleMenuMsg2(   UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* pResult)  { - TDEBUG_ENTER("CShellExt::HandleMenuMsg2");   // A great tutorial on owner drawn menus in shell extension can be found   // here: http://www.codeproject.com/shell/shellextguide7.asp  
 
115
116
117
118
119
120
121
122
123
124
 
125
126
 
127
128
129
 
115
116
117
 
 
 
 
 
 
 
118
119
 
120
121
122
123
@@ -115,15 +115,9 @@
    if (unset)   { - TDEBUG_TRACE("Dirstatecache::get: ignored (unset entries)"); - if (!iter->unset) - { - Thgstatus::update(cwd); - iter->unset = true; - } - return iter->dstate; + TDEBUG_TRACE("Dirstatecache::get: has unset entries");   } - iter->unset = false; + iter->unset = unset;     delete iter->dstate;   iter->dstate = ds.release();
 
233
234
235
236
237
238
 
239
240
241
242
243
 
244
245
246
247
248
 
249
250
251
252
253
 
254
255
256
257
258
 
259
260
261
262
263
 
264
265
266
267
268
269
 
233
234
235
 
 
 
236
237
238
239
 
 
240
241
242
243
 
 
244
245
246
247
 
 
248
249
250
251
 
 
252
253
254
255
 
 
256
257
 
 
258
259
260
@@ -233,37 +233,28 @@
     STDMETHODIMP CShellExt::QueryInterface(REFIID riid, LPVOID FAR* ppv) -{ - std::string clsname = "UNKNOWN CLSID"; - +{   *ppv = NULL;   if (IsEqualIID(riid, IID_IShellExtInit) || IsEqualIID(riid, IID_IUnknown))   { - *ppv = (LPSHELLEXTINIT)this; - clsname = "IID_IShellExtInit"; + *ppv = (LPSHELLEXTINIT) this;   }   else if (IsEqualIID(riid, IID_IContextMenu))   { - *ppv = (LPCONTEXTMENU)this; - clsname = "IID_IContextMenu"; + *ppv = (LPCONTEXTMENU) this;   }   else if (IsEqualIID(riid, IID_IContextMenu2))   { - *ppv = (IContextMenu2 *) this; - clsname = "IID_IContextMenu2"; + *ppv = (IContextMenu2*) this;   }   else if (IsEqualIID(riid, IID_IContextMenu3))   { - *ppv = (IContextMenu3 *) this; - clsname = "IID_IContextMenu3"; + *ppv = (IContextMenu3*) this;   }   else if (IsEqualIID(riid, IID_IShellIconOverlayIdentifier))   { - *ppv = (IShellIconOverlayIdentifier *) this; - clsname = "IID_IShellIconOverlayIdentifier"; + *ppv = (IShellIconOverlayIdentifier*) this;   } - - TDEBUG_TRACE("CShellExt::QueryInterface: " << clsname);     if (*ppv)   {
 
187
188
189
190
191
192
193
 
187
188
189
 
190
191
192
@@ -187,7 +187,6 @@
  }     std::string iconpath = thgdir + "\\icons\\" + iconname; - TDEBUG_TRACE(" GetTortoiseIcon: loading " + iconpath);   HICON h = (HICON) LoadImageA(0, iconpath.c_str(), IMAGE_ICON,   16, 16, LR_LOADFROMFILE);   if (!h)
 
42
43
44
45
46
47
48
49
50
51
52
 
42
43
44
 
45
 
 
 
46
47
48
@@ -42,11 +42,7 @@
  while (e.read(f, relpath))   {   if (e.unset()) - {   unset = true; - fclose(f); - return std::auto_ptr<Dirstate>(0); - }     if (e.state == 'a')   ++pd->num_added_;