1 ! (c)2009 Joe Groff bsd license
2 USING: fry io io.directories io.encodings.ascii
3 io.encodings.utf8 io.launcher io.pathnames kernel lexer
4 namespaces parser sequences splitting vocabs vocabs.loader ;
8 : git-object-id ( filename rev -- id/f )
9 [ [ parent-directory ] [ file-name ] bi ] dip swap '[
10 { "git" "ls-tree" } _ suffix _ suffix ascii [
12 [ " " split1 nip " " split1 nip "\t" split1 drop ]
17 : with-git-object-stream ( id quot -- )
18 [ { "git" "cat-file" "-p" } swap suffix utf8 ] dip with-process-reader ; inline
21 ERROR: git-revision-not-found path ;
23 : use-vocab-rev ( vocab-name rev -- )
24 [ create-vocab vocab-source-path dup ] dip git-object-id
25 [ [ input-stream get swap parse-stream call( -- ) ] with-git-object-stream ]
26 [ git-revision-not-found ] if* ;
28 SYNTAX: USE-REV: scan-token scan-token use-vocab-rev ;