1. Renat Yuldasehv
  2. hg4subl

Commits

Alexey Rakeev  committed a0f8ba3

Added diff/blame sidebar commands

  • Participants
  • Parent commits e8551c7
  • Branches default

Comments (0)

Files changed (2)

File Side Bar.sublime-menu

View file
         "caption": "Hg",
         "children":
         [
-            { "caption": "Add", "command": "hg_add_side", "args": {"paths": []} }
+            { "caption": "Diff", "command": "hg_diff_side", "args": {"paths": []} }
+            ,{ "caption": "Add", "command": "hg_add_side", "args": {"paths": []} }
             ,{ "caption": "Remove", "command": "hg_remove_side", "args": {"paths": []} }
+            ,{ "caption": "Annotate", "command": "hg_annotate_side", "args": {"paths": []} }
         ]
     }
 ]

File hg.py

View file
 
 class HgAnnotateCommand(HgTextCommand):
     def run(self, edit):
-        command = [get_hg(self.view), 'annotate', '-a', '-u', '-f','-d','-l','-n']
+        command = [get_hg(self.view), 'annotate', '-aufdqln']
 
         selection = self.view.sel()[0] # todo: multi-select support?
         if not selection.empty():
             command.extend(('-L', lines))
 
         command.append(self.get_file_name())
-        self.run_command(command, self.annotate_done)
-    def annotate_done(self, result):
-        self.scratch(result, title = "Hg annotate")
+        self.run_command(command, functools.partial(self.scratch, title = "Hg annotate"))
+
+class HgAnnotateSideCommand(HgWindowCommand):
+    def run(self, paths):
+        self.run_command([get_hg(self.view), 'annotate', '-aufdqln'] + paths, functools.partial(self.scratch, title = "Hg annotate"))
 
 class HgCustomCommand(HgTextCommand):
     def run(self, edit):
 
 class HgDiffCommand(HgTextCommand):
     def run(self, edit):
-        self.run_command([get_hg(self.view), 'diff', '', self.get_file_name()], self.diff_done)
-
-    def diff_done(self, result):
-        self.scratch(result, title = "Hg Diff")
+        self.run_command([get_hg(self.view), 'diff', self.get_file_name()], functools.partial(self.scratch, title = "Hg Diff"))
 
 class HgDiffAllCommand(HgDiffCommand):
     def get_file_name(self):
         return ''
 
+class HgDiffSideCommand(HgWindowCommand):
+    def run(self, paths):
+        self.run_command([get_hg(self.view), 'diff'] + paths, functools.partial(self.scratch, title = "Hg Diff"))
+
 class HgCommitCommand(HgTextCommand):
     def run(self, edit):
         self.window.show_input_panel("Message", "", self.on_input, None, None)