Browse files

Adding command to check out a specific revision of a file.

git-svn-id: http://svn.textmate.org/trunk/Bundles/CVS.tmbundle@2826 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information...
1 parent 18c2595 commit bb7bedd11b9776f5c8aa56748f6b22eeb9db9da1 Brian Donovan committed Mar 6, 2006
Showing with 58 additions and 0 deletions.
  1. +58 −0 Commands/Check out Revision....plist
View
58 Commands/Check out Revision....plist
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//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>require_cmd "${TM_CVS:=cvs}" "If you have installed cvs, then you need to either update your &lt;tt&gt;PATH&lt;/tt&gt; or set the &lt;tt&gt;TM_CVS&lt;/tt&gt; shell variable (e.g. in Preferences / Advanced)"
+
+cd "$TM_DIRECTORY"
+revs=$("$TM_CVS" log "$TM_FILENAME"|grep '^revision' \
+ 2&gt; &gt;(CocoaDialog progressbar --indeterminate \
+ --title "Check out Revision…" \
+ --text "Retrieving List of Revisions…" \
+ ))
+
+revs=$(echo $revs|sed 's/revision //g')
+
+revs=`osascript&lt;&lt;END
+ set AppleScript's text item delimiters to {" "}
+ tell app "SystemUIServer"
+ activate
+ set ourList to (every text item of "$revs")
+ if the count of items in ourList is 0 then
+ display dialog "No older revisions of file '$(basename "$TM_FILEPATH")' found" buttons ("OK")
+ set the result to false
+ else
+ choose from list ourList with prompt "Check out an older revision of '$(basename "$TM_FILEPATH")':"
+ end if
+ end tell
+END`
+
+# exit if user canceled
+if [[ $revs = "false" ]]; then
+ exit_discard
+fi
+
+export REVS="$revs"
+"${TM_RUBY:-ruby}" &lt;&lt;'END'
+
+ENV['CVS_PATH'] = ENV['TM_CVS']
+$LOAD_PATH &lt;&lt; ENV['TM_BUNDLE_SUPPORT']
+require 'versioned_file'
+
+print CVS::VersionedFile.version(ENV['TM_FILEPATH'], ENV['REVS'])
+END</string>
+ <key>input</key>
+ <string>none</string>
+ <key>keyEquivalent</key>
+ <string>^Z</string>
+ <key>name</key>
+ <string>Check out Revision...</string>
+ <key>output</key>
+ <string>replaceDocument</string>
+ <key>uuid</key>
+ <string>2C5DB599-04DC-40CC-BBE8-0A73620BC42A</string>
+</dict>
+</plist>

0 comments on commit bb7bedd

Please sign in to comment.