Showing 1 changed files with 17 additions and 17 deletions
+17 -17
.fgfs/fgaddon
... ...
@@ -122,10 +122,10 @@ set +x
122 122
                         revauthor text,
123 123
                         revdate integer
124 124
                     )"
125
-    for revkey in ${!revision[@]}; do
125
+    for revkey in ${!revindex[@]}; do
126 126
         sqlite_request "insert into recover_rev values (
127 127
                             '$revkey',
128
-                            ${revision[$revkey]:-0},
128
+                            ${revindex[$revkey]:-0},
129 129
                             '${revauthor[$revkey]}',
130 130
                             ${revdate[$revkey]:-0}
131 131
                         )"
... ...
@@ -144,15 +144,15 @@ set +x
144 144
 }
145 145
 
146 146
 function update_database () {
147
-    echo "[ ${#revision[@]} ] ${ac:1}"
147
+    echo "[ ${#revindex[@]} ] ${ac:1}"
148 148
 
149 149
     dbupdate=$(sqlite_request "select revision from aircrafts where name is '${ac:1}'")
150 150
     if test -z "$dbupdate"; then
151 151
         sqlite_request "insert into aircrafts (name, revision, date, author)
152
-                        values ('${ac:1}', ${revision[$ac]}, ${revdate[$ac]}, '${revauthor[$ac]}')"
153
-    elif test $dbupdate -lt ${revision[$ac]}; then
152
+                        values ('${ac:1}', ${revindex[$ac]}, ${revdate[$ac]}, '${revauthor[$ac]}')"
153
+    elif test $dbupdate -lt ${revindex[$ac]}; then
154 154
         sqlite_request "update aircrafts set
155
-                            revision = ${revision[$ac]},
155
+                            revision = ${revindex[$ac]},
156 156
                             author   = '${revauthor[$ac]}',
157 157
                             date = ${revdate[$ac]}
158 158
                         where name is '${ac:1}'"
... ...
@@ -261,11 +261,11 @@ function update_database () {
261 261
         test -n "$ac_save" && ac=$ac_save
262 262
         unset setxmlmodified[${ac:1}/$sx]
263 263
     done
264
-    unset revision[$ac]
264
+    unset revindex[$ac]
265 265
 }
266 266
 
267 267
 function apply_revision () {
268
-    for ac in "${!revision[@]}"; do
268
+    for ac in "${!revindex[@]}"; do
269 269
         update_database
270 270
         if test -d $fgaddon_path/${ac:1}/.svn \
271 271
         && test "$(svn info --show-item=url $fgaddon_path/${ac:1})" != "$fgaddon_svn/${ac:1}" \
... ...
@@ -280,7 +280,7 @@ trap trap_exit EXIT
280 280
 
281 281
 stty -echoctl
282 282
 
283
-declare -A revision revauthor revdate setxmlmodified files revpath
283
+declare -A revindex revauthor revdate setxmlmodified files revpath
284 284
 data_pattern=$(printf "%s|" ${!data[@]})
285 285
 data_pattern=${data_pattern:0:-1}
286 286
 data_test_null=$(printf '${data[%s]}' ${!data[@]})
... ...
@@ -299,7 +299,7 @@ if test -e $database; then
299 299
     fi
300 300
     if sqlite_request '.tables' | grep -q 'recover_' && test -z "$1"; then
301 301
         echo "recovering from previous saved state"
302
-        eval $(sqlite_request "select printf('revision[%s]=%u;revauthor[%s]=%s;revdate[%s]=%u;',
302
+        eval $(sqlite_request "select printf('revindex[%s]=%u;revauthor[%s]=%s;revdate[%s]=%u;',
303 303
                                        revkey, revision,
304 304
                                        revkey, revauthor,
305 305
                                        revkey, revdate)
... ...
@@ -331,7 +331,7 @@ latest_revision=$(sqlite_request "select max(revision) from aircrafts")
331 331
 # for debugging purpose
332 332
 if test -n "$2"; then
333 333
     ac=_${1%/*}
334
-    revision[$ac]=1
334
+    revindex[$ac]=1
335 335
     revdate[$ac]=0
336 336
     revauthor[$ac]=foobar
337 337
     setxmlmodified[${ac:1}/${1#*/}]=1
... ...
@@ -341,14 +341,14 @@ if test -n "$2"; then
341 341
     exit
342 342
 elif test -n "$1"; then
343 343
     ac=_${1%/*}
344
-    eval $(sqlite_request "select printf('revision[_%s]=%s;revdate[_%s]=%i;revauthor[_%s]=%s;',
344
+    eval $(sqlite_request "select printf('revindex[_%s]=%s;revdate[_%s]=%i;revauthor[_%s]=%s;',
345 345
                                             name, revision,
346 346
                                             name, date,
347 347
                                             name, author)
348 348
                            from aircrafts
349 349
                            where name = '${ac:1}'")
350 350
     setxmlmodified[${ac:1}/${1#*/}]=1
351
-    if test -z "${revision[$ac]}"; then
351
+    if test -z "${revindex[$ac]}"; then
352 352
         echo "aircraft ${ac:1} not found"
353 353
         rm $in_ram_database
354 354
         exit
... ...
@@ -389,7 +389,7 @@ while xmlgetnext; do
389 389
                 revpath[$action]+="$VALUE "
390 390
             elif test $kind = 'dir' -a ${#path[@]} -eq 3 -a $action = 'D'; then
391 391
                 files[_${path[2]}]=0
392
-                unset revision[_${path[2]}] revauthor[_${path[2]}] revdate[_${path[2]}]
392
+                unset revindex[_${path[2]}] revauthor[_${path[2]}] revdate[_${path[2]}]
393 393
                 for sx in ${!setxmlmodified[@]}; do
394 394
                     [[ "$sx" =~ "${path[2]}/" ]] && unset setxmlmodified[$sx]
395 395
                 done
... ...
@@ -401,13 +401,13 @@ while xmlgetnext; do
401 401
                 [[ "${path[3]}" =~ "-set.xml" ]] && unset setxmlmodified[${path[2]}/${path[3]/-set.xml}]
402 402
                 files[_${path[2]}]=$(( --files[_${path[2]}] ))
403 403
                 if test ${files[_${path[2]}]} -le 0; then
404
-                    unset revision[_${path[2]}] revauthor[_${path[2]}] revdate[_${path[2]}]
404
+                    unset revindex[_${path[2]}] revauthor[_${path[2]}] revdate[_${path[2]}]
405 405
                 fi
406 406
             done
407 407
             for action in A M R; do
408 408
                 for item in ${revpath[$action]}; do
409 409
                     path=(${item//\// })
410
-                    revision[_${path[2]}]=$revision
410
+                    revindex[_${path[2]}]=$revision
411 411
                     revauthor[_${path[2]}]=$revauthor
412 412
                     revdate[_${path[2]}]=$revdate
413 413
                     [[ "${path[3]}" =~ "-set.xml" ]] && setxmlmodified[${path[2]}/${path[3]/-set.xml}]=1
... ...
@@ -417,7 +417,7 @@ while xmlgetnext; do
417 417
             newprogress=$((++logentry * 100 / $total))
418 418
             if test $(( $newprogress - $progress )) -ge ${progress_granularity:-1}; then
419 419
                 progress=$newprogress
420
-                echo "$progress% (${#revision[@]})"
420
+                echo "$progress% (${#revindex[@]})"
421 421
             fi
422 422
         ;;
423 423
         '/log')