Skip to content
Browse files

Adding Move…

  • Loading branch information...
1 parent 6043473 commit e17bd71eb9c8aa284e1ea34ce2b25b632b96ad49 @appsforartists appsforartists committed with infininight
Showing with 68 additions and 0 deletions.
  1. +66 −0 Commands/Move….tmCommand
  2. +2 −0 info.plist
View
66 Commands/Move….tmCommand
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>#!/usr/bin/python2.7
+# -*- coding: utf-8 -*-
+
+def add_tm_support_to_path():
+ import os, sys
+ sys.path.append(os.environ['TM_BUNDLE_SUPPORT'])
+ sys.path.append(os.environ['TM_SUPPORT_PATH'] + '/lib')
+
+add_tm_support_to_path()
+
+
+from perforce_bundle_helper import *
+import dialog, tm_helpers
+
+
+'''
+Most commands work on all of TM_SELECTED_FILES. Here, we are explicitly only
+interested in the first one.
+'''
+source_path = os.environ['TM_SELECTED_FILE'] if os.environ.has_key('TM_SELECTED_FILE') \
+ else os.environ['TM_FILEPATH'] if os.environ.has_key('TM_FILEPATH') \
+ else ''
+relative_source_path_in_list = get_files_relative_to_p4_workspace([source_path]) if source_path else ''
+relative_source_path = relative_source_path_in_list[0] if relative_source_path_in_list else ''
+
+if relative_source_path:
+ default_path = relative_source_path
+
+ if os.path.isdir(source_path):
+ source_path += '/...'
+ default_path += '/...'
+
+ destination_path = dialog.get_string(
+ title = "Move Files With P4...",
+ prompt = "Please enter a destination relative to your workspace.",
+ string = default_path
+ )
+
+ if destination_path:
+ run_p4_command_on_selected_textmate_files('edit')
+ p4_response = run_p4_command('move', [source_path, destination_path])
+ print(stdout_to_html(p4_response))
+ tm_helpers.rescan_project()
+ else:
+ print("You did not supply a destination. Command cancelled.")
+else:
+ print("This file is not in your P4 workspace.")</string>
+ <key>input</key>
+ <string>none</string>
+ <key>keyEquivalent</key>
+ <string>@4</string>
+ <key>name</key>
+ <string>Move…</string>
+ <key>output</key>
+ <string>showAsHTML</string>
+ <key>uuid</key>
+ <string>8B71655C-276C-4379-9FF4-2BCEA4D35C5D</string>
+</dict>
+</plist>
View
2 info.plist
@@ -23,6 +23,7 @@
<string>------------------------------------</string>
<string>AD9B4CB8-7577-11D9-A32D-000A95A89C98</string>
<string>9982EC7A-7577-11D9-A32D-000A95A89C98</string>
+ <string>8B71655C-276C-4379-9FF4-2BCEA4D35C5D</string>
<string>97411675-97FD-46EF-898A-73AEDA91DEED</string>
<string>------------------------------------</string>
<string>0D7B4536-7B90-47ED-BB1C-5A24CEEFB078</string>
@@ -70,6 +71,7 @@
<string>AD9B4CB8-7577-11D9-A32D-000A95A89C98</string>
<string>9982EC7A-7577-11D9-A32D-000A95A89C98</string>
<string>97411675-97FD-46EF-898A-73AEDA91DEED</string>
+ <string>8B71655C-276C-4379-9FF4-2BCEA4D35C5D</string>
<string>0D7B4536-7B90-47ED-BB1C-5A24CEEFB078</string>
<string>D6F5F368-C476-4882-82EA-D11E22A445BF</string>
<string>D877FFC4-1170-452B-910B-AB4F0EE743C6</string>

0 comments on commit e17bd71

Please sign in to comment.
Something went wrong with that request. Please try again.