Changeset 2 for trunk/lingosource/castlib1/alexUtilities.ls
- Timestamp:
- 08/29/07 17:16:14 (5 years ago)
- File:
-
- 1 edited
-
trunk/lingosource/castlib1/alexUtilities.ls (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lingosource/castlib1/alexUtilities.ls
r1 r2 975 975 end 976 976 977 978 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 979 980 on mListallPuts me 981 cnum = the number of castlibs 982 repeat with l = 1 to cnum 983 mnum = the number of members of castlib l 984 repeat with n = 1 to mnum 985 memref = member(n, l) 986 if memref.type = #script then 987 st = memref.scripttext 988 nl = the number of lines of st 989 numlines = the number of lines of st 990 repeat with r = 1 to numlines 991 992 lin = line r of st 993 994 offs = offset("put ", lin) 995 996 if offs > 0 then 997 998 theLine = lin 999 1000 1001 1002 if ((offs = 1) or (char offs-1 of lin = " ")) then 1003 1004 linWOQuote = "" 1005 offs = offset(QUOTE, lin) 1006 repeat while offs > 0 1007 put char 1 to offs-1 of lin & " " after linWOQuote 1008 delete char 1 to offs of lin 1009 offs = offset(QUOTE, lin) 1010 if offs > 0 then 1011 delete char 1 to offs of lin 1012 end if 1013 offs = offset(QUOTE, lin) 1014 end repeat 1015 put lin after linWOQuote 1016 1017 offs = offset("--", linWOQuote) 1018 if offs > 0 then 1019 delete char offs to length(linWOQuote) of linWOQuote 1020 end if 1021 1022 offs = offset("put ", linWOQuote) 1023 1024 if offs > 0 then 1025 1026 1027 if not(linWOQuote contains " into ") then 1028 if not(linWOQuote contains " after ") then 1029 if not(linWOQuote contains " before ") then 1030 put "-----------" 1031 le = length(st.line[1 .. r-1]) 1032 put memref & ": line" && r & ":" && theLine & RETURN & "activateScriptEditor" && n & "," && l & "," && le & "," && le+1 & RETURN & "-----------" 1033 end if 1034 end if 1035 end if 1036 end if 1037 end if 1038 end if 1039 1040 end repeat 1041 end if 1042 end repeat 1043 end repeat 1044 end 977 1045 978 1046 … … 3022 3090 -- export all scripts into a folder (I use this to compare to versions of a movie, open movie 1, export all scripts, open movie 2 and export all scripts and then compare with bbdiff both folders) 3023 3091 3024 on mExportAllScriptsToDisk me, skipIcons, selectionOnly, convertLineBreaksToUnix 3025 3026 theFolder = mGetFolderPathFromUser(me) 3092 on mExportScriptsToFolder me, skipIcons, selectionOnly, convertLineBreaksToUnix, theFolder 3093 mExportAllScriptsToDiskWithFolder me, skipIcons, selectionOnly, convertLineBreaksToUnix 3094 end 3095 3096 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 3097 3098 on mExportAllScriptsToDiskWithFolder me, skipIcons, selectionOnly, convertLineBreaksToUnix, theFolder 3099 3100 theFolder = string(theFolder) 3101 if length(theFolder) < 1 then 3102 theFolder = mGetFolderPathFromUser(me) 3103 end if 3027 3104 3028 3105 if length(theFolder) < 1 then exit … … 3256 3333 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 3257 3334 3258 on mUpdateScriptsFrom Repositoryme, thePath, selectionOnly3335 on mUpdateScriptsFromFolder me, thePath, selectionOnly 3259 3336 3260 3337 if selectionOnly = 1 then 3261 mUpdateSelectedScriptsFrom Repositoryme, thePath3338 mUpdateSelectedScriptsFromFolder me, thePath 3262 3339 exit 3263 3340 end if … … 3272 3349 3273 3350 if baFileExists(thePath & "memberInfo.xml") then 3274 mUpdateScriptCastlibFrom Repositoryme, thePath3351 mUpdateScriptCastlibFromFolder me, thePath 3275 3352 else 3276 3353 folderlist = bafolderlist(thePath) … … 3279 3356 repeat with n = 1 to cnt 3280 3357 if folderlist[n] starts "castlib" then 3281 mUpdateScriptCastlibFrom Repositoryme, thePath & folderlist[n] & delim3358 mUpdateScriptCastlibFromFolder me, thePath & folderlist[n] & delim 3282 3359 end if 3283 3360 end repeat … … 3295 3372 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 3296 3373 3297 on mUpdateScriptCastlibFrom Repositoryme, thePath3374 on mUpdateScriptCastlibFromFolder me, thePath 3298 3375 3299 3376 infoList = mReadXML_2_List(me, thePath & "memberInfo.xml") … … 3345 3422 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 3346 3423 3347 on mUpdateSelectedScriptsFrom Repositoryme, thePath3424 on mUpdateSelectedScriptsFromFolder me, thePath 3348 3425 3349 3426 thePath = string(thePath) … … 3672 3749 on mSVN_Update_Working_Copy me, chooseNewPath 3673 3750 3674 svnBinary = mGetSVNBinaryPath(me) 3751 workingCopies = value(getPref("svn_workingCopies_paths.txt")) 3752 if ilk(workingCopies) <> #proplist then workingCopies = [:] 3753 3754 svnBinary = mGetSVNBinaryPath(me, workingCopies) 3675 3755 if length(svnBinary) < 1 then exit 3676 3756 3677 workingFolder = mGetWorkingCopyPath(me, the moviepath & the moviename, chooseNewPath )3757 workingFolder = mGetWorkingCopyPath(me, the moviepath & the moviename, chooseNewPath, workingCopies) 3678 3758 if length(workingFolder) < 1 then exit 3679 3759 … … 3690 3770 end if 3691 3771 3692 end 3693 3694 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 3695 3696 on mGetSVNBinaryPath me 3772 setPref("svn_workingCopies_paths.txt", string(workingCopies)) 3773 3774 end 3775 3776 3777 3778 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 3779 3780 on mSVN_Commit_CurrentScripts me, selected_Members_Only, chooseNewPath 3781 3782 workingCopies = value(getPref("svn_workingCopies_paths.txt")) 3783 if ilk(workingCopies) <> #proplist then workingCopies = [:] 3784 3785 3786 svnBinary = mGetSVNBinaryPath(me, workingCopies) 3787 if length(svnBinary) < 1 then exit 3788 3789 workingFolder = mGetWorkingCopyPath(me, the moviepath & the moviename, chooseNewPath, workingCopies) 3790 if length(workingFolder) < 1 then exit 3791 3792 msg = baPrompt("Commit message", "Enter commit message", "Commitmessage", 0, -2, -2) 3793 3794 if length(msg) < 1 then 3795 alert "You must enter a message for the commit action." 3796 exit 3797 end if 3798 3799 if workingCopies.getaprop(#dontWarnWhenSaving) <> 1 then 3800 answer = baMsgBoxEx("The movie will be saved before committing.", "Save movie?", "Save", "Cancel", "Always save", "Question", 1, "left", "Arial", 14, 4, -2, -2) 3801 if answer = "Cancel" then exit 3802 if answer = "Always save" then workingCopies.setaprop(#dontWarnWhenSaving, 1) 3803 end if 3804 saveMovie() 3805 3806 mExportAllScriptsToDiskWithFolder me, 1, selected_Members_Only, 1, workingFolder 3807 3808 3809 3810 if the platform contains "mac" then 3811 svnBinary = baUnixName(svnBinary) 3812 workingFolder = baUnixName(workingFolder) 3813 end if 3814 3815 theresult = shell_cmd_list(svnBinary && "status" && QUOTE & workingFolder & QUOTE) 3816 3817 cnt = count(theresult) 3818 if cnt < 1 then 3819 alert "Apparently there are no changes to the most recent version in the svn repository" 3820 exit 3821 end if 3822 3823 repeat with n = 1 to cnt 3824 answ = theresult[n] 3825 meth = word 1 of answ 3826 delete word 1 of answ 3827 3828 case meth of 3829 "!": -- deleted file (missing here, but in the repository present) 3830 -- I don't think, it is a good idea to delete the file in the repository in this case 3831 -- as it may also be the case, that we only have a subset of the castlibs/scripts 3832 -- therefore I just skip these files and leave it to the user what to do with them in his svn client application 3833 -- we only put a message, so the user is made aware of this fact 3834 put "Missing file!" && answ && "is missing here, but present in the repository" 3835 3836 "?": -- newly added file 3837 shell_cmd_list(svnBinary && "add" && QUOTE & answ & QUOTE) 3838 3839 put "Added file" && answ && "to the repository" 3840 3841 "m": 3842 -- just log the changes: 3843 put "Update file:" && answ 3844 3845 end case 3846 3847 end repeat 3848 3849 theresult = shell_cmd_list(svnBinary && "ci --message" && QUOTE & msg & QUOTE && QUOTE & workingFolder & QUOTE) 3850 3851 3852 if count(theresult) > 0 then 3853 alert "svn response:" && theresult[1] 3854 else 3855 alert "svn application did not respond, something seems to have failed. :-(" 3856 end if 3857 3858 3859 setPref("svn_workingCopies_paths.txt", string(workingCopies)) 3860 3861 end 3862 3863 3864 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 3865 ---------- svn helper handlers 3866 3867 on mGetSVNBinaryPath me, workingCopies 3697 3868 3698 3869 if (mCheckForXtra(me, "budapi") + mCheckForXtra(me, "shell")) < 2 then … … 3701 3872 end if 3702 3873 3703 workingCopies = value(getPref("svn_workingCopies_paths.txt")) 3704 if ilk(workingCopies) <> #proplist then workingCopies = [:] 3874 savePrefs = 0 3875 if ilk(workingCopies) <> #proplist then 3876 workingCopies = value(getPref("svn_workingCopies_paths.txt")) 3877 if ilk(workingCopies) <> #proplist then workingCopies = [:] 3878 savePrefs = 1 3879 end if 3880 3705 3881 3706 3882 if the platform contains "mac" then … … 3710 3886 end if 3711 3887 3712 if baFileExists(svnBinary) <> 1 then svnBinary = "" 3713 3714 3715 if length(svnBinary) < 1 then 3716 3717 svnBinary = [] 3718 if the platform contains "mac" then 3888 if the platform contains "mac" then -- dunno how to check on windows, if svn is installed, anyone ? 3889 3890 if baFileExists(svnBinary) <> 1 then svnBinary = "" 3891 3892 3893 if length(svnBinary) < 1 then 3894 3895 svnBinary = [] 3896 3719 3897 svnBinary = shell_cmd_list("for thisBinPath in /usr/bin /bin /usr/sbin /sbin /usr/local/sbin /usr/local/bin /opt/sbin /opt/bin /opt/local/sbin /opt/local/bin /sw/bin /sw/sbin ; do find $thisBinPath -name svn ; done") 3720 end if 3721 3722 if count(svnBinary) < 1 then 3723 alert "svn binary not found in your binaries folder. Where is the svn binary?" 3724 svnBinary = mGetFilePathFromUser(me) 3725 if length(svnBinary) < 1 then return "" 3726 3727 else 3728 svnBinary = baHFSName(svnBinary[1]) 3729 3730 end if 3731 3732 end if 3733 3734 if baFileExists(svnBinary) <> 1 then 3735 alert "The path to the svn binary seems to have changed. Please try again in order to search the path." 3736 svnBinary = "" 3737 end if 3898 -- end if 3899 3900 if count(svnBinary) < 1 then 3901 alert "svn binary not found in your binaries folder. Where is the svn binary?" 3902 svnBinary = mGetFilePathFromUser(me) 3903 if length(svnBinary) < 1 then return "" 3904 3905 else 3906 svnBinary = baHFSName(svnBinary[1]) 3907 3908 end if 3909 3910 3911 end if 3912 3913 if baFileExists(svnBinary) <> 1 then 3914 alert "The path to the svn binary seems to have changed. Please try again in order to search the path." 3915 svnBinary = "" 3916 end if 3917 3918 3919 else 3920 -- dunno how to check on windows, if svn is installed, anyone ? 3921 svnBinary = "svn" 3922 end if 3923 3738 3924 3739 3925 workingCopies.setaprop(#svnBinary, svnBinary) 3740 setPref("svn_workingCopies_paths.txt", string(workingCopies)) 3926 3927 if savePrefs = 1 then setPref("svn_workingCopies_paths.txt", string(workingCopies)) 3741 3928 3742 3929 return svnBinary … … 3746 3933 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 3747 3934 3748 on mGetWorkingCopyPath me, movieIdentifier, chooseNewPath 3935 on mGetWorkingCopyPath me, movieIdentifier, chooseNewPath, workingCopies 3749 3936 3750 3937 movieIdentifier = string(movieIdentifier) … … 3753 3940 end if 3754 3941 3755 workingCopies = value(getPref("svn_workingCopies_paths.txt")) 3756 if ilk(workingCopies) <> #proplist then workingCopies = [:] 3942 savePrefs = 0 3943 if ilk(workingCopies) <> #proplist then 3944 workingCopies = value(getPref("svn_workingCopies_paths.txt")) 3945 if ilk(workingCopies) <> #proplist then workingCopies = [:] 3946 savePrefs = 1 3947 end if 3757 3948 3758 3949 workingFolder = string(workingCopies.getaprop(movieIdentifier)) … … 3789 3980 workingCopies.setaprop(movieIdentifier, workingFolder) 3790 3981 3791 setPref("svn_workingCopies_paths.txt", string(workingCopies))3982 if savePrefs = 1 then setPref("svn_workingCopies_paths.txt", string(workingCopies)) 3792 3983 3793 3984 return workingFolder … … 3795 3986 end 3796 3987 3797 3798 3799 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3800 3801 on mSVN_Commit_CurrentScripts me, selected_Members_Only, chooseNewPath3802 3803 svnBinary = mGetSVNBinaryPath(me)3804 if length(svnBinary) < 1 then exit3805 3806 workingFolder = mGetWorkingCopyPath(me, the moviepath & the moviename, chooseNewPath)3807 if length(workingFolder) < 1 then exit3808 3809 msg = baPrompt("string Caption", "string Instruction", "string DefaultText", 0, -2, -2)3810 3811 saveMovie()3812 3813 if the platform contains "mac" then3814 theresult = shell_cmd_list(baUnixName(svnBinary) && "ci" && QUOTE & msg & QUOTE && QUOTE & baUnixName(workingFolder) & QUOTE)3815 else3816 theresult = shell_cmd_list(svnBinary && "ci" && QUOTE & msg & QUOTE && QUOTE & workingFolder & QUOTE)3817 end if3818 3819 if count(theresult) > 0 then3820 alert "svn response:" && theresult[1]3821 else3822 alert "svn application did not respond, something seems to have failed. :-("3823 end if3824 3825 end3826 3988 3827 3989
Note: See TracChangeset
for help on using the changeset viewer.
