{"id":5578,"date":"2013-01-08T09:20:00","date_gmt":"2013-01-08T17:20:00","guid":{"rendered":"http:\/\/www.sapien.com\/blog\/?p=5578"},"modified":"2013-01-08T09:20:56","modified_gmt":"2013-01-08T17:20:56","slug":"powershell-studio-2012-with-git-subversion-and-mercurial-oh-my","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2013\/01\/08\/powershell-studio-2012-with-git-subversion-and-mercurial-oh-my\/","title":{"rendered":"PowerShell Studio 2012 with GIT, Subversion and Mercurial Oh, my!"},"content":{"rendered":"<p>Similar to PrimalScript 2012, we received requests to add support for GIT, Mercurial, and Subversion in PowerShell Studio 2012. The difficulty of supporting all these various source control solutions is that they all have different APIs and change over time. The varying nature of these tools could potentially make the integration outdated fairly quickly. One thing in common all the source controls solutions previously mentioned have is command line tools. We\u2019ve used this common factor to resolve the problem.<\/p>\n<p>Our solution to the problem is the new custom tool menu: <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Custom Tool Menu\" border=\"0\" alt=\"Custom Tool Menu\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/12\/Custom-Tool-Menu.png\" width=\"224\" height=\"123\"><\/p>\n<p>The custom tool menu allows you to customize and execute command lines tools at the click of a button. The new feature enables you to integrate virtually any solution that provides a command line tool.<\/p>\n<p>&nbsp;<\/p>\n<p>You can add a global set of commands to the custom tool menu by creating a INF file in PowerShell Studio\u2019s application data folder:<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/12\/Global-CustomMenu-inf.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Global CustomMenu inf\" border=\"0\" alt=\"Global CustomMenu inf\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/12\/Global-CustomMenu-inf_thumb.png\" width=\"644\" height=\"381\"><\/a><\/p>\n<p><strong>Folder Location (Windows 7 ):<\/strong><\/p>\n<p>C:\\ProgramData\\SAPIEN\\PowerShell Studio 2012\\CustomMenu.inf<\/p>\n<p>&nbsp;<\/p>\n<p><strong>CustomMenu.inf Format:<\/strong><\/p>\n<p>[Menu]<br \/>1=Command Name 1;command line 1<br \/>2=Command Name 2;command line 2<\/p>\n<p>&nbsp;<\/p>\n<p>In this example GIT is used, but any command line tool will work including the command line tools you create with PowerShell Studio\u2019s script to exe packager.<\/p>\n<p>After creating or altering the CustomMenu.inf, you will need to restart PowerShell Studio in order to see the new commands:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Custom Tool Menu Global Commands\" border=\"0\" alt=\"Custom Tool Menu Global Commands\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/12\/Custom-Tool-Menu-Global-Commands.png\" width=\"323\" height=\"227\"><\/p>\n<p>&nbsp;<\/p>\n<p>Another useful feature of the custom menu is the ability to create localized commands for specific folders. For example, you may use a particular source control solution for Folder A and another for Folder B. In addition, you could use the localized commands to replicate a source control solution\u2019s repository to a remote location.<\/p>\n<p>For example, the following CustomMenu.inf is added to the target folder \u201cMy Documents\\SAPIEN\\Scripts\u201d:<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/12\/image12.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/12\/image12_thumb.png\" width=\"644\" height=\"249\"><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>When you open a file that is contained in the folder, the custom tools menu will display the localized folder commands as well as the global commands.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Custom Tool Menu Localized Commands\" border=\"0\" alt=\"Custom Tool Menu Localized Commands\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/12\/Custom-Tool-Menu-Localized-Commands.png\" width=\"399\" height=\"258\"><\/p>\n<p>The custom commands allow you to react to files or folders. This way you can push files to an ftp site or simply make a backup copy to a remote location. Output from the command line tools will be displayed in PowerShell Studio\u2019s Output panel.<\/p>\n<p>The following is a list of macro variables that&nbsp; can be used in custom menu command lines:<\/p>\n<blockquote>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" width=\"653\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"105\">$ProjectFolder$ <\/td>\n<td valign=\"top\" width=\"546\">The folder the currently open project resides in, if any project is open.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"105\">$PowerShell$<\/td>\n<td valign=\"top\" width=\"546\">The PowerShell version number currently selected in the ribbon (2 or 3).<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"105\">$Platform$<\/td>\n<td valign=\"top\" width=\"546\">The current platform selected in platform selector (32 or 64)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"105\">$WinDir$<\/td>\n<td valign=\"top\" width=\"546\">The location of the Windows directory for PowerShell Studio\u2019s process.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"105\">$WinSystem$<\/td>\n<td valign=\"top\" width=\"546\">The location of the Windows System folder for PowerShell Studio\u2019s process.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"105\">$Selection$ <\/td>\n<td valign=\"top\" width=\"546\">The content of the current selection in the active file, if any. (Warning: may contain carriage return\/ linefeed)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"105\">$File$<\/td>\n<td valign=\"top\" width=\"546\">The full path of the currently active file, if any.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"105\">$FileName$ <\/td>\n<td valign=\"top\" width=\"546\">The file name of the active document without path information.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"105\">$FileDir$<\/td>\n<td valign=\"top\" width=\"546\">The folder location of the currently active document.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"105\">$Dir$ <\/td>\n<td valign=\"top\" width=\"546\">The current directory of PowerShell Studio\u2019s process.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"105\">$Line$<\/td>\n<td valign=\"top\" width=\"546\">The current line number in the active file.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"105\">$Col$<\/td>\n<td valign=\"top\" width=\"546\">The current column in the active file.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/blockquote>\n<p>&nbsp;<\/p>\n<p>The custom menu feature should make PowerShell Studio integration with external tools easier and customizable.<\/p>\n<p>This article applies to PowerShell Studio v3.1.14 or later.<\/p>\n<p><strong>Related Article:<\/strong><\/p>\n<p>&nbsp;<a title=\"http:\/\/www.sapien.com\/blog\/2012\/12\/11\/using-git-subversion-and-mercurial-with-primalscript-2012\/\" href=\"http:\/\/www.sapien.com\/blog\/2012\/12\/11\/using-git-subversion-and-mercurial-with-primalscript-2012\/\">http:\/\/www.sapien.com\/blog\/2012\/12\/11\/using-git-subversion-and-mercurial-with-primalscript-2012\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Similar to PrimalScript 2012, we received requests to add support for GIT, Mercurial, and Subversion in PowerShell Studio 2012. The difficulty of supporting all these various source control solutions is that they all have different APIs and change over time. The varying nature of these tools could potentially make the integration outdated fairly quickly. One [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[705,21,25],"tags":[56,786,788,28,1016,787,321],"class_list":["post-5578","post","type-post","status-publish","format-standard","hentry","category-powershell-studio-2012","category-software-news","category-windows-powershell","tag-command-line","tag-git","tag-mercurial","tag-powershell","tag-powershell-studio","tag-svn","tag-version-control"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/5578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=5578"}],"version-history":[{"count":3,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/5578\/revisions"}],"predecessor-version":[{"id":5605,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/5578\/revisions\/5605"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=5578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=5578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=5578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}