Commits

guillermooo committed 1452b4f

fix bug in command to kill server

  • Participants
  • Parent commits bda370a

Comments (0)

Files changed (2)

File shglib/utils.py

         hg_bin = get_hg_exe_name()
         server = client.CmdServerClient(hg_bin=hg_bin, repo_root=repo_root)
         return server
+
+    def shut_down(self, repo_root):
+        self[repo_root].shut_down()
+        del self.__dict__[repo_root]

File sublime_hg.py

     the newest changes are picked up.
     """
     def run(self, edit):
-        repo_root = None
-        if self.view.file_name():
+        try:
             repo_root = utils.find_hg_root(self.view.file_name())
-        if repo_root:
-            running_servers[repo_root].shut_down()
-            del running_servers[repo_root]
-        else:
+        # XXX: Will swallow the same error for the utils. call.
+        except AttributeError:
             sublime.status_message("SublimeHg: No server found for this file.")
+            return
+
+        running_servers.shut_down(repo_root)
+        sublime.status_message("SublimeHg: " + "Killed server for '%s'" %
+                               repo_root)
 
 
 def run_in_console(hg_bin, cmd, encoding=None):