Commits

Thejesh GN committed d30b7f1 Merge

Merged in quarnster/hg4subl (pull request #3)

Comments (0)

Files changed (2)

Default.sublime-commands

         "command": "hg_log_all"
     }
     ,{
+        "caption": "Hg: Custom Command",
+        "command": "hg_custom"
+    }
+    ,{
         "caption": "Hg: Diff Current File",
         "command": "hg_diff"
     }
     def annotate_done(self, result):
         self.scratch(result, title = "Hg annotate")
 
+class HgCustomCommand(HgCommand):
+    def run(self, edit):
+        self.view.window().show_input_panel("Hg", "",
+            self.on_done, None, None)
+
+    def on_done(self, command):
+        c = command.strip()
+        if len(c) == 0:
+            sublime.status_message("No command provided")
+            return
+        c = c.split(" ")
+        c.insert(0, get_hg(self.view))
+        self.run_command(c, self.cmd_done)
+
+    def cmd_done(self, result):
+        self.scratch(result, title = "Hg Custom Command")
 
 class HgPushCommand(HgCommand):
     def run(self, edit):