Commits

TK Soh  committed fb1be3c

context: show TortoiseHg in context menu even if no files/folders are selected

  • Participants
  • Parent commits cd57716

Comments (0)

Files changed (1)

File tortoise/contextmenu.py

         self._handlers = {}
 
     def Initialize(self, folder, dataobj, hkey):
+        if dataobj is None:
+            return
+
         format_etc = win32con.CF_HDROP, None, 1, -1, pythoncom.TYMED_HGLOBAL
         sm = dataobj.GetData(format_etc)
         num_files = shell.DragQueryFile(sm.data_handle, -1)
         tree = None
 
         # open repo
-        path = self._filenames[0]
-        if os.path.isdir(path):
-            dir, filename = path, ''
-        else:
-            dir, filename = os.path.split(path)
-
-        os.chdir(dir)
         u = ui.ui()
         try:
             tree = hg.repository(u, path='')