Alexey Rakeev  committed 90df1f0 Draft

Implemented is_enabled filter for side commands

  • Participants
  • Parent commits ee7cec5

Comments (0)

Files changed (1)

         directory = parent
     return False
+def _get_dir(path):
+    return path if os.path.isdir(path) else os.path.dirname(path)
 def _make_text_safeish(text, fallback_encoding):
     # The unicode decode here is because sublime converts to unicode inside insert in such a way
     # that unknown characters will cause errors, which is distinctly non-ideal...
         sublime_plugin.WindowCommand.__init__(self, window)
         self.view = self.window.active_view()
+    def is_enabled(self, paths):
+        dirs = set(map(_get_dir, paths))
+        return all(map(hg_root, dirs))
 class HgAnnotateCommand(HgTextCommand):
     def run(self, edit):
         command = [get_hg(self.view), 'annotate', '-aufdqln']