Changeset 129 for trunk/lingosource
- Timestamp:
- 02/05/08 15:28:11 (4 years ago)
- Location:
- trunk/lingosource/castlib1
- Files:
-
- 2 edited
-
OSCmenu_Utilities.ls (modified) (1 diff)
-
svn_Utilities.ls (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lingosource/castlib1/OSCmenu_Utilities.ls
r96 r129 236 236 pLookUpCommandList.setaprop("Export a list of used alex-linked-library-scripts", ["mExportListOfUsedLinkedScripts me", "bbedit_Utilities"]) 237 237 238 239 240 li.add("") 241 li.add("Compare to SVN") 242 subli = [] 243 li.add(subli) 244 subli.add("Compare selected scripts with Working Copy...") 245 pLookUpCommandList.setaprop("Compare selected scripts with Working Copy...", ["mCompareCurrentScriptToWorkingCopy me, convertLineBreaksToUnix", "svn_Utilities"]) 246 247 subli.add("Export selected script to Working Copy and Open...") 248 pLookUpCommandList.setaprop("Export selected script to Working Copy and Open...", ["mExportCurrentScriptToWorkingCopyAndOpen me, convertLineBreaksToUnix", "svn_Utilities"]) 249 250 251 end if 238 end if 239 240 241 li.add("") 242 li.add("Compare to SVN") 243 subli = [] 244 li.add(subli) 245 subli.add("Compare selected scripts with Working Copy...") 246 pLookUpCommandList.setaprop("Compare selected scripts with Working Copy...", ["mCompareCurrentScriptToWorkingCopy me, convertLineBreaksToUnix", "svn_Utilities"]) 247 248 subli.add("Export selected script to Working Copy and Open...") 249 pLookUpCommandList.setaprop("Export selected script to Working Copy and Open...", ["mExportCurrentScriptToWorkingCopyAndOpen me, convertLineBreaksToUnix", "svn_Utilities"]) 250 251 252 252 253 253 254 -
trunk/lingosource/castlib1/svn_Utilities.ls
r127 r129 16 16 17 17 if not(the platform contains "mac") then 18 alert "This function only works with BBDiff, a command line tool provided by the OSX app BBEdit. I am sure, something similar exists for windows too, but you'll need to change this script yourself for windows" 19 exit 20 end if 18 19 -- alert "This function only works with BBDiff, a command line tool provided by the OSX app BBEdit. I am sure, something similar exists for windows too, but you'll need to change this script yourself for windows" 20 -- exit 21 22 bbdiffpath = mGetSVNDiffBinaryPath(me) 23 24 if length(bbdiffpath) < 1 then exit 25 26 isMac = 0 27 else 28 isMac = 1 29 bbdiffpath = mFindUnixAppInPath(me, "bbdiff") 30 if length(bbdiffpath) < 1 then 31 alert "This function only works with BBDiff, a command line tool provided by BBEdit. Consider installing BBEdits command line tools, it is really helpful." 32 exit 33 end if 34 35 end if 36 21 37 22 38 if mCheckForXtra(me, "ff_shell") = 0 then … … 28 44 29 45 30 bbdiffpath = mFindUnixAppInPath(me, "bbdiff")31 if length(bbdiffpath) < 1 then32 alert "This function only works with BBDiff, a command line tool provided by BBEdit. Consider installing BBEdits command line tools, it is really helpful."33 exit34 end if35 36 37 38 46 cl = the activecastlib 39 47 sel = the selection of castlib cl … … 82 90 83 91 84 --------------------- 85 -- create a temporary file from scripttext: 86 -- tempSrcPath = mDoShellCmd(me, "mktemp -t temp_BBDiff_file1", 1) 87 -- tempSrcPath = tempSrcPath[1] 88 tempSrcPath = "/tmp/temp_BBEdit_file1.ls" 89 90 tempSrcHFSPath = mConvertUnix2Hfs(me, tempSrcPath) 91 92 93 94 ------------------------------------------ trac subversion support works better with unix linebreaks... 95 if voidP(convertLineBreaksToUnix) then convertLineBreaksToUnix = 1 96 if convertLineBreaksToUnix = "" then convertLineBreaksToUnix = 1 97 98 if convertLineBreaksToUnix = 1 then 99 100 if mCheckForXtra(me, "Pregex") = 1 then 101 102 scrTextLi = [st] 103 pregex_replace(scrTextLi, "\x0D\x0A?", "g", "\x0A") 104 st = scrTextLi[1] 105 106 else 107 108 fndStr = numToChar(13) & numToChar(10) 109 offs = offset(fndStr, st) 110 repeat while offs > 0 111 delete char offs of st 112 offs = offset(fndStr, st) 113 end repeat 114 115 fndStr = numToChar(13) 116 offs = offset(fndStr, st) 117 repeat while offs > 0 118 put numToChar(10) into char offs of st 119 offs = offset(fndStr, st) 120 end repeat 121 122 end if 123 end if 124 ----------------------------------------- 125 126 127 128 theResult = mSaveTextToTempFile(me, st, tempSrcHFSPath) 129 --------------------- 130 131 132 comm = mConvertHFS2Unix(me, thePath) 133 134 135 theResult = mDoShellCmd(me, bbdiffpath & " --ignore-curly-quotes --ignore-spaces --wait --resume " "E& tempSrcPath "E&"E& comm "E && "2>&1", 1) 136 137 -- since we used the --wait and the --resume switch, we will only come to this line AFTER the diff process in bbedit is finished 138 139 if count(theResult) > 0 then 140 if theResult[1] contains "no such file or directory" then 141 put theResult[1] 142 else 143 put "No differences found for member: " & memref.name && "(" & memref & ")" 144 end if 145 else 146 147 -------- now write the results of the BBEdit diff back into the script members 148 scrText = mGetTextFromFile(me, tempSrcHFSPath) 149 92 if isMac then 93 94 --------------------- 95 -- create a temporary file from scripttext: 96 -- tempSrcPath = mDoShellCmd(me, "mktemp -t temp_BBDiff_file1", 1) 97 -- tempSrcPath = tempSrcPath[1] 98 tempSrcPath = "/tmp/temp_BBEdit_file1.ls" 99 100 tempSrcHFSPath = mConvertUnix2Hfs(me, tempSrcPath) 101 102 103 104 ------------------------------------------ trac subversion support works better with unix linebreaks... 105 if voidP(convertLineBreaksToUnix) then convertLineBreaksToUnix = 1 106 if convertLineBreaksToUnix = "" then convertLineBreaksToUnix = 1 150 107 151 108 if convertLineBreaksToUnix = 1 then 152 ------------------------------------------ trac subversion support works better with unix linebreaks...109 153 110 if mCheckForXtra(me, "Pregex") = 1 then 154 111 155 scrTextLi = [scrText] 156 if the platform contains "mac" then 157 pregex_replace(scrTextLi, "\x0D?\x0A", "g", "\x0D") 158 else 159 pregex_replace(scrTextLi, "\x0D([^\x0A])", "g", "\x0D\x0A\1") 160 pregex_replace(scrTextLi, "([^\x0D])\x0A", "g", "\1\x0D\x0A") 161 end if 162 scrText = scrTextLi[1] 112 scrTextLi = [st] 113 pregex_replace(scrTextLi, "\x0D\x0A?", "g", "\x0A") 114 st = scrTextLi[1] 163 115 164 116 else 165 117 166 if the platform contains "mac" then 118 fndStr = numToChar(13) & numToChar(10) 119 offs = offset(fndStr, st) 120 repeat while offs > 0 121 delete char offs of st 122 offs = offset(fndStr, st) 123 end repeat 124 125 fndStr = numToChar(13) 126 offs = offset(fndStr, st) 127 repeat while offs > 0 128 put numToChar(10) into char offs of st 129 offs = offset(fndStr, st) 130 end repeat 131 132 end if 133 end if 134 ----------------------------------------- 135 136 137 else 138 139 tmpfolder = baSysFolder("temp") 140 tempSrcHFSPath = tmpfolder & "temp_SVN_Diff_file1.ls" 141 142 end if 143 144 145 146 theResult = mSaveTextToTempFile(me, st, tempSrcHFSPath) 147 --------------------- 148 149 150 if isMac then 151 comm = mConvertHFS2Unix(me, thePath) 152 153 154 theResult = mDoShellCmd(me, bbdiffpath & " --ignore-curly-quotes --ignore-spaces --wait --resume " "E& tempSrcPath "E&"E& comm "E && "2>&1", 1) 155 156 -- since we used the --wait and the --resume switch, we will only come to this line AFTER the diff process in bbedit is finished 157 158 if count(theResult) > 0 then 159 if theResult[1] contains "no such file or directory" then 160 put theResult[1] 161 else 162 put "No differences found for member: " & memref.name && "(" & memref & ")" 163 end if 164 writeBack = 0 165 166 else 167 168 -------- now write the results of the BBEdit diff back into the script members 169 scrText = mGetTextFromFile(me, tempSrcHFSPath) 170 171 writeBack = 1 172 173 if convertLineBreaksToUnix = 1 then 174 ------------------------------------------ trac subversion support works better with unix linebreaks... 175 if mCheckForXtra(me, "Pregex") = 1 then 167 176 168 -- first convert windows to mac 169 fndStr = numToChar(13) & numToChar(10) 170 offs = offset(fndStr, scrText) 171 repeat while offs > 0 172 put numToChar(13) into char offs to offs+1 of scrText 173 offs = offset(fndStr, scrText) 174 end repeat 175 176 -- now convert unix to mac 177 fndStr = numToChar(10) 178 offs = offset(fndStr, scrText) 179 repeat while offs > 0 180 put numToChar(13) into char offs of scrText 181 offs = offset(fndStr, scrText) 182 end repeat 177 scrTextLi = [scrText] 178 if the platform contains "mac" then 179 pregex_replace(scrTextLi, "\x0D?\x0A", "g", "\x0D") 180 else 181 pregex_replace(scrTextLi, "\x0D([^\x0A])", "g", "\x0D\x0A\1") 182 pregex_replace(scrTextLi, "([^\x0D])\x0A", "g", "\1\x0D\x0A") 183 end if 184 scrText = scrTextLi[1] 183 185 184 186 else 185 187 186 fndStr = numToChar(13) & numToChar(10)187 offs = offset(fndStr, scrText)188 repeat while offs > 0189 put "ÀÀÀ" into char offs+1 of scrText188 if the platform contains "mac" then 189 190 -- first convert windows to mac 191 fndStr = numToChar(13) & numToChar(10) 190 192 offs = offset(fndStr, scrText) 191 end repeat192 193 194 fndStr = numToChar(10)195 offs = offset(fndStr, scrText)196 repeat while offs > 0197 put "ÀÀÀ" into char offs of scrText193 repeat while offs > 0 194 put numToChar(13) into char offs to offs+1 of scrText 195 offs = offset(fndStr, scrText) 196 end repeat 197 198 -- now convert unix to mac 199 fndStr = numToChar(10) 198 200 offs = offset(fndStr, scrText) 199 end repeat200 201 202 203 fndStr = numToChar(13) & "ÀÀÀ"204 offs = offset(fndStr, scrText)205 repeat while offs > 0206 put numToChar(13) & numToChar(10) into char offs to offs+3 of scrText201 repeat while offs > 0 202 put numToChar(13) into char offs of scrText 203 offs = offset(fndStr, scrText) 204 end repeat 205 206 else 207 208 fndStr = numToChar(13) & numToChar(10) 207 209 offs = offset(fndStr, scrText) 208 end repeat 209 210 211 212 fndStr = "ÀÀÀ" 213 offs = offset(fndStr, scrText) 214 repeat while offs > 0 215 put numToChar(13) & numToChar(10) into char offs to offs+2 of scrText 210 repeat while offs > 0 211 put "ÀÀÀ" into char offs+1 of scrText 212 offs = offset(fndStr, scrText) 213 end repeat 214 215 216 fndStr = numToChar(10) 216 217 offs = offset(fndStr, scrText) 217 end repeat 218 repeat while offs > 0 219 put "ÀÀÀ" into char offs of scrText 220 offs = offset(fndStr, scrText) 221 end repeat 222 223 224 225 fndStr = numToChar(13) & "ÀÀÀ" 226 offs = offset(fndStr, scrText) 227 repeat while offs > 0 228 put numToChar(13) & numToChar(10) into char offs to offs+3 of scrText 229 offs = offset(fndStr, scrText) 230 end repeat 231 232 233 234 fndStr = "ÀÀÀ" 235 offs = offset(fndStr, scrText) 236 repeat while offs > 0 237 put numToChar(13) & numToChar(10) into char offs to offs+2 of scrText 238 offs = offset(fndStr, scrText) 239 end repeat 240 241 end if 218 242 219 243 end if 220 244 ----------------------------------------- 221 245 end if 222 ----------------------------------------- 246 247 248 223 249 end if 224 250 225 251 226 252 ---------------------- windows 253 else 254 255 theResult = mDoShellCmd(me, QUOTE & bbdiffpath & QUOTE && QUOTE & tempSrcPath "E&"E& comm, RETURN, 0, 0, 0) 256 257 -------- now write the results of the BBEdit diff back into the script members 258 scrText = mGetTextFromFile(me, tempSrcHFSPath) 259 260 writeBack = 1 261 end if 262 263 264 if writeBack = 1 then 227 265 case memtype of 228 266 … … 245 283 end case 246 284 247 248 249 250 285 end if 251 286 … … 342 377 end if 343 378 344 open thePath 379 380 bbdiffpath = mGetSVNDiffBinaryPath(me) 381 if length(bbdiffpath) then 382 mDoShellCmd(me, QUOTE & bbdiffpath & QUOTE && QUOTE & thePath & QUOTE, RETURN, 0, 0, 0) 383 else 384 open thePath 385 end if 386 345 387 exit 346 388 … … 2940 2982 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2941 2983 2942 on mGet WorkingCopyPath me, movieIdentifier, chooseNewPath, workingCopies, selectMsg2943 2944 movieIdentifier = string(movieIdentifier)2945 if length(movieIdentifier) < 1 then2946 movieIdentifier = the moviepath & the moviename2984 on mGetSVNDiffBinaryPath me, workingCopies 2985 2986 if (mCheckForXtra(me, "budapi") + (mCheckForXtra(me, "Shell") + mCheckForXtra(me, "ff_shell"))) < 2 then 2987 alert "You need the shell xtra and the buddyApi xtra in order to proceed" 2988 return "" 2947 2989 end if 2948 2990 … … 2954 2996 end if 2955 2997 2998 2999 svnBinary = string(workingCopies.getaprop(#svnDiffBinary)) 3000 3001 3002 if baFileExists(svnBinary) <> 1 then svnBinary = "" 3003 3004 3005 if length(svnBinary) < 1 then 3006 3007 alert "There is not yet an application specified to handle file diffs. Please select the applivcation you want to use, e.g. TortoiseMerge in your Tortoise folder, if you are using Tortoise." 3008 svnBinary = mGetFilePathFromUser(me) 3009 if length(svnBinary) < 1 then return "" 3010 3011 end if 3012 3013 if baFileExists(svnBinary) <> 1 then 3014 alert "The path to the svn diff binary seems to have changed. Please try again in order to search the path." 3015 svnBinary = "" 3016 end if 3017 3018 3019 3020 workingCopies.setaprop(#svnDiffBinary, svnBinary) 3021 3022 if savePrefs = 1 then setPref("svn_workingCopies_paths.txt", string(workingCopies)) 3023 3024 return svnBinary 3025 3026 end 3027 3028 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 3029 3030 on mGetWorkingCopyPath me, movieIdentifier, chooseNewPath, workingCopies, selectMsg 3031 3032 movieIdentifier = string(movieIdentifier) 3033 if length(movieIdentifier) < 1 then 3034 movieIdentifier = the moviepath & the moviename 3035 end if 3036 3037 savePrefs = 0 3038 if ilk(workingCopies) <> #proplist then 3039 workingCopies = value(getPref("svn_workingCopies_paths.txt")) 3040 if ilk(workingCopies) <> #proplist then workingCopies = [:] 3041 savePrefs = 1 3042 end if 3043 2956 3044 workingFolder = string(workingCopies.getaprop(movieIdentifier)) 2957 3045
Note: See TracChangeset
for help on using the changeset viewer.
