Mercurial > hg > sonic-visualiser
comparison vext.sml @ 1758:42d57c382e56
Update Vext
author | Chris Cannam |
---|---|
date | Mon, 11 Dec 2017 13:23:37 +0000 |
parents | edaa018a3731 |
children | cd10346cc810 |
comparison
equal
deleted
inserted
replaced
1757:d634e253071a | 1758:42d57c382e56 |
---|---|
174 (** Check out, i.e. clone a fresh copy of, the repo for the given | 174 (** Check out, i.e. clone a fresh copy of, the repo for the given |
175 library on the given branch *) | 175 library on the given branch *) |
176 val checkout : context -> libname * source * branch -> unit result | 176 val checkout : context -> libname * source * branch -> unit result |
177 | 177 |
178 (** Update the library to the given branch tip. Assumes that a | 178 (** Update the library to the given branch tip. Assumes that a |
179 local copy of the library already exists. Return the new id *) | 179 local copy of the library already exists *) |
180 val update : context -> libname * source * branch -> id_or_tag result | 180 val update : context -> libname * source * branch -> unit result |
181 | 181 |
182 (** Update the library to the given specific id or tag *) | 182 (** Update the library to the given specific id or tag *) |
183 val update_to : context -> libname * source * id_or_tag -> id_or_tag result | 183 val update_to : context -> libname * source * id_or_tag -> unit result |
184 | 184 |
185 (** Return a URL from which the library can be cloned, given that | 185 (** Return a URL from which the library can be cloned, given that |
186 the local copy already exists. For a DVCS this can be the | 186 the local copy already exists. For a DVCS this can be the |
187 local copy, but for a centralised VCS it will have to be the | 187 local copy, but for a centralised VCS it will have to be the |
188 remote repository URL. Used for archiving *) | 188 remote repository URL. Used for archiving *) |
190 end | 190 end |
191 | 191 |
192 signature LIB_CONTROL = sig | 192 signature LIB_CONTROL = sig |
193 val review : context -> libspec -> (libstate * localstate) result | 193 val review : context -> libspec -> (libstate * localstate) result |
194 val status : context -> libspec -> (libstate * localstate) result | 194 val status : context -> libspec -> (libstate * localstate) result |
195 val update : context -> libspec -> id_or_tag result | 195 val update : context -> libspec -> unit result |
196 val id_of : context -> libspec -> id_or_tag result | 196 val id_of : context -> libspec -> id_or_tag result |
197 end | 197 end |
198 | 198 |
199 structure FileBits :> sig | 199 structure FileBits :> sig |
200 val extpath : context -> string | 200 val extpath : context -> string |
552 ({ libname, source, branch, | 552 ({ libname, source, branch, |
553 project_pin, lock_pin, ... } : libspec) = | 553 project_pin, lock_pin, ... } : libspec) = |
554 let fun update_unpinned () = | 554 let fun update_unpinned () = |
555 case V.is_newest context (libname, source, branch) of | 555 case V.is_newest context (libname, source, branch) of |
556 ERROR e => ERROR e | 556 ERROR e => ERROR e |
557 | OK true => V.id_of context libname | 557 | OK true => OK () |
558 | OK false => V.update context (libname, source, branch) | 558 | OK false => V.update context (libname, source, branch) |
559 fun update_pinned target = | 559 fun update_pinned target = |
560 case V.is_at context (libname, target) of | 560 case V.is_at context (libname, target) of |
561 ERROR e => ERROR e | 561 ERROR e => ERROR e |
562 | OK true => OK target | 562 | OK true => OK () |
563 | OK false => V.update_to context (libname, source, target) | 563 | OK false => V.update_to context (libname, source, target) |
564 fun update' () = | 564 fun update' () = |
565 case lock_pin of | 565 case lock_pin of |
566 PINNED target => update_pinned target | 566 PINNED target => update_pinned target |
567 | UNPINNED => | 567 | UNPINNED => |
1334 case hg_command context libname ["update", branch_name branch] of | 1334 case hg_command context libname ["update", branch_name branch] of |
1335 ERROR e => ERROR e | 1335 ERROR e => ERROR e |
1336 | _ => | 1336 | _ => |
1337 case pull_result of | 1337 case pull_result of |
1338 ERROR e => ERROR e | 1338 ERROR e => ERROR e |
1339 | _ => id_of context libname | 1339 | _ => OK () |
1340 end | 1340 end |
1341 | 1341 |
1342 fun update_to context (libname, _, "") = | 1342 fun update_to context (libname, _, "") = |
1343 ERROR "Non-empty id (tag or revision id) required for update_to" | 1343 ERROR "Non-empty id (tag or revision id) required for update_to" |
1344 | update_to context (libname, source, id) = | 1344 | update_to context (libname, source, id) = |
1345 let val pull_result = pull context (libname, source) | 1345 let val pull_result = pull context (libname, source) |
1346 in | 1346 in |
1347 case hg_command context libname ["update", "-r", id] of | 1347 case hg_command context libname ["update", "-r", id] of |
1348 OK _ => id_of context libname | 1348 OK _ => OK () |
1349 | ERROR e => | 1349 | ERROR e => |
1350 case pull_result of | 1350 case pull_result of |
1351 ERROR e' => ERROR e' (* this was the ur-error *) | 1351 ERROR e' => ERROR e' (* this was the ur-error *) |
1352 | _ => ERROR e | 1352 | _ => ERROR e |
1353 end | 1353 end |
1505 ERROR e => ERROR e | 1505 ERROR e => ERROR e |
1506 | _ => | 1506 | _ => |
1507 case git_command context libname ["checkout", "--detach", | 1507 case git_command context libname ["checkout", "--detach", |
1508 remote_branch_name branch] of | 1508 remote_branch_name branch] of |
1509 ERROR e => ERROR e | 1509 ERROR e => ERROR e |
1510 | _ => id_of context libname | 1510 | _ => OK () |
1511 | 1511 |
1512 (* This function is dealing with a specific id or tag, so if we | 1512 (* This function is dealing with a specific id or tag, so if we |
1513 can successfully check it out (detached) then that's all we | 1513 can successfully check it out (detached) then that's all we |
1514 need to do, regardless of whether fetch succeeded or not. We do | 1514 need to do, regardless of whether fetch succeeded or not. We do |
1515 attempt the fetch first, though, purely in order to avoid ugly | 1515 attempt the fetch first, though, purely in order to avoid ugly |
1521 ERROR "Non-empty id (tag or revision id) required for update_to" | 1521 ERROR "Non-empty id (tag or revision id) required for update_to" |
1522 | update_to context (libname, source, id) = | 1522 | update_to context (libname, source, id) = |
1523 let val fetch_result = fetch context (libname, source) | 1523 let val fetch_result = fetch context (libname, source) |
1524 in | 1524 in |
1525 case git_command context libname ["checkout", "--detach", id] of | 1525 case git_command context libname ["checkout", "--detach", id] of |
1526 OK _ => id_of context libname | 1526 OK _ => OK () |
1527 | ERROR e => | 1527 | ERROR e => |
1528 case fetch_result of | 1528 case fetch_result of |
1529 ERROR e' => ERROR e' (* this was the ur-error *) | 1529 ERROR e' => ERROR e' (* this was the ur-error *) |
1530 | _ => ERROR e | 1530 | _ => ERROR e |
1531 end | 1531 end |
1628 | 1628 |
1629 fun update context (libname, source, branch) = | 1629 fun update context (libname, source, branch) = |
1630 case svn_command context libname | 1630 case svn_command context libname |
1631 ["update", "--accept", "postpone"] of | 1631 ["update", "--accept", "postpone"] of |
1632 ERROR e => ERROR e | 1632 ERROR e => ERROR e |
1633 | _ => id_of context libname | 1633 | _ => OK () |
1634 | 1634 |
1635 fun update_to context (libname, _, "") = | 1635 fun update_to context (libname, _, "") = |
1636 ERROR "Non-empty id (tag or revision id) required for update_to" | 1636 ERROR "Non-empty id (tag or revision id) required for update_to" |
1637 | update_to context (libname, source, id) = | 1637 | update_to context (libname, source, id) = |
1638 case svn_command context libname | 1638 case svn_command context libname |
1639 ["update", "-r", id, "--accept", "postpone"] of | 1639 ["update", "-r", id, "--accept", "postpone"] of |
1640 ERROR e => ERROR e | 1640 ERROR e => ERROR e |
1641 | OK _ => id_of context libname | 1641 | OK _ => OK () |
1642 | 1642 |
1643 fun copy_url_for context libname = | 1643 fun copy_url_for context libname = |
1644 svn_info_item context libname "URL" | 1644 svn_info_item context libname "URL" |
1645 | 1645 |
1646 end | 1646 end |
1812 } | 1812 } |
1813 in | 1813 in |
1814 foldl (fn (lib, acc) => | 1814 foldl (fn (lib, acc) => |
1815 case acc of | 1815 case acc of |
1816 ERROR e => ERROR e | 1816 ERROR e => ERROR e |
1817 | OK _ => AnyLibControl.update synthetic_context lib) | 1817 | OK () => AnyLibControl.update synthetic_context lib) |
1818 (OK "") | 1818 (OK ()) |
1819 (#libs project) | 1819 (#libs project) |
1820 end | 1820 end |
1821 | 1821 |
1822 datatype packer = TAR | 1822 datatype packer = TAR |
1823 | TAR_GZ | 1823 | TAR_GZ |