diff --git a/Commands/Add or Edit.tmCommand b/Commands/Add or Edit.tmCommand index 2ff7054..973a013 100644 --- a/Commands/Add or Edit.tmCommand +++ b/Commands/Add or Edit.tmCommand @@ -3,32 +3,48 @@ beforeRunningCommand - nop + saveActiveFile command - the_file=`python -c "import sys,os;print os.path.realpath(sys.argv[1])" $TM_FILEPATH` + #!/bin/bash -result=`"${TM_P4:=p4}" edit "$the_file" 2>&1` -status=$? +p4_info_key="Client root: " -if [[ "$result" =~ "already opened for add" ]]; then - echo "Already opened for add." - exit $status -fi +# Get the key: value pair containing the workspace path from +# p4 +workspace_path=`p4 info | grep "$p4_info_key"` + +# Remove the key +workspace_path="${workspace_path#$p4_info_key}/" + +# If the currently open file contains workspace_path +if [[ $TM_FILEPATH =~ $workspace_path ]] +then + # P4 add or edit the file + + the_file=`python -c "import sys,os;print os.path.realpath(sys.argv[1])" $TM_FILEPATH` -if [[ "$result" =~ "not on client" ]]; then - result=`"${TM_P4:=p4}" add "$the_file" 2>&1` - status=$? -fi + result=`"${TM_P4:=p4}" edit "$the_file" 2>&1` + status=$? -echo $result -exit $status - + if [[ "$result" =~ "already opened for add" ]]; then + echo "Already opened for add." + exit $status + fi + + if [[ "$result" =~ "not on client" ]]; then + result=`"${TM_P4:=p4}" add "$the_file" 2>&1` + status=$? + fi + + echo $result + exit $status +fi input none keyEquivalent - ^F + @s name - Open for Add or Edit + Save (add/edit if neccessary) output showAsTooltip uuid diff --git a/Commands/Add to Depot.plist b/Commands/Add to Depot.plist index 42d57ff..cf60f23 100644 --- a/Commands/Add to Depot.plist +++ b/Commands/Add to Depot.plist @@ -5,11 +5,14 @@ beforeRunningCommand nop command - the_file=`python -c "import sys,os;print os.path.realpath(sys.argv[1])" $TM_FILEPATH` -"${TM_P4:=p4}" add "$the_file" - + #!/bin/bash + +# eval is needed to parse the 's in $TM_SELECTED_FILES +eval p4 add $TM_SELECTED_FILES input none + keyEquivalent + @4 name Add to Depot output diff --git a/Commands/Annotate.plist b/Commands/Annotate.plist index c077dbc..5cceb8b 100644 --- a/Commands/Annotate.plist +++ b/Commands/Annotate.plist @@ -6,14 +6,14 @@ nop command the_file=`python -c "import sys,os;print os.path.realpath(sys.argv[1])" $TM_FILEPATH` -"${TM_P4:=p4}" annotate -c -i -q "$the_file" +"${TM_P4:=p4}" -P $P4PASSWD annotate -c -i -q "$the_file" input none keyEquivalent - ^F + @4 name - Annotate + Blame output openAsNewDocument uuid diff --git a/Commands/Open for Delete.tmCommand b/Commands/Open for Delete.tmCommand index e5738b3..0d18481 100644 --- a/Commands/Open for Delete.tmCommand +++ b/Commands/Open for Delete.tmCommand @@ -5,15 +5,20 @@ beforeRunningCommand nop command - the_file=`python -c "import sys,os;print os.path.realpath(sys.argv[1])" $TM_FILEPATH` -"${TM_P4:=p4}" delete "$the_file" + #!/bin/bash + +# eval is needed to parse the 's in $TM_SELECTED_FILES +eval p4 delete $TM_SELECTED_FILES + +# force TM to refresh the current file.. +rescan_project input none keyEquivalent - ^F + @4 name - Mark for Delete + Delete from Depot output showAsTooltip uuid diff --git a/Commands/Open for Editing.plist b/Commands/Open for Editing.plist index 871e5db..047f150 100644 --- a/Commands/Open for Editing.plist +++ b/Commands/Open for Editing.plist @@ -5,13 +5,17 @@ beforeRunningCommand nop command - the_file=`python -c "import sys,os;print os.path.realpath(sys.argv[1])" $TM_FILEPATH` -"${TM_P4:=p4}" edit "$the_file" + #!/bin/bash + +# eval is needed to parse the 's in $TM_SELECTED_FILES +eval p4 edit $TM_SELECTED_FILES input none + keyEquivalent + @4 name - Open for Editing + Edit in workspace output showAsTooltip uuid diff --git a/Commands/Perforce Command Reference.tmCommand b/Commands/Perforce Command Reference.tmCommand index 0e136f0..38d7a1b 100644 --- a/Commands/Perforce Command Reference.tmCommand +++ b/Commands/Perforce Command Reference.tmCommand @@ -8,6 +8,8 @@ open "http://perforce.com/perforce/doc.082/manuals/cmdref/index.html" input none + keyEquivalent + @4 name Perforce Command Reference output diff --git a/Commands/Revert to Latest.plist b/Commands/Revert to Latest.plist index 8850d35..b4972cd 100644 --- a/Commands/Revert to Latest.plist +++ b/Commands/Revert to Latest.plist @@ -5,16 +5,16 @@ beforeRunningCommand nop command - the_file=`python -c "import sys,os;print os.path.realpath(sys.argv[1])" $TM_FILEPATH` -"${TM_P4:=p4}" revert "$the_file" + #!/bin/bash -# force TM to refresh the current file.. -rescan_project - +# eval is needed to parse the 's in $TM_SELECTED_FILES +eval p4 revert $TM_SELECTED_FILES input none + keyEquivalent + @4 name - Revert to Latest + Revert output showAsTooltip uuid diff --git "a/Commands/Submit Changelist\342\200\246.plist" "b/Commands/Submit Changelist\342\200\246.plist" index 16d3800..965878a 100644 --- "a/Commands/Submit Changelist\342\200\246.plist" +++ "b/Commands/Submit Changelist\342\200\246.plist" @@ -14,6 +14,7 @@ require 'p4_forms' require 'shelltokenize' p4 = ENV['TM_P4'] || 'p4' + #commit_paths = ENV['CommitPaths'] support = ENV['TM_SUPPORT_PATH'] commit_tool = support + "/bin/CommitWindow.app/Contents/MacOS/CommitWindow" @@ -72,9 +73,9 @@ IO.popen(%Q{"#{p4}" submit -i}, "w+" ) {|p| p.puts commit_form.to_s } input none keyEquivalent - ^F + @4 name - Submit Changelist… + Commit Changelist… output openAsNewDocument uuid diff --git a/Commands/Sync with Depot.tmCommand b/Commands/Sync with Depot.tmCommand new file mode 100644 index 0000000..e729ed7 --- /dev/null +++ b/Commands/Sync with Depot.tmCommand @@ -0,0 +1,43 @@ + + + + + beforeRunningCommand + nop + command + #!/bin/bash + +p4_info_key="Client root: " + +# Get the key: value pair containing the workspace path from +# p4 +workspace_path=`p4 info | grep "$p4_info_key"` + +# Remove the key +workspace_path="${workspace_path#$p4_info_key}/" + +if [[ $TM_SELECTED_FILE =~ $workspace_path ]] +then + relative_path=${TM_SELECTED_FILE#$workspace_path} + if [[ -d $TM_SELECTED_FILE ]] + then + # p4 requires ... to sync a directory + relative_path="${relative_path}/..." + fi + + # eval not needed because $TM_SELECTED_FILE is unquoted + cd $workspace_path + p4 sync $relative_path +fi + input + none + keyEquivalent + @4 + name + Sync with Depot + output + openAsNewDocument + uuid + 48C3E848-57FC-4633-814E-724CE05AC124 + + diff --git a/info.plist b/info.plist index 258c1eb..8b26ac4 100644 --- a/info.plist +++ b/info.plist @@ -10,17 +10,17 @@ <a href="http://www.perforce.com/perforce/">Perforce</a> is a commercial source control management system. mainMenu - excludedItems - - AD9B4CB8-7577-11D9-A32D-000A95A89C98 - 9982EC7A-7577-11D9-A32D-000A95A89C98 - items - 0D7B4536-7B90-47ED-BB1C-5A24CEEFB078 + BE2B6161-2E23-4C08-B438-409BB1E82DA8 + 48C3E848-57FC-4633-814E-724CE05AC124 ------------------------------------ E73FA01C-7625-11D9-B58C-000A95A89C98 - BE2B6161-2E23-4C08-B438-409BB1E82DA8 + 5D487D57-14F6-4E77-BFAE-769CA3DA40EA + ------------------------------------ + AD9B4CB8-7577-11D9-A32D-000A95A89C98 + 9982EC7A-7577-11D9-A32D-000A95A89C98 + 0D7B4536-7B90-47ED-BB1C-5A24CEEFB078 ------------------------------------ 38C6DE3A-7664-11D9-B58C-000A95A89C98 556314B2-B3BF-11D9-9B1F-000A95A89C98 @@ -29,13 +29,12 @@ D6F5F368-C476-4882-82EA-D11E22A445BF 3E208CDF-268C-4A23-902B-5628596E4BC8 ------------------------------------ - 5D487D57-14F6-4E77-BFAE-769CA3DA40EA - ------------------------------------ 81133C73-CC7A-48EF-AA00-745E0ACF7E6B ------------------------------------ D877FFC4-1170-452B-910B-AB4F0EE743C6 80BD96D6-C41C-45F3-8CAE-E6D88B9D7339 C7F04C53-6B13-47DC-AC09-721D311DFD7D + ------------------------------------ submenus @@ -56,6 +55,12 @@ Perforce ordering + BE2B6161-2E23-4C08-B438-409BB1E82DA8 + 48C3E848-57FC-4633-814E-724CE05AC124 + E73FA01C-7625-11D9-B58C-000A95A89C98 + 5D487D57-14F6-4E77-BFAE-769CA3DA40EA + AD9B4CB8-7577-11D9-A32D-000A95A89C98 + 9982EC7A-7577-11D9-A32D-000A95A89C98 0D7B4536-7B90-47ED-BB1C-5A24CEEFB078 D6F5F368-C476-4882-82EA-D11E22A445BF 556314B2-B3BF-11D9-9B1F-000A95A89C98 @@ -63,17 +68,12 @@ C7F04C53-6B13-47DC-AC09-721D311DFD7D 97E895A4-B5B9-11D9-80D4-000A95A89C98 3E208CDF-268C-4A23-902B-5628596E4BC8 - 5D487D57-14F6-4E77-BFAE-769CA3DA40EA - E73FA01C-7625-11D9-B58C-000A95A89C98 - BE2B6161-2E23-4C08-B438-409BB1E82DA8 1194ED50-336C-45F8-9E73-C777FB3FAF88 092CED4D-9C4C-4ED7-BB6A-5C80D929D9FD A1DCDF0B-628B-4590-87C0-A551DC1F5F3A 80BD96D6-C41C-45F3-8CAE-E6D88B9D7339 D877FFC4-1170-452B-910B-AB4F0EE743C6 9C843973-4684-4D1F-AC63-748BE92025A6 - AD9B4CB8-7577-11D9-A32D-000A95A89C98 - 9982EC7A-7577-11D9-A32D-000A95A89C98 uuid 1FCD86C8-7D03-4179-88E1-B67039E8F7C3