# CheckOutActive - Check the active window out for modification # # Usage: Called by a userÐdefined menu item # # CheckOutActive uses the ProjectInfo command to determine the # parent project for the file open as the Active window. Once this # project has been determined, the file open as the Active window # can be properly checked out. # # © Apple Computer, Inc. 1988 # All rights reserved. Set Exit 0 Set error 0 Begin # First see if the active window belongs to a project. Then # find the name of the parent project. (Set info "`ProjectInfo "{Active}"`" || Set error 1) Evaluate "{info}" =~ /Å,[0-9a-z.]+([¶+¶*])¨1 +Å/ Evaluate "{info}" =~ /ÅProject: (ź)¨2 +Checked outÅ/ If {error} ­ 0 || "{info}" == "" Alert "¶"{Active}¶" canÕt be checked out because ¶ it doesnÕt belong to a project." Exit 0 End # Find out if the active window is checked out for modification. Echo "'{¨1}'" If "'{¨1}'" == "'+'" Alert "¶"{Active}¶" canÕt be checked out again because ¶ it already IS checked out for modification." Exit 0 Else If "'{¨1}'" == "'*'" Alert "¶"{Active}¶" canÕt be checked out again because ¶ it IS a modified read-only file." Exit 0 End # Is the right project mounted? (Set info "`ProjectInfo "{¨2}"`" || Set error 1) If "{info}" == "" Alert "¶"{Active}¶" canÕt be checked out because the project ¶ ¶"{¨2}¶" is not mounted." Exit 0 End # Request a comment before we check the file out. It is still possible # that the checkout will fail because the lastest revision on the trunk # is already checked out for modification by someone else. (Set comment "`Request -d "{Task}" "What changes will you make?" || Set error {Status}`") If {error} == 0 If "{comment}" ­ "" Checkout -cs "{comment}" -c -m -project "{¨2}" "{Active}" Else Checkout -c -m -project "{¨2}" "{Active}" End If {Status} ­ 0 Alert "¶"{Active}¶" has already been checked out by someone else." Exit 0 End End End · dev:null