Changeset 151 for trunk/lingosource/castlib1/svn_Utilities.ls
- Timestamp:
- 02/19/08 13:54:27 (4 years ago)
- File:
-
- 1 edited
-
trunk/lingosource/castlib1/svn_Utilities.ls (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lingosource/castlib1/svn_Utilities.ls
r148 r151 90 90 91 91 92 tempSrcHFSPath = mGetTempFilePath(me, "temp_SVN_Diff_file1.ls") 93 92 94 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 95 tempSrcPath = mConvertHfs2unix(me, tempSrcHFSPath) 102 96 else 103 104 tmpfolder = baSysFolder("temp") 105 tempSrcPath = tmpfolder & "temp_SVN_Diff_file1.ls" 106 tempSrcHFSPath = tempSrcPath 97 tempSrcPath = tempSrcHFSPath 107 98 end if 108 99 … … 145 136 146 137 147 148 149 if isMac then 150 151 comm = mConvertHFS2Unix(me, thePath) 152 153 theResult = mDoShellCmd(me, bbdiffpath & " --ignore-curly-quotes --ignore-spaces --wait --resume " "E& tempSrcPath "E&"E& comm "E && "2>&1", RETURN, 0, 1) 154 155 -- since we used the --wait and the --resume switch, we will only come to this line AFTER the diff process in bbedit is finished 156 157 if count(theResult) > 0 then 158 if theResult[1] contains "no such file or directory" then 159 put theResult[1] 160 else 161 put "No differences found for member: " & memref.name && "(" & memref & ")" 162 end if 163 writeBack = 0 164 165 else 166 167 -------- now write the results of the BBEdit diff back into the script members 168 scrText = mGetTextFromFile(me, tempSrcHFSPath) 169 170 writeBack = 1 171 172 173 end if 174 175 176 ---------------------- windows 177 else 178 179 180 theResult = mDoShellCmd(me, QUOTE & bbdiffpath & QUOTE && QUOTE & tempSrcPath "E&"E& thePath "E, RETURN, 0, 0, 0) 181 182 -------- now write the results of the BBEdit diff back into the script members 183 scrText = mGetTextFromFile(me, tempSrcHFSPath) 184 185 writeBack = 1 186 end if 187 188 189 if writeBack = 1 then 190 191 192 if convertLineBreaksToUnix = 1 then 193 ------------------------------------------ trac subversion support works better with unix linebreaks... 194 if mCheckForXtra(me, "Pregex") = 1 then 195 196 scrTextLi = [scrText] 197 ----------- always convert to mac linebreaks as director internally uses mac linebreaks 198 -- if the platform contains "mac" then 199 pregex_replace(scrTextLi, "\x0D?\x0A", "g", "\x0D") 200 -- else 201 -- pregex_replace(scrTextLi, "\x0D([^\x0A])", "g", "\x0D\x0A\1") 202 -- pregex_replace(scrTextLi, "([^\x0D])\x0A", "g", "\1\x0D\x0A") 203 -- end if 204 scrText = scrTextLi[1] 138 if theResult <> 0 then 139 140 141 142 143 if isMac then 144 145 comm = mConvertHFS2Unix(me, thePath) 146 147 theResult = mDoShellCmd(me, bbdiffpath & " --ignore-curly-quotes --ignore-spaces --wait --resume " "E& tempSrcPath "E&"E& comm "E && "2>&1", RETURN, 0, 1) 148 149 -- since we used the --wait and the --resume switch, we will only come to this line AFTER the diff process in bbedit is finished 150 151 if count(theResult) > 0 then 152 if theResult[1] contains "no such file or directory" then 153 put theResult[1] 154 else 155 put "No differences found for member: " & memref.name && "(" & memref & ")" 156 end if 157 writeBack = 0 205 158 206 159 else 207 160 208 -------- --- always convert to mac linebreaks as director internally uses mac linebreaks209 -- if the platform contains "mac" then161 -------- now write the results of the BBEdit diff back into the script members 162 scrText = mGetTextFromFile(me, tempSrcHFSPath) 210 163 211 -- first convert windows to mac 212 fndStr = numToChar(13) & numToChar(10) 213 offs = offset(fndStr, scrText) 214 repeat while offs > 0 215 put numToChar(13) into char offs to offs+1 of scrText 216 offs = offset(fndStr, scrText) 217 end repeat 164 writeBack = 1 218 165 219 -- now convert unix to mac220 fndStr = numToChar(10)221 offs = offset(fndStr, scrText)222 repeat while offs > 0223 put numToChar(13) into char offs of scrText224 offs = offset(fndStr, scrText)225 end repeat226 227 -- else228 --229 -- fndStr = numToChar(13) & numToChar(10)230 -- offs = offset(fndStr, scrText)231 -- repeat while offs > 0232 -- put "ÀÀÀ" into char offs+1 of scrText233 -- offs = offset(fndStr, scrText)234 -- end repeat235 --236 --237 -- fndStr = numToChar(10)238 -- offs = offset(fndStr, scrText)239 -- repeat while offs > 0240 -- put "ÀÀÀ" into char offs of scrText241 -- offs = offset(fndStr, scrText)242 -- end repeat243 --244 --245 --246 -- fndStr = numToChar(13) & "ÀÀÀ"247 -- offs = offset(fndStr, scrText)248 -- repeat while offs > 0249 -- put numToChar(13) & numToChar(10) into char offs to offs+3 of scrText250 -- offs = offset(fndStr, scrText)251 -- end repeat252 --253 --254 --255 -- fndStr = "ÀÀÀ"256 -- offs = offset(fndStr, scrText)257 -- repeat while offs > 0258 -- put numToChar(13) & numToChar(10) into char offs to offs+2 of scrText259 -- offs = offset(fndStr, scrText)260 -- end repeat261 --262 -- end if263 166 264 167 end if 265 ----------------------------------------- 168 169 170 ---------------------- windows 171 else 172 173 174 theResult = mDoShellCmd(me, QUOTE & bbdiffpath & QUOTE && QUOTE & tempSrcPath "E&"E& thePath "E, RETURN, 0, 0, 0) 175 176 -------- now write the results of the BBEdit diff back into the script members 177 scrText = mGetTextFromFile(me, tempSrcHFSPath) 178 179 writeBack = 1 266 180 end if 267 181 268 182 269 270 case memtype of 271 272 ----------------------- 273 #script: 274 memref.scripttext = scrText 275 276 ----------------------- 277 #field: 278 memref.text = scrText 279 280 ----------------------- 281 #text: 282 memref.html = scrText 283 284 ----------------------- 285 otherwise: 286 memref.text = scrText 287 288 end case 183 if writeBack = 1 then 184 185 186 if convertLineBreaksToUnix = 1 then 187 ------------------------------------------ trac subversion support works better with unix linebreaks... 188 if mCheckForXtra(me, "Pregex") = 1 then 189 190 scrTextLi = [scrText] 191 ----------- always convert to mac linebreaks as director internally uses mac linebreaks 192 pregex_replace(scrTextLi, "\x0D?\x0A", "g", "\x0D") 193 scrText = scrTextLi[1] 194 195 else 196 197 ----------- always convert to mac linebreaks as director internally uses mac linebreaks 198 -- if the platform contains "mac" then 199 200 -- first convert windows to mac 201 fndStr = numToChar(13) & numToChar(10) 202 offs = offset(fndStr, scrText) 203 repeat while offs > 0 204 put numToChar(13) into char offs to offs+1 of scrText 205 offs = offset(fndStr, scrText) 206 end repeat 207 208 -- now convert unix to mac 209 fndStr = numToChar(10) 210 offs = offset(fndStr, scrText) 211 repeat while offs > 0 212 put numToChar(13) into char offs of scrText 213 offs = offset(fndStr, scrText) 214 end repeat 215 216 217 end if 218 ----------------------------------------- 219 end if 220 221 222 223 case memtype of 224 225 ----------------------- 226 #script: 227 memref.scripttext = scrText 228 229 ----------------------- 230 #field: 231 memref.text = scrText 232 233 ----------------------- 234 #text: 235 memref.html = scrText 236 237 ----------------------- 238 otherwise: 239 memref.text = scrText 240 241 end case 242 243 end if 289 244 290 245 end if
Note: See TracChangeset
for help on using the changeset viewer.
