# 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 User is defined. If "{User}" == "" Alert 'The {User} variable is not defined.' End # Next 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}" =~ /[¬,]+([¬ ∂t+*]+)®3([+*]«0,1»)®1≈/ # {®1} is '+', '*', or nothing # {®3} is the rest of the rev number Evaluate "{info}" =~ /≈Project: (≈∫)®2 +Checked out≈/ # {®2} contains the project name 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 # (or a modified read–only file). 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 -only "{®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 Evaluate "{®3}" =~ /(,([0-9.]+[a-z]*)*)®4[0-9.]+/ # {®4} contains the branch If "{comment}" ≠ "" Checkout -t "{comment}" -c -m -project "{®2}" "{Active}{®4}" Else Checkout -c -m -project "{®2}" "{Active}{®4}" End If {Status} ≠ 0 Alert "∂"{Active}∂" has already been checked out by someone else." Exit 0 End End End ∑ dev:null