Commits

Aidan Ryan committed 9e503db

Add Annotate command via TFPT (Team Foundation Power Tools)

  • Participants
  • Parent commits 7bb8f4f

Comments (0)

Files changed (4)

File Default.sublime-commands

     { "command": "tfs_difference", "caption": "TFS: Compare with latest" },
     { "command": "tfs_delete", "caption": "TFS: Delete" },
     { "command": "tfs_status", "caption": "TFS: Status" },
+    { "command": "tfs_annotate", "caption": "TFS: Annotate" },
     {
         "caption": "Preferences: Sublime TFS Settings – Default",
         "command": "open_file", "args":

File Main.sublime-menu

             { "command": "tfs_get_latest", "caption": "Get latest" },
             { "command": "tfs_difference", "caption": "Compare with latest" },
             { "command": "tfs_delete", "caption": "Delete" },
-            { "command": "tfs_status", "caption": "Status" }
+            { "command": "tfs_status", "caption": "Status" },
+            { "command": "tfs_annotate", "caption": "Annotate"}
         ]
     }
 ]

File sublime_tfs.py

         self.name = 'sublime_tfs'
         settings = sublime.load_settings('sublime_tfs.sublime-settings')
         self.tf_path = settings.get("tf_path")
+        self.tfpt_path = settings.get("tfpt_path")
         self.cwd = os.path.expandvars('%HOMEDRIVE%\\')
 
     def is_under_tfs(self, path):
     def status(self, path):
         return self.run_command("status", path)
 
+    def annotate(self, path):
+        return self.run_command("annotate", path, True, True)
+
     def auto_checkout(self, path):
         if self.status(path)[0]:
             self.checkout(path)
         else:
             return (False, "")
 
-    def run_command(self, command, path, is_graph = False):
-        commands = [self.tf_path, command, path]
+    def run_command(self, command, path, is_graph = False, is_tfpt = False):
+        commands = [self.tfpt_path if is_tfpt else self.tf_path, command, path]
         if (is_graph):
             p = subprocess.Popen(commands, cwd=self.cwd)
         else:
             thread.start()
             ThreadProgress(self.view, thread, "Getting status...")
 
+class TfsAnnotateCommand(sublime_plugin.TextCommand):
+    def run(self, edit):
+        path = self.view.file_name()
+        if not (path is None):
+            manager = TfsManager()
+            thread = TfsRunnerThread(path, manager.annotate)
+            thread.start()
+            ThreadProgress(self.view, thread, "Annotating...")
+
 class TfsEventListener(sublime_plugin.EventListener):
     def on_modified(self, view):
         path = view.file_name()

File sublime_tfs.sublime-settings

 {
-    "tf_path": "C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/TF.exe"
+    "tf_path": "C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/TF.exe",
+    "tfpt_path": "C:/Program Files (x86)/Microsoft Team Foundation Server 2010 Power Tools/TFPT.exe"
 }