kibi-swipl-linux-x64-gnu 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/bin/swipl +0 -0
- package/bin/swipl-win +0 -0
- package/build-manifest.json +70 -0
- package/lib/cmake/swipl/SWIPLConfig.cmake +21 -0
- package/lib/cmake/swipl/SWIPLConfigVersion.cmake +65 -0
- package/lib/cmake/swipl/SWIPLTargets-release.cmake +28 -0
- package/lib/cmake/swipl/SWIPLTargets.cmake +109 -0
- package/lib/swipl/ABI +1 -0
- package/lib/swipl/LICENSE +41 -0
- package/lib/swipl/README.md +116 -0
- package/lib/swipl/app/README.md +25 -0
- package/lib/swipl/app/app.pl +87 -0
- package/lib/swipl/app/pack.pl +350 -0
- package/lib/swipl/app/qlf.pl +521 -0
- package/lib/swipl/app/splfr.pl +177 -0
- package/lib/swipl/app/sys.pl +310 -0
- package/lib/swipl/bin/swipl.home +1 -0
- package/lib/swipl/boot/apply.pl +73 -0
- package/lib/swipl/boot/attvar.pl +344 -0
- package/lib/swipl/boot/autoload.pl +1226 -0
- package/lib/swipl/boot/bags.pl +283 -0
- package/lib/swipl/boot/dcg.pl +388 -0
- package/lib/swipl/boot/dicts.pl +193 -0
- package/lib/swipl/boot/dwim.pl +485 -0
- package/lib/swipl/boot/engines.pl +152 -0
- package/lib/swipl/boot/expand.pl +1628 -0
- package/lib/swipl/boot/gc.pl +65 -0
- package/lib/swipl/boot/history.pl +304 -0
- package/lib/swipl/boot/init.pl +4682 -0
- package/lib/swipl/boot/iri.pl +64 -0
- package/lib/swipl/boot/license.pl +390 -0
- package/lib/swipl/boot/load.pl +81 -0
- package/lib/swipl/boot/messages.pl +2521 -0
- package/lib/swipl/boot/packs.pl +306 -0
- package/lib/swipl/boot/predopts.pl +154 -0
- package/lib/swipl/boot/qlf.pl +141 -0
- package/lib/swipl/boot/rc.pl +263 -0
- package/lib/swipl/boot/syspred.pl +1634 -0
- package/lib/swipl/boot/tabling.pl +2321 -0
- package/lib/swipl/boot/threads.pl +42 -0
- package/lib/swipl/boot/toplevel.pl +2248 -0
- package/lib/swipl/boot/topvars.pl +261 -0
- package/lib/swipl/boot.prc +0 -0
- package/lib/swipl/cmake/swipl.cmake +131 -0
- package/lib/swipl/customize/README.md +23 -0
- package/lib/swipl/customize/edit +101 -0
- package/lib/swipl/customize/init.pl +164 -0
- package/lib/swipl/demo/README.md +33 -0
- package/lib/swipl/demo/likes.pl +44 -0
- package/lib/swipl/doc/packages/examples/chr/bool.chr +281 -0
- package/lib/swipl/doc/packages/examples/chr/chrdif.chr +87 -0
- package/lib/swipl/doc/packages/examples/chr/chrfreeze.chr +6 -0
- package/lib/swipl/doc/packages/examples/chr/family.chr +116 -0
- package/lib/swipl/doc/packages/examples/chr/fib.chr +24 -0
- package/lib/swipl/doc/packages/examples/chr/fibonacci.chr +31 -0
- package/lib/swipl/doc/packages/examples/chr/gcd.chr +28 -0
- package/lib/swipl/doc/packages/examples/chr/leq.chr +34 -0
- package/lib/swipl/doc/packages/examples/chr/listdom.chr +138 -0
- package/lib/swipl/doc/packages/examples/chr/primes.chr +29 -0
- package/lib/swipl/doc/packages/examples/http/README.md +98 -0
- package/lib/swipl/doc/packages/examples/http/calc.pl +92 -0
- package/lib/swipl/doc/packages/examples/http/demo_body.pl +232 -0
- package/lib/swipl/doc/packages/examples/http/demo_client.pl +165 -0
- package/lib/swipl/doc/packages/examples/http/demo_daemon.pl +38 -0
- package/lib/swipl/doc/packages/examples/http/demo_files.pl +50 -0
- package/lib/swipl/doc/packages/examples/http/demo_hello.pl +15 -0
- package/lib/swipl/doc/packages/examples/http/demo_login.pl +280 -0
- package/lib/swipl/doc/packages/examples/http/demo_openid.pl +177 -0
- package/lib/swipl/doc/packages/examples/http/demo_pwp.pl +20 -0
- package/lib/swipl/doc/packages/examples/http/demo_rest.pl +56 -0
- package/lib/swipl/doc/packages/examples/http/demo_threads.pl +52 -0
- package/lib/swipl/doc/packages/examples/http/linux-init-script +126 -0
- package/lib/swipl/doc/packages/examples/http/pwp/context.pwp +23 -0
- package/lib/swipl/doc/packages/examples/http/pwp/index.pwp +25 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp1.pwp +12 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp2.pwp +10 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp3.pwp +25 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp4.pwp +23 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp5.pwp +11 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp6.pwp +3 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp7.pwp +3 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp8.pwp +3 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwpdb.pl +12 -0
- package/lib/swipl/doc/packages/examples/http/systemd-script.service +18 -0
- package/lib/swipl/doc/packages/examples/http/upstart-script.conf +20 -0
- package/lib/swipl/doc/packages/examples/plunit/read.pl +17 -0
- package/lib/swipl/doc/packages/examples/plunit/simple.pl +33 -0
- package/lib/swipl/doc/packages/examples/ssl/client.pl +83 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/README +52 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/client/client-cert.p12 +0 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/client/client-cert.pem +85 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/client/client-key.pem +30 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/cacert.pem +82 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/careq.pem +18 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/crlnumber +1 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/index.txt +3 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/index.txt.attr +1 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/newcerts/9DC08797A0F63F7C.pem +85 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/newcerts/9DC08797A0F63F7D.pem +85 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/private/cakey.pem +30 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/serial +1 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/server/server-cert.pem +85 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/server/server-key.pem +30 -0
- package/lib/swipl/doc/packages/examples/ssl/https.pl +267 -0
- package/lib/swipl/doc/packages/examples/ssl/server.pl +106 -0
- package/lib/swipl/include/SWI-Prolog.h +1544 -0
- package/lib/swipl/include/SWI-Stream.h +537 -0
- package/lib/swipl/include/Yap/YapInterface.h +283 -0
- package/lib/swipl/include/sicstus/sicstus.h +452 -0
- package/lib/swipl/lib/x86_64-linux/cgi.so +0 -0
- package/lib/swipl/lib/x86_64-linux/crypt.so +0 -0
- package/lib/swipl/lib/x86_64-linux/crypto4pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/double_metaphone.so +0 -0
- package/lib/swipl/lib/x86_64-linux/files.so +0 -0
- package/lib/swipl/lib/x86_64-linux/hashstream.so +0 -0
- package/lib/swipl/lib/x86_64-linux/http_stream.so +0 -0
- package/lib/swipl/lib/x86_64-linux/isub.so +0 -0
- package/lib/swipl/lib/x86_64-linux/json.so +0 -0
- package/lib/swipl/lib/x86_64-linux/libswipl.so.10 +0 -0
- package/lib/swipl/lib/x86_64-linux/mallocinfo.so +0 -0
- package/lib/swipl/lib/x86_64-linux/md54pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/memfile.so +0 -0
- package/lib/swipl/lib/x86_64-linux/ntriples.so +0 -0
- package/lib/swipl/lib/x86_64-linux/pcre4pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/porter_stem.so +0 -0
- package/lib/swipl/lib/x86_64-linux/process.so +0 -0
- package/lib/swipl/lib/x86_64-linux/prolog_stream.so +0 -0
- package/lib/swipl/lib/x86_64-linux/rdf_db.so +0 -0
- package/lib/swipl/lib/x86_64-linux/readutil.so +0 -0
- package/lib/swipl/lib/x86_64-linux/rlimit.so +0 -0
- package/lib/swipl/lib/x86_64-linux/sched.so +0 -0
- package/lib/swipl/lib/x86_64-linux/sgml2pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/sha4pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/snowball.so +0 -0
- package/lib/swipl/lib/x86_64-linux/socket.so +0 -0
- package/lib/swipl/lib/x86_64-linux/ssl4pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/streaminfo.so +0 -0
- package/lib/swipl/lib/x86_64-linux/syslog.so +0 -0
- package/lib/swipl/lib/x86_64-linux/time.so +0 -0
- package/lib/swipl/lib/x86_64-linux/turtle.so +0 -0
- package/lib/swipl/lib/x86_64-linux/uid.so +0 -0
- package/lib/swipl/lib/x86_64-linux/unix.so +0 -0
- package/lib/swipl/lib/x86_64-linux/uri.so +0 -0
- package/lib/swipl/lib/x86_64-linux/websocket.so +0 -0
- package/lib/swipl/lib/x86_64-linux/zlib4pl.so +0 -0
- package/lib/swipl/library/INDEX.pl +1020 -0
- package/lib/swipl/library/aggregate.pl +755 -0
- package/lib/swipl/library/ansi_term.pl +653 -0
- package/lib/swipl/library/apply.pl +426 -0
- package/lib/swipl/library/apply_macros.pl +497 -0
- package/lib/swipl/library/arithmetic.pl +320 -0
- package/lib/swipl/library/assoc.pl +522 -0
- package/lib/swipl/library/atom.pl +169 -0
- package/lib/swipl/library/backcomp.pl +688 -0
- package/lib/swipl/library/base32.pl +291 -0
- package/lib/swipl/library/base64.pl +441 -0
- package/lib/swipl/library/broadcast.pl +161 -0
- package/lib/swipl/library/build/cmake.pl +137 -0
- package/lib/swipl/library/build/conan.pl +232 -0
- package/lib/swipl/library/build/make.pl +168 -0
- package/lib/swipl/library/build/tools.pl +825 -0
- package/lib/swipl/library/charsio.pl +195 -0
- package/lib/swipl/library/check.pl +1097 -0
- package/lib/swipl/library/check_installation.pl +912 -0
- package/lib/swipl/library/clp/INDEX.pl +157 -0
- package/lib/swipl/library/clp/bounds.pl +2036 -0
- package/lib/swipl/library/clp/clp_distinct.pl +263 -0
- package/lib/swipl/library/clp/clp_events.pl +92 -0
- package/lib/swipl/library/clp/clpb.pl +1896 -0
- package/lib/swipl/library/clp/clpfd.pl +7906 -0
- package/lib/swipl/library/clp/simplex.pl +1580 -0
- package/lib/swipl/library/codesio.pl +182 -0
- package/lib/swipl/library/coinduction.pl +183 -0
- package/lib/swipl/library/console_input.pl +289 -0
- package/lib/swipl/library/csv.pl +611 -0
- package/lib/swipl/library/ctypes.pl +161 -0
- package/lib/swipl/library/date.pl +370 -0
- package/lib/swipl/library/dcg/INDEX.pl +35 -0
- package/lib/swipl/library/dcg/basics.pl +514 -0
- package/lib/swipl/library/dcg/high_order.pl +227 -0
- package/lib/swipl/library/debug.pl +499 -0
- package/lib/swipl/library/dialect/bim.pl +186 -0
- package/lib/swipl/library/dialect/commons.pl +77 -0
- package/lib/swipl/library/dialect/eclipse/test_util_iso.pl +355 -0
- package/lib/swipl/library/dialect/hprolog/format.pl +44 -0
- package/lib/swipl/library/dialect/hprolog.pl +314 -0
- package/lib/swipl/library/dialect/ifprolog.pl +1317 -0
- package/lib/swipl/library/dialect/iso/iso_predicates.pl +277 -0
- package/lib/swipl/library/dialect/sicstus/README.TXT +1 -0
- package/lib/swipl/library/dialect/sicstus/arrays.pl +121 -0
- package/lib/swipl/library/dialect/sicstus/block.pl +278 -0
- package/lib/swipl/library/dialect/sicstus/lists.pl +167 -0
- package/lib/swipl/library/dialect/sicstus/ordsets.pl +52 -0
- package/lib/swipl/library/dialect/sicstus/sockets.pl +174 -0
- package/lib/swipl/library/dialect/sicstus/system.pl +262 -0
- package/lib/swipl/library/dialect/sicstus/terms.pl +57 -0
- package/lib/swipl/library/dialect/sicstus/timeout.pl +92 -0
- package/lib/swipl/library/dialect/sicstus.pl +582 -0
- package/lib/swipl/library/dialect/sicstus4/aggregate.pl +60 -0
- package/lib/swipl/library/dialect/sicstus4/between.pl +62 -0
- package/lib/swipl/library/dialect/sicstus4/clpfd.pl +75 -0
- package/lib/swipl/library/dialect/sicstus4/file_systems.pl +413 -0
- package/lib/swipl/library/dialect/sicstus4/lists.pl +274 -0
- package/lib/swipl/library/dialect/sicstus4/ordsets.pl +54 -0
- package/lib/swipl/library/dialect/sicstus4/samsort.pl +86 -0
- package/lib/swipl/library/dialect/sicstus4/sets.pl +124 -0
- package/lib/swipl/library/dialect/sicstus4/sockets.pl +164 -0
- package/lib/swipl/library/dialect/sicstus4/system.pl +80 -0
- package/lib/swipl/library/dialect/sicstus4/terms.pl +89 -0
- package/lib/swipl/library/dialect/sicstus4/timeout.pl +43 -0
- package/lib/swipl/library/dialect/sicstus4/types.pl +103 -0
- package/lib/swipl/library/dialect/sicstus4.pl +200 -0
- package/lib/swipl/library/dialect/swi/syspred_options.pl +250 -0
- package/lib/swipl/library/dialect/xsb/README.md +20 -0
- package/lib/swipl/library/dialect/xsb/basics.pl +318 -0
- package/lib/swipl/library/dialect/xsb/consult.pl +87 -0
- package/lib/swipl/library/dialect/xsb/curr_sym.pl +57 -0
- package/lib/swipl/library/dialect/xsb/error_handler.pl +111 -0
- package/lib/swipl/library/dialect/xsb/gensym.pl +53 -0
- package/lib/swipl/library/dialect/xsb/gpp.pl +138 -0
- package/lib/swipl/library/dialect/xsb/intern.pl +48 -0
- package/lib/swipl/library/dialect/xsb/lists.pl +47 -0
- package/lib/swipl/library/dialect/xsb/machine.pl +295 -0
- package/lib/swipl/library/dialect/xsb/ordsets.pl +53 -0
- package/lib/swipl/library/dialect/xsb/setof.pl +54 -0
- package/lib/swipl/library/dialect/xsb/source.pl +308 -0
- package/lib/swipl/library/dialect/xsb/standard.pl +169 -0
- package/lib/swipl/library/dialect/xsb/storage.pl +70 -0
- package/lib/swipl/library/dialect/xsb/string.pl +76 -0
- package/lib/swipl/library/dialect/xsb/thread.pl +62 -0
- package/lib/swipl/library/dialect/xsb/timed_call.pl +158 -0
- package/lib/swipl/library/dialect/xsb.pl +688 -0
- package/lib/swipl/library/dialect/yap/README.TXT +8 -0
- package/lib/swipl/library/dialect/yap.pl +283 -0
- package/lib/swipl/library/dialect.pl +123 -0
- package/lib/swipl/library/dicts.pl +399 -0
- package/lib/swipl/library/dif.pl +426 -0
- package/lib/swipl/library/edinburgh.pl +138 -0
- package/lib/swipl/library/edit.pl +783 -0
- package/lib/swipl/library/error.pl +495 -0
- package/lib/swipl/library/exceptions.pl +231 -0
- package/lib/swipl/library/explain.pl +543 -0
- package/lib/swipl/library/ext/RDF/INDEX.pl +25 -0
- package/lib/swipl/library/ext/RDF/rdf.pl +450 -0
- package/lib/swipl/library/ext/RDF/rdf_parser.pl +649 -0
- package/lib/swipl/library/ext/RDF/rdf_triple.pl +448 -0
- package/lib/swipl/library/ext/RDF/rdf_write.pl +701 -0
- package/lib/swipl/library/ext/RDF/rewrite_term.pl +177 -0
- package/lib/swipl/library/ext/chr/chr/a_star.pl +80 -0
- package/lib/swipl/library/ext/chr/chr/binomialheap.pl +142 -0
- package/lib/swipl/library/ext/chr/chr/builtins.pl +629 -0
- package/lib/swipl/library/ext/chr/chr/chr_compiler_errors.pl +179 -0
- package/lib/swipl/library/ext/chr/chr/chr_compiler_options.pl +382 -0
- package/lib/swipl/library/ext/chr/chr/chr_compiler_utility.pl +338 -0
- package/lib/swipl/library/ext/chr/chr/chr_debug.pl +59 -0
- package/lib/swipl/library/ext/chr/chr/chr_hashtable_store.pl +425 -0
- package/lib/swipl/library/ext/chr/chr/chr_integertable_store.pl +139 -0
- package/lib/swipl/library/ext/chr/chr/chr_messages.pl +176 -0
- package/lib/swipl/library/ext/chr/chr/chr_op.pl +53 -0
- package/lib/swipl/library/ext/chr/chr/chr_runtime.pl +1016 -0
- package/lib/swipl/library/ext/chr/chr/chr_translate.pl +25424 -0
- package/lib/swipl/library/ext/chr/chr/clean_code.pl +252 -0
- package/lib/swipl/library/ext/chr/chr/find.pl +78 -0
- package/lib/swipl/library/ext/chr/chr/guard_entailment.pl +19432 -0
- package/lib/swipl/library/ext/chr/chr/listmap.pl +108 -0
- package/lib/swipl/library/ext/chr/chr/pairlist.pl +78 -0
- package/lib/swipl/library/ext/chr/chr.pl +686 -0
- package/lib/swipl/library/ext/clib/INDEX.pl +158 -0
- package/lib/swipl/library/ext/clib/cgi.pl +86 -0
- package/lib/swipl/library/ext/clib/crypt.pl +44 -0
- package/lib/swipl/library/ext/clib/filesex.pl +644 -0
- package/lib/swipl/library/ext/clib/hash_stream.pl +119 -0
- package/lib/swipl/library/ext/clib/mallocinfo.pl +138 -0
- package/lib/swipl/library/ext/clib/md5.pl +68 -0
- package/lib/swipl/library/ext/clib/memfile.pl +61 -0
- package/lib/swipl/library/ext/clib/process.pl +573 -0
- package/lib/swipl/library/ext/clib/prolog_server.pl +157 -0
- package/lib/swipl/library/ext/clib/prolog_stream.pl +80 -0
- package/lib/swipl/library/ext/clib/rlimit.pl +54 -0
- package/lib/swipl/library/ext/clib/sched.pl +85 -0
- package/lib/swipl/library/ext/clib/sha.pl +162 -0
- package/lib/swipl/library/ext/clib/socket.pl +1102 -0
- package/lib/swipl/library/ext/clib/streaminfo.pl +103 -0
- package/lib/swipl/library/ext/clib/streampool.pl +136 -0
- package/lib/swipl/library/ext/clib/syslog.pl +180 -0
- package/lib/swipl/library/ext/clib/time.pl +194 -0
- package/lib/swipl/library/ext/clib/udp_broadcast.pl +975 -0
- package/lib/swipl/library/ext/clib/uid.pl +220 -0
- package/lib/swipl/library/ext/clib/unix.pl +317 -0
- package/lib/swipl/library/ext/clib/uri.pl +530 -0
- package/lib/swipl/library/ext/clib/uuid.pl +207 -0
- package/lib/swipl/library/ext/http/http/INDEX.pl +266 -0
- package/lib/swipl/library/ext/http/http/README.md +34 -0
- package/lib/swipl/library/ext/http/http/ax.pl +189 -0
- package/lib/swipl/library/ext/http/http/dcg_basics.pl +49 -0
- package/lib/swipl/library/ext/http/http/graphql.pl +1367 -0
- package/lib/swipl/library/ext/http/http/html_decl.pl +416 -0
- package/lib/swipl/library/ext/http/http/html_head.pl +654 -0
- package/lib/swipl/library/ext/http/http/html_quasiquotations.pl +120 -0
- package/lib/swipl/library/ext/http/http/html_write.pl +1425 -0
- package/lib/swipl/library/ext/http/http/htmx.pl +139 -0
- package/lib/swipl/library/ext/http/http/http_authenticate.pl +364 -0
- package/lib/swipl/library/ext/http/http/http_client.pl +412 -0
- package/lib/swipl/library/ext/http/http/http_cookie.pl +245 -0
- package/lib/swipl/library/ext/http/http/http_cors.pl +176 -0
- package/lib/swipl/library/ext/http/http/http_digest.pl +820 -0
- package/lib/swipl/library/ext/http/http/http_dirindex.pl +296 -0
- package/lib/swipl/library/ext/http/http/http_dispatch.pl +1552 -0
- package/lib/swipl/library/ext/http/http/http_dyn_workers.pl +214 -0
- package/lib/swipl/library/ext/http/http/http_error.pl +126 -0
- package/lib/swipl/library/ext/http/http/http_exception.pl +225 -0
- package/lib/swipl/library/ext/http/http/http_files.pl +163 -0
- package/lib/swipl/library/ext/http/http/http_header.pl +2820 -0
- package/lib/swipl/library/ext/http/http/http_hook.pl +106 -0
- package/lib/swipl/library/ext/http/http/http_host.pl +204 -0
- package/lib/swipl/library/ext/http/http/http_load.pl +113 -0
- package/lib/swipl/library/ext/http/http/http_log.pl +738 -0
- package/lib/swipl/library/ext/http/http/http_multipart_plugin.pl +232 -0
- package/lib/swipl/library/ext/http/http/http_open.pl +1821 -0
- package/lib/swipl/library/ext/http/http/http_openid.pl +1561 -0
- package/lib/swipl/library/ext/http/http/http_parameters.pl +504 -0
- package/lib/swipl/library/ext/http/http/http_path.pl +380 -0
- package/lib/swipl/library/ext/http/http/http_proxy.pl +80 -0
- package/lib/swipl/library/ext/http/http/http_pwp.pl +351 -0
- package/lib/swipl/library/ext/http/http/http_redis_plugin.pl +332 -0
- package/lib/swipl/library/ext/http/http/http_server.pl +105 -0
- package/lib/swipl/library/ext/http/http/http_server_files.pl +126 -0
- package/lib/swipl/library/ext/http/http/http_server_health.pl +186 -0
- package/lib/swipl/library/ext/http/http/http_session.pl +1040 -0
- package/lib/swipl/library/ext/http/http/http_sgml_plugin.pl +137 -0
- package/lib/swipl/library/ext/http/http/http_stream.pl +376 -0
- package/lib/swipl/library/ext/http/http/http_unix_daemon.pl +989 -0
- package/lib/swipl/library/ext/http/http/http_wrapper.pl +559 -0
- package/lib/swipl/library/ext/http/http/hub.pl +600 -0
- package/lib/swipl/library/ext/http/http/js_write.pl +461 -0
- package/lib/swipl/library/ext/http/http/mimepack.pl +224 -0
- package/lib/swipl/library/ext/http/http/mimetype.pl +276 -0
- package/lib/swipl/library/ext/http/http/term_html.pl +797 -0
- package/lib/swipl/library/ext/http/http/thread_httpd.pl +1181 -0
- package/lib/swipl/library/ext/http/http/web/css/dirindex.css +24 -0
- package/lib/swipl/library/ext/http/http/web/css/openid.css +57 -0
- package/lib/swipl/library/ext/http/http/web/icons/back.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/c.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/compressed.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/folder.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/generic.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/layout.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/openid-logo-square.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/openid-logo-tiny.png +0 -0
- package/lib/swipl/library/ext/http/http/websocket.pl +729 -0
- package/lib/swipl/library/ext/http/http/yadis.pl +205 -0
- package/lib/swipl/library/ext/json/INDEX.pl +36 -0
- package/lib/swipl/library/ext/json/http/INDEX.pl +16 -0
- package/lib/swipl/library/ext/json/http/http_json.pl +490 -0
- package/lib/swipl/library/ext/json/http/js_grammar.pl +53 -0
- package/lib/swipl/library/ext/json/http/json.pl +48 -0
- package/lib/swipl/library/ext/json/http/json_convert.pl +48 -0
- package/lib/swipl/library/ext/json/json.pl +1215 -0
- package/lib/swipl/library/ext/json/json_convert.pl +681 -0
- package/lib/swipl/library/ext/json/json_grammar.pl +349 -0
- package/lib/swipl/library/ext/json/json_rpc_client.pl +423 -0
- package/lib/swipl/library/ext/json/json_rpc_common.pl +104 -0
- package/lib/swipl/library/ext/json/json_rpc_server.pl +489 -0
- package/lib/swipl/library/ext/json/json_schema.pl +2111 -0
- package/lib/swipl/library/ext/nlp/INDEX.pl +15 -0
- package/lib/swipl/library/ext/nlp/double_metaphone.pl +86 -0
- package/lib/swipl/library/ext/nlp/isub.pl +162 -0
- package/lib/swipl/library/ext/nlp/porter_stem.pl +50 -0
- package/lib/swipl/library/ext/nlp/snowball.pl +97 -0
- package/lib/swipl/library/ext/pcre/INDEX.pl +17 -0
- package/lib/swipl/library/ext/pcre/pcre.pl +974 -0
- package/lib/swipl/library/ext/plunit/INDEX.pl +20 -0
- package/lib/swipl/library/ext/plunit/plunit.pl +2631 -0
- package/lib/swipl/library/ext/plunit/test_wizard.pl +249 -0
- package/lib/swipl/library/ext/semweb/semweb/INDEX.pl +288 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf11.pl +2106 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf11_containers.pl +299 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_cache.pl +278 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_compare.pl +132 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_db.pl +3468 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_edit.pl +1145 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_http_plugin.pl +274 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_library.pl +1021 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_litindex.pl +1035 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_ntriples.pl +422 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_persistency.pl +1576 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_portray.pl +182 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_prefixes.pl +681 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_sandbox.pl +153 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_turtle.pl +54 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_turtle_write.pl +1587 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_zlib_plugin.pl +52 -0
- package/lib/swipl/library/ext/semweb/semweb/rdfa.pl +1510 -0
- package/lib/swipl/library/ext/semweb/semweb/rdfs.pl +475 -0
- package/lib/swipl/library/ext/semweb/semweb/sparql_client.pl +643 -0
- package/lib/swipl/library/ext/semweb/semweb/turtle.pl +455 -0
- package/lib/swipl/library/ext/sgml/DTD/HTML4.dcl +88 -0
- package/lib/swipl/library/ext/sgml/DTD/HTML4.dtd +1092 -0
- package/lib/swipl/library/ext/sgml/DTD/HTML4.soc +6 -0
- package/lib/swipl/library/ext/sgml/DTD/HTML5.dtd +906 -0
- package/lib/swipl/library/ext/sgml/DTD/HTMLlat1.ent +195 -0
- package/lib/swipl/library/ext/sgml/DTD/HTMLspec.ent +77 -0
- package/lib/swipl/library/ext/sgml/DTD/HTMLsym.ent +241 -0
- package/lib/swipl/library/ext/sgml/INDEX.pl +64 -0
- package/lib/swipl/library/ext/sgml/c14n2.pl +203 -0
- package/lib/swipl/library/ext/sgml/iso_639.pl +631 -0
- package/lib/swipl/library/ext/sgml/pwp.pl +705 -0
- package/lib/swipl/library/ext/sgml/sgml.pl +815 -0
- package/lib/swipl/library/ext/sgml/sgml_write.pl +1003 -0
- package/lib/swipl/library/ext/sgml/xpath.pl +620 -0
- package/lib/swipl/library/ext/sgml/xsdp_types.pl +232 -0
- package/lib/swipl/library/ext/ssl/INDEX.pl +60 -0
- package/lib/swipl/library/ext/ssl/crypto.pl +1015 -0
- package/lib/swipl/library/ext/ssl/http/INDEX.pl +5 -0
- package/lib/swipl/library/ext/ssl/http/http_ssl_plugin.pl +296 -0
- package/lib/swipl/library/ext/ssl/saml.pl +609 -0
- package/lib/swipl/library/ext/ssl/ssl.pl +647 -0
- package/lib/swipl/library/ext/ssl/xmldsig.pl +391 -0
- package/lib/swipl/library/ext/ssl/xmlenc.pl +354 -0
- package/lib/swipl/library/ext/zlib/INDEX.pl +8 -0
- package/lib/swipl/library/ext/zlib/zlib.pl +112 -0
- package/lib/swipl/library/fastrw.pl +105 -0
- package/lib/swipl/library/files.pl +80 -0
- package/lib/swipl/library/gensym.pl +111 -0
- package/lib/swipl/library/git.pl +1027 -0
- package/lib/swipl/library/hashtable.pl +365 -0
- package/lib/swipl/library/heaps.pl +252 -0
- package/lib/swipl/library/hotfix.pl +239 -0
- package/lib/swipl/library/http/jquery.pl +103 -0
- package/lib/swipl/library/http/web/js/jquery-3.6.0.min.js +2 -0
- package/lib/swipl/library/increval.pl +217 -0
- package/lib/swipl/library/intercept.pl +263 -0
- package/lib/swipl/library/iostream.pl +237 -0
- package/lib/swipl/library/iri_scheme/file.pl +70 -0
- package/lib/swipl/library/lazy_lists.pl +481 -0
- package/lib/swipl/library/listing.pl +1362 -0
- package/lib/swipl/library/lists.pl +860 -0
- package/lib/swipl/library/lynx/INDEX.pl +14 -0
- package/lib/swipl/library/lynx/format.pl +380 -0
- package/lib/swipl/library/lynx/html_style.pl +129 -0
- package/lib/swipl/library/lynx/html_text.pl +865 -0
- package/lib/swipl/library/lynx/pldoc_style.pl +87 -0
- package/lib/swipl/library/macros.pl +451 -0
- package/lib/swipl/library/main.pl +1200 -0
- package/lib/swipl/library/make.pl +197 -0
- package/lib/swipl/library/modules.pl +129 -0
- package/lib/swipl/library/nb_rbtrees.pl +267 -0
- package/lib/swipl/library/nb_set.pl +203 -0
- package/lib/swipl/library/obfuscate.pl +115 -0
- package/lib/swipl/library/occurs.pl +241 -0
- package/lib/swipl/library/operators.pl +182 -0
- package/lib/swipl/library/option.pl +388 -0
- package/lib/swipl/library/optparse.pl +966 -0
- package/lib/swipl/library/ordsets.pl +518 -0
- package/lib/swipl/library/oset.pl +160 -0
- package/lib/swipl/library/pairs.pl +187 -0
- package/lib/swipl/library/persistency.pl +713 -0
- package/lib/swipl/library/pio.pl +47 -0
- package/lib/swipl/library/portray_text.pl +277 -0
- package/lib/swipl/library/pprint.pl +940 -0
- package/lib/swipl/library/predicate_options.pl +975 -0
- package/lib/swipl/library/prolog_autoload.pl +233 -0
- package/lib/swipl/library/prolog_breakpoints.pl +396 -0
- package/lib/swipl/library/prolog_clause.pl +1104 -0
- package/lib/swipl/library/prolog_code.pl +416 -0
- package/lib/swipl/library/prolog_codewalk.pl +1248 -0
- package/lib/swipl/library/prolog_colour.pl +3301 -0
- package/lib/swipl/library/prolog_colour.qlf +0 -0
- package/lib/swipl/library/prolog_config.pl +154 -0
- package/lib/swipl/library/prolog_coverage.pl +1333 -0
- package/lib/swipl/library/prolog_debug.pl +404 -0
- package/lib/swipl/library/prolog_deps.pl +675 -0
- package/lib/swipl/library/prolog_evaluable.pl +234 -0
- package/lib/swipl/library/prolog_format.pl +219 -0
- package/lib/swipl/library/prolog_history.pl +161 -0
- package/lib/swipl/library/prolog_jiti.pl +333 -0
- package/lib/swipl/library/prolog_locale.pl +61 -0
- package/lib/swipl/library/prolog_metainference.pl +307 -0
- package/lib/swipl/library/prolog_pack.pl +3906 -0
- package/lib/swipl/library/prolog_profile.pl +346 -0
- package/lib/swipl/library/prolog_qlfmake.pl +533 -0
- package/lib/swipl/library/prolog_source.pl +1188 -0
- package/lib/swipl/library/prolog_stack.pl +794 -0
- package/lib/swipl/library/prolog_trace.pl +365 -0
- package/lib/swipl/library/prolog_versions.pl +347 -0
- package/lib/swipl/library/prolog_wrap.pl +164 -0
- package/lib/swipl/library/prolog_xref.pl +3090 -0
- package/lib/swipl/library/prolog_xref.qlf +0 -0
- package/lib/swipl/library/pure_input.pl +266 -0
- package/lib/swipl/library/qpforeign.pl +695 -0
- package/lib/swipl/library/qsave.pl +1516 -0
- package/lib/swipl/library/quasi_quotations.pl +300 -0
- package/lib/swipl/library/quintus.pl +437 -0
- package/lib/swipl/library/random.pl +459 -0
- package/lib/swipl/library/rbtrees.pl +1153 -0
- package/lib/swipl/library/readln.pl +256 -0
- package/lib/swipl/library/readutil.pl +304 -0
- package/lib/swipl/library/record.pl +544 -0
- package/lib/swipl/library/rwlocks.pl +172 -0
- package/lib/swipl/library/sandbox.pl +1384 -0
- package/lib/swipl/library/semweb/dc.rdfs +198 -0
- package/lib/swipl/library/semweb/eor.rdfs +95 -0
- package/lib/swipl/library/semweb/owl.owl +287 -0
- package/lib/swipl/library/semweb/rdf_library.ttl +90 -0
- package/lib/swipl/library/semweb/rdfs.rdfs +251 -0
- package/lib/swipl/library/settings.pl +755 -0
- package/lib/swipl/library/shell.pl +462 -0
- package/lib/swipl/library/shlib.pl +670 -0
- package/lib/swipl/library/solution_sequences.pl +439 -0
- package/lib/swipl/library/sort.pl +119 -0
- package/lib/swipl/library/statistics.pl +541 -0
- package/lib/swipl/library/streams.pl +118 -0
- package/lib/swipl/library/strings.pl +469 -0
- package/lib/swipl/library/system.pl +95 -0
- package/lib/swipl/library/tables.pl +381 -0
- package/lib/swipl/library/tableutil.pl +771 -0
- package/lib/swipl/library/tabling.pl +42 -0
- package/lib/swipl/library/terms.pl +457 -0
- package/lib/swipl/library/theme/auto.pl +61 -0
- package/lib/swipl/library/theme/dark.pl +455 -0
- package/lib/swipl/library/theme/light.pl +45 -0
- package/lib/swipl/library/thread.pl +810 -0
- package/lib/swipl/library/thread_pool.pl +508 -0
- package/lib/swipl/library/threadutil.pl +574 -0
- package/lib/swipl/library/tty.pl +316 -0
- package/lib/swipl/library/ugraphs.pl +644 -0
- package/lib/swipl/library/unicode/INDEX.pl +6 -0
- package/lib/swipl/library/unicode/blocks.pl +414 -0
- package/lib/swipl/library/url.pl +1129 -0
- package/lib/swipl/library/utf8.pl +145 -0
- package/lib/swipl/library/varnumbers.pl +221 -0
- package/lib/swipl/library/vm.pl +251 -0
- package/lib/swipl/library/wfs.pl +205 -0
- package/lib/swipl/library/when.pl +263 -0
- package/lib/swipl/library/writef.pl +278 -0
- package/lib/swipl/library/www_browser.pl +251 -0
- package/lib/swipl/library/yall.pl +574 -0
- package/lib/swipl/library/zip.pl +211 -0
- package/lib/swipl/swipl.home +1 -0
- package/lib/vendor/libcrypto.so.3 +0 -0
- package/lib/vendor/libpcre2-8.so.0 +0 -0
- package/lib/vendor/libssl.so.3 +0 -0
- package/lib/vendor/libz.so.1 +0 -0
- package/licenses/OpenSSL-LICENSE.txt +177 -0
- package/licenses/PCRE2-COPYING +5 -0
- package/licenses/README.md +12 -0
- package/licenses/SWI-Prolog-LICENSE +41 -0
- package/licenses/zlib-LICENSE +22 -0
- package/package.json +27 -0
|
@@ -0,0 +1,1027 @@
|
|
|
1
|
+
/* Part of SWI-Prolog
|
|
2
|
+
|
|
3
|
+
Author: Jan Wielemaker
|
|
4
|
+
E-mail: J.Wielemaker@vu.nl
|
|
5
|
+
WWW: http://www.swi-prolog.org
|
|
6
|
+
Copyright (c) 2010-2023, University of Amsterdam,
|
|
7
|
+
VU University
|
|
8
|
+
SWI-Prolog Solutions b.v.
|
|
9
|
+
Amsterdam All rights reserved.
|
|
10
|
+
|
|
11
|
+
Redistribution and use in source and binary forms, with or without
|
|
12
|
+
modification, are permitted provided that the following conditions
|
|
13
|
+
are met:
|
|
14
|
+
|
|
15
|
+
1. Redistributions of source code must retain the above copyright
|
|
16
|
+
notice, this list of conditions and the following disclaimer.
|
|
17
|
+
|
|
18
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
19
|
+
notice, this list of conditions and the following disclaimer in
|
|
20
|
+
the documentation and/or other materials provided with the
|
|
21
|
+
distribution.
|
|
22
|
+
|
|
23
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
24
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
25
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
26
|
+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
27
|
+
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
28
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
29
|
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
30
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
31
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
32
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
33
|
+
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
34
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
:- module(git,
|
|
38
|
+
[ git/2, % +Argv, +Options
|
|
39
|
+
git_process_output/3, % +Argv, :OnOutput, +Options
|
|
40
|
+
git_open_file/4, % +Dir, +File, +Branch, -Stream
|
|
41
|
+
is_git_directory/1, % +Dir
|
|
42
|
+
git_describe/2, % -Version, +Options
|
|
43
|
+
git_hash/2, % -Hash, +Options
|
|
44
|
+
git_ls_tree/2, % -Content, +Options
|
|
45
|
+
git_remote_url/3, % +Remote, -URL, +Options
|
|
46
|
+
git_ls_remote/3, % +GitURL, -Refs, +Options
|
|
47
|
+
git_branches/2, % -Branches, +Options
|
|
48
|
+
git_remote_branches/2, % +GitURL, -Branches
|
|
49
|
+
git_default_branch/2, % -DefaultBranch, +Options
|
|
50
|
+
git_current_branch/2, % -CurrentBranch, +Options
|
|
51
|
+
git_tags/2, % -Tags, +Options
|
|
52
|
+
git_tags_on_branch/3, % +Dir, +Branch, -Tags
|
|
53
|
+
git_shortlog/3, % +Dir, -Shortlog, +Options
|
|
54
|
+
git_log_data/3, % +Field, +Record, -Value
|
|
55
|
+
git_show/4, % +Dir, +Hash, -Commit, +Options
|
|
56
|
+
git_commit_data/3, % +Field, +Record, -Value
|
|
57
|
+
is_git_hash/1 % +Atom
|
|
58
|
+
]).
|
|
59
|
+
:- use_module(library(record),[(record)/1,current_record/2, op(_,_,record)]).
|
|
60
|
+
|
|
61
|
+
:- autoload(library(apply),[maplist/3]).
|
|
62
|
+
:- autoload(library(error),[must_be/2,existence_error/2]).
|
|
63
|
+
:- autoload(library(filesex),
|
|
64
|
+
[directory_file_path/3,relative_file_name/3]).
|
|
65
|
+
:- autoload(library(lists),[append/3,member/2,append/2]).
|
|
66
|
+
:- autoload(library(option),[option/2,option/3,select_option/3]).
|
|
67
|
+
:- autoload(library(process),[process_create/3,process_wait/2]).
|
|
68
|
+
:- autoload(library(readutil),
|
|
69
|
+
[ read_stream_to_codes/3,
|
|
70
|
+
read_line_to_codes/2,
|
|
71
|
+
read_stream_to_codes/2
|
|
72
|
+
]).
|
|
73
|
+
:- autoload(library(dcg/basics),
|
|
74
|
+
[string//1,whites//0,string_without//2,blanks//0]).
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
:- meta_predicate
|
|
78
|
+
git_process_output(+, 1, +).
|
|
79
|
+
|
|
80
|
+
/** <module> Run GIT commands
|
|
81
|
+
|
|
82
|
+
This module performs common GIT tasks by calling git as a remote process
|
|
83
|
+
through process_create/3. It requires that the =git= executable is in the
|
|
84
|
+
current PATH.
|
|
85
|
+
|
|
86
|
+
This module started life in ClioPatria and has been used by the Prolog
|
|
87
|
+
web-server to provide information on git repositories. It is now moved
|
|
88
|
+
into the core Prolog library to support the Prolog package manager.
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
:- predicate_options(git/2, 2,
|
|
92
|
+
[ directory(atom),
|
|
93
|
+
error(-codes),
|
|
94
|
+
output(-codes),
|
|
95
|
+
status(-any),
|
|
96
|
+
askpass(any)
|
|
97
|
+
]).
|
|
98
|
+
:- predicate_options(git_default_branch/2, 2,
|
|
99
|
+
[ pass_to(git_process_output/3, 3)
|
|
100
|
+
] ).
|
|
101
|
+
:- predicate_options(git_describe/2, 2,
|
|
102
|
+
[ commit(atom),
|
|
103
|
+
directory(atom),
|
|
104
|
+
match(atom)
|
|
105
|
+
]).
|
|
106
|
+
:- predicate_options(git_hash/2, 2,
|
|
107
|
+
[ commit(atom),
|
|
108
|
+
directory(atom),
|
|
109
|
+
pass_to(git_process_output/3, 3)
|
|
110
|
+
]).
|
|
111
|
+
:- predicate_options(git_ls_tree/2, 2,
|
|
112
|
+
[ commit(atom),
|
|
113
|
+
directory(atom)
|
|
114
|
+
]).
|
|
115
|
+
:- predicate_options(git_process_output/3, 3,
|
|
116
|
+
[ directory(atom),
|
|
117
|
+
askpass(any),
|
|
118
|
+
error(-codes),
|
|
119
|
+
status(-integer)
|
|
120
|
+
]).
|
|
121
|
+
:- predicate_options(git_remote_url/3, 3,
|
|
122
|
+
[ pass_to(git_process_output/3, 3)
|
|
123
|
+
]).
|
|
124
|
+
:- predicate_options(git_shortlog/3, 3,
|
|
125
|
+
[ revisions(atom),
|
|
126
|
+
limit(nonneg),
|
|
127
|
+
path(atom)
|
|
128
|
+
]).
|
|
129
|
+
:- predicate_options(git_show/4, 4,
|
|
130
|
+
[ diff(oneof([patch,stat]))
|
|
131
|
+
]).
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
%! git(+Argv, +Options) is det.
|
|
135
|
+
%
|
|
136
|
+
% Run a GIT command. Defined options:
|
|
137
|
+
%
|
|
138
|
+
% * directory(+Dir)
|
|
139
|
+
% Execute in the given directory
|
|
140
|
+
% * output(-Out)
|
|
141
|
+
% Unify Out with a list of codes representing stdout of the
|
|
142
|
+
% command. Otherwise the output is handed to print_message/2
|
|
143
|
+
% with level =informational=.
|
|
144
|
+
% * error(-Error)
|
|
145
|
+
% As output(Out), but messages are printed at level =error=.
|
|
146
|
+
% * askpass(+Program)
|
|
147
|
+
% Export GIT_ASKPASS=Program
|
|
148
|
+
|
|
149
|
+
git(Argv, Options) :-
|
|
150
|
+
git_cwd_options(Argv, Argv1, Options),
|
|
151
|
+
env_options(Extra, Options),
|
|
152
|
+
setup_call_cleanup(
|
|
153
|
+
process_create(path(git), Argv1,
|
|
154
|
+
[ stdout(pipe(Out)),
|
|
155
|
+
stderr(pipe(Error)),
|
|
156
|
+
process(PID)
|
|
157
|
+
| Extra
|
|
158
|
+
]),
|
|
159
|
+
call_cleanup(
|
|
160
|
+
( read_stream_to_codes(Out, OutCodes, []),
|
|
161
|
+
read_stream_to_codes(Error, ErrorCodes, [])
|
|
162
|
+
),
|
|
163
|
+
process_wait(PID, Status)),
|
|
164
|
+
close_streams([Out,Error])),
|
|
165
|
+
print_error(ErrorCodes, Options),
|
|
166
|
+
print_output(OutCodes, Options),
|
|
167
|
+
( option(status(Status0), Options)
|
|
168
|
+
-> Status = Status0
|
|
169
|
+
; Status == exit(0)
|
|
170
|
+
-> true
|
|
171
|
+
; throw(error(process_error(git(Argv), Status), _))
|
|
172
|
+
).
|
|
173
|
+
|
|
174
|
+
git_cwd_options(Argv0, Argv, Options) :-
|
|
175
|
+
option(directory(Dir), Options),
|
|
176
|
+
!,
|
|
177
|
+
Argv = ['-C', file(Dir) | Argv0 ].
|
|
178
|
+
git_cwd_options(Argv, Argv, _).
|
|
179
|
+
|
|
180
|
+
env_options([env(['GIT_ASKPASS'=Program])], Options) :-
|
|
181
|
+
option(askpass(Exe), Options),
|
|
182
|
+
!,
|
|
183
|
+
exe_options(ExeOptions),
|
|
184
|
+
absolute_file_name(Exe, PlProg, ExeOptions),
|
|
185
|
+
prolog_to_os_filename(PlProg, Program).
|
|
186
|
+
env_options([], _).
|
|
187
|
+
|
|
188
|
+
exe_options(Options) :-
|
|
189
|
+
current_prolog_flag(windows, true),
|
|
190
|
+
!,
|
|
191
|
+
Options = [ extensions(['',exe,com]), access(read) ].
|
|
192
|
+
exe_options(Options) :-
|
|
193
|
+
Options = [ access(execute) ].
|
|
194
|
+
|
|
195
|
+
print_output(OutCodes, Options) :-
|
|
196
|
+
option(output(Codes), Options),
|
|
197
|
+
!,
|
|
198
|
+
Codes = OutCodes.
|
|
199
|
+
print_output([], _) :- !.
|
|
200
|
+
print_output(OutCodes, _) :-
|
|
201
|
+
print_message(informational, git(output(OutCodes))).
|
|
202
|
+
|
|
203
|
+
print_error(OutCodes, Options) :-
|
|
204
|
+
option(error(Codes), Options),
|
|
205
|
+
!,
|
|
206
|
+
Codes = OutCodes.
|
|
207
|
+
print_error([], _) :- !.
|
|
208
|
+
print_error(OutCodes, _) :-
|
|
209
|
+
phrase(classify_message(Level), OutCodes, _),
|
|
210
|
+
print_message(Level, git(output(OutCodes))).
|
|
211
|
+
|
|
212
|
+
classify_message(error) -->
|
|
213
|
+
string(_), "fatal:",
|
|
214
|
+
!.
|
|
215
|
+
classify_message(error) -->
|
|
216
|
+
string(_), "error:",
|
|
217
|
+
!.
|
|
218
|
+
classify_message(warning) -->
|
|
219
|
+
string(_), "warning:",
|
|
220
|
+
!.
|
|
221
|
+
classify_message(informational) -->
|
|
222
|
+
[].
|
|
223
|
+
|
|
224
|
+
%! close_streams(+Streams:list) is det.
|
|
225
|
+
%
|
|
226
|
+
% Close a list of streams, throwing the first error if some stream
|
|
227
|
+
% failed to close.
|
|
228
|
+
|
|
229
|
+
close_streams(List) :-
|
|
230
|
+
phrase(close_streams(List), Errors),
|
|
231
|
+
( Errors = [Error|_]
|
|
232
|
+
-> throw(Error)
|
|
233
|
+
; true
|
|
234
|
+
).
|
|
235
|
+
|
|
236
|
+
close_streams([H|T]) -->
|
|
237
|
+
{ catch(close(H), E, true) },
|
|
238
|
+
( { var(E) }
|
|
239
|
+
-> []
|
|
240
|
+
; [E]
|
|
241
|
+
),
|
|
242
|
+
close_streams(T).
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
%! git_process_output(+Argv, :OnOutput, +Options) is det.
|
|
246
|
+
%
|
|
247
|
+
% Run a git-command and process the output with OnOutput, which is
|
|
248
|
+
% called as call(OnOutput, Stream).
|
|
249
|
+
|
|
250
|
+
git_process_output(Argv, OnOutput, Options) :-
|
|
251
|
+
git_cwd_options(Argv, Argv1, Options),
|
|
252
|
+
env_options(Extra, Options),
|
|
253
|
+
setup_call_cleanup(
|
|
254
|
+
process_create(path(git), Argv1,
|
|
255
|
+
[ stdout(pipe(Out)),
|
|
256
|
+
stderr(pipe(Error)),
|
|
257
|
+
process(PID)
|
|
258
|
+
| Extra
|
|
259
|
+
]),
|
|
260
|
+
call_cleanup(
|
|
261
|
+
( call(OnOutput, Out),
|
|
262
|
+
read_stream_to_codes(Error, ErrorCodes, [])
|
|
263
|
+
),
|
|
264
|
+
git_wait(PID, Out, Status)),
|
|
265
|
+
close_streams([Out,Error])),
|
|
266
|
+
print_error(ErrorCodes, Options),
|
|
267
|
+
( option(status(Status), Options)
|
|
268
|
+
-> true
|
|
269
|
+
; Status = exit(0)
|
|
270
|
+
-> true
|
|
271
|
+
; throw(error(process_error(git, Status)))
|
|
272
|
+
).
|
|
273
|
+
|
|
274
|
+
git_wait(PID, Out, Status) :-
|
|
275
|
+
at_end_of_stream(Out),
|
|
276
|
+
!,
|
|
277
|
+
process_wait(PID, Status).
|
|
278
|
+
git_wait(PID, Out, Status) :-
|
|
279
|
+
setup_call_cleanup(
|
|
280
|
+
open_null_stream(Null),
|
|
281
|
+
copy_stream_data(Out, Null),
|
|
282
|
+
close(Null)),
|
|
283
|
+
process_wait(PID, Status).
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
%! git_open_file(+GitRepoDir, +File, +Branch, -Stream) is det.
|
|
287
|
+
%
|
|
288
|
+
% Open the file File in the given bare GIT repository on the given
|
|
289
|
+
% branch (treeisch).
|
|
290
|
+
%
|
|
291
|
+
% @bug We cannot tell whether opening failed for some reason.
|
|
292
|
+
|
|
293
|
+
git_open_file(Dir, File, Branch, In) :-
|
|
294
|
+
atomic_list_concat([Branch, :, File], Ref),
|
|
295
|
+
process_create(path(git),
|
|
296
|
+
[ '-C', file(Dir), show, Ref ],
|
|
297
|
+
[ stdout(pipe(In))
|
|
298
|
+
]),
|
|
299
|
+
set_stream(In, file_name(File)).
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
%! is_git_directory(+Directory) is semidet.
|
|
303
|
+
%
|
|
304
|
+
% True if Directory is a git directory (Either checked out or
|
|
305
|
+
% bare).
|
|
306
|
+
|
|
307
|
+
is_git_directory(Directory) :-
|
|
308
|
+
directory_file_path(Directory, '.git', GitDir),
|
|
309
|
+
exists_directory(GitDir),
|
|
310
|
+
!.
|
|
311
|
+
is_git_directory(Directory) :-
|
|
312
|
+
exists_directory(Directory),
|
|
313
|
+
git(['rev-parse', '--git-dir'],
|
|
314
|
+
[ output(Codes),
|
|
315
|
+
error(_),
|
|
316
|
+
status(Status),
|
|
317
|
+
directory(Directory)
|
|
318
|
+
]),
|
|
319
|
+
Status == exit(0),
|
|
320
|
+
string_codes(GitDir0, Codes),
|
|
321
|
+
split_string(GitDir0, "", " \n", [GitDir]),
|
|
322
|
+
sub_string(GitDir, B, _, A, "/.git/modules/"),
|
|
323
|
+
!,
|
|
324
|
+
sub_string(GitDir, 0, B, _, Main),
|
|
325
|
+
sub_string(GitDir, _, A, 0, Below),
|
|
326
|
+
directory_file_path(Main, Below, Dir),
|
|
327
|
+
same_file(Dir, Directory).
|
|
328
|
+
|
|
329
|
+
%! git_describe(-Version, +Options) is semidet.
|
|
330
|
+
%
|
|
331
|
+
% Describe the running version based on GIT tags and hashes.
|
|
332
|
+
% Options:
|
|
333
|
+
%
|
|
334
|
+
% * match(+Pattern)
|
|
335
|
+
% Only use tags that match Pattern (a Unix glob-pattern; e.g.
|
|
336
|
+
% =|V*|=)
|
|
337
|
+
% * directory(Dir)
|
|
338
|
+
% Provide the version-info for a directory that is part of
|
|
339
|
+
% a GIT-repository.
|
|
340
|
+
% * commit(+Commit)
|
|
341
|
+
% Describe Commit rather than =HEAD=
|
|
342
|
+
%
|
|
343
|
+
% @see git describe
|
|
344
|
+
|
|
345
|
+
git_describe(Version, Options) :-
|
|
346
|
+
( option(match(Pattern), Options)
|
|
347
|
+
-> true
|
|
348
|
+
; git_version_pattern(Pattern)
|
|
349
|
+
),
|
|
350
|
+
( option(commit(Commit), Options)
|
|
351
|
+
-> Extra = [Commit]
|
|
352
|
+
; Extra = []
|
|
353
|
+
),
|
|
354
|
+
option(directory(Dir), Options, .),
|
|
355
|
+
setup_call_cleanup(
|
|
356
|
+
process_create(path(git),
|
|
357
|
+
[ 'describe',
|
|
358
|
+
'--match', Pattern
|
|
359
|
+
| Extra
|
|
360
|
+
],
|
|
361
|
+
[ stdout(pipe(Out)),
|
|
362
|
+
stderr(null),
|
|
363
|
+
process(PID),
|
|
364
|
+
cwd(Dir)
|
|
365
|
+
]),
|
|
366
|
+
call_cleanup(
|
|
367
|
+
read_stream_to_codes(Out, V0, []),
|
|
368
|
+
git_wait(PID, Out, Status)),
|
|
369
|
+
close(Out)),
|
|
370
|
+
Status = exit(0),
|
|
371
|
+
!,
|
|
372
|
+
atom_codes(V1, V0),
|
|
373
|
+
normalize_space(atom(Plain), V1),
|
|
374
|
+
( git_is_clean(Dir)
|
|
375
|
+
-> Version = Plain
|
|
376
|
+
; atom_concat(Plain, '-DIRTY', Version)
|
|
377
|
+
).
|
|
378
|
+
git_describe(Version, Options) :-
|
|
379
|
+
option(directory(Dir), Options, .),
|
|
380
|
+
option(commit(Commit), Options, 'HEAD'),
|
|
381
|
+
setup_call_cleanup(
|
|
382
|
+
process_create(path(git),
|
|
383
|
+
[ 'rev-parse', '--short',
|
|
384
|
+
Commit
|
|
385
|
+
],
|
|
386
|
+
[ stdout(pipe(Out)),
|
|
387
|
+
stderr(null),
|
|
388
|
+
process(PID),
|
|
389
|
+
cwd(Dir)
|
|
390
|
+
]),
|
|
391
|
+
call_cleanup(
|
|
392
|
+
read_stream_to_codes(Out, V0, []),
|
|
393
|
+
git_wait(PID, Out, Status)),
|
|
394
|
+
close(Out)),
|
|
395
|
+
Status = exit(0),
|
|
396
|
+
atom_codes(V1, V0),
|
|
397
|
+
normalize_space(atom(Plain), V1),
|
|
398
|
+
( git_is_clean(Dir)
|
|
399
|
+
-> Version = Plain
|
|
400
|
+
; atom_concat(Plain, '-DIRTY', Version)
|
|
401
|
+
).
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
:- multifile
|
|
405
|
+
git_version_pattern/1.
|
|
406
|
+
|
|
407
|
+
git_version_pattern('V*').
|
|
408
|
+
git_version_pattern('*').
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
%! git_is_clean(+Dir) is semidet.
|
|
412
|
+
%
|
|
413
|
+
% True if the given directory is in a git module and this module
|
|
414
|
+
% is clean. To us, clean only implies that =|git diff|= produces
|
|
415
|
+
% no output.
|
|
416
|
+
|
|
417
|
+
git_is_clean(Dir) :-
|
|
418
|
+
setup_call_cleanup(process_create(path(git), ['diff', '--stat'],
|
|
419
|
+
[ stdout(pipe(Out)),
|
|
420
|
+
stderr(null),
|
|
421
|
+
cwd(Dir)
|
|
422
|
+
]),
|
|
423
|
+
stream_char_count(Out, Count),
|
|
424
|
+
close(Out)),
|
|
425
|
+
Count == 0.
|
|
426
|
+
|
|
427
|
+
stream_char_count(Out, Count) :-
|
|
428
|
+
setup_call_cleanup(open_null_stream(Null),
|
|
429
|
+
( copy_stream_data(Out, Null),
|
|
430
|
+
character_count(Null, Count)
|
|
431
|
+
),
|
|
432
|
+
close(Null)).
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
%! git_hash(-Hash, +Options) is det.
|
|
436
|
+
%
|
|
437
|
+
% Return the hash of the indicated object.
|
|
438
|
+
|
|
439
|
+
git_hash(Hash, Options) :-
|
|
440
|
+
option(commit(Commit), Options, 'HEAD'),
|
|
441
|
+
git_process_output(['rev-parse', '--verify', Commit],
|
|
442
|
+
read_hash(Hash),
|
|
443
|
+
Options).
|
|
444
|
+
|
|
445
|
+
read_hash(Hash, Stream) :-
|
|
446
|
+
read_line_to_codes(Stream, Line),
|
|
447
|
+
atom_codes(Hash, Line).
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
%! is_git_hash(+Atom) is semidet.
|
|
451
|
+
%
|
|
452
|
+
% True when Atom represents a GIT hash, i.e., a 40 digit hexadecimal
|
|
453
|
+
% string.
|
|
454
|
+
|
|
455
|
+
is_git_hash(Atom) :-
|
|
456
|
+
atom_length(Atom, 40),
|
|
457
|
+
atom_codes(Atom, Codes),
|
|
458
|
+
maplist(is_hex, Codes),
|
|
459
|
+
!.
|
|
460
|
+
|
|
461
|
+
is_hex(Code) :-
|
|
462
|
+
code_type(Code, xdigit(_)).
|
|
463
|
+
|
|
464
|
+
%! git_ls_tree(-Entries, +Options) is det.
|
|
465
|
+
%
|
|
466
|
+
% True when Entries is a list of entries in the the GIT
|
|
467
|
+
% repository, Each entry is a term:
|
|
468
|
+
%
|
|
469
|
+
% ==
|
|
470
|
+
% object(Mode, Type, Hash, Size, Name)
|
|
471
|
+
% ==
|
|
472
|
+
|
|
473
|
+
git_ls_tree(Entries, Options) :-
|
|
474
|
+
option(commit(Commit), Options, 'HEAD'),
|
|
475
|
+
git_process_output(['ls-tree', '-z', '-r', '-l', Commit],
|
|
476
|
+
read_tree(Entries),
|
|
477
|
+
Options).
|
|
478
|
+
|
|
479
|
+
read_tree(Entries, Stream) :-
|
|
480
|
+
read_stream_to_codes(Stream, Codes),
|
|
481
|
+
phrase(ls_tree(Entries), Codes).
|
|
482
|
+
|
|
483
|
+
ls_tree([H|T]) -->
|
|
484
|
+
ls_entry(H),
|
|
485
|
+
!,
|
|
486
|
+
ls_tree(T).
|
|
487
|
+
ls_tree([]) --> [].
|
|
488
|
+
|
|
489
|
+
ls_entry(object(Mode, Type, Hash, Size, Name)) -->
|
|
490
|
+
string(MS), " ",
|
|
491
|
+
string(TS), " ",
|
|
492
|
+
string(HS), " ",
|
|
493
|
+
string(SS), "\t",
|
|
494
|
+
string(NS), [0],
|
|
495
|
+
!,
|
|
496
|
+
{ number_codes(Mode, [0'0,0'o|MS]),
|
|
497
|
+
atom_codes(Type, TS),
|
|
498
|
+
atom_codes(Hash, HS),
|
|
499
|
+
( Type == blob
|
|
500
|
+
-> number_codes(Size, SS)
|
|
501
|
+
; Size = 0 % actually '-', but 0 sums easier
|
|
502
|
+
),
|
|
503
|
+
atom_codes(Name, NS)
|
|
504
|
+
}.
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
%! git_remote_url(+Remote, -URL, +Options) is det.
|
|
508
|
+
%
|
|
509
|
+
% URL is the remote (fetch) URL for the given Remote.
|
|
510
|
+
|
|
511
|
+
git_remote_url(Remote, URL, Options) :-
|
|
512
|
+
git_process_output([remote, show, Remote],
|
|
513
|
+
read_url("Fetch URL:", URL),
|
|
514
|
+
Options).
|
|
515
|
+
|
|
516
|
+
read_url(Tag, URL, In) :-
|
|
517
|
+
repeat,
|
|
518
|
+
read_line_to_codes(In, Line),
|
|
519
|
+
( Line == end_of_file
|
|
520
|
+
-> !, fail
|
|
521
|
+
; phrase(url_codes(Tag, Codes), Line)
|
|
522
|
+
-> !, atom_codes(URL, Codes)
|
|
523
|
+
).
|
|
524
|
+
|
|
525
|
+
url_codes(Tag, Rest) -->
|
|
526
|
+
{ string_codes(Tag, TagCodes) },
|
|
527
|
+
whites, string(TagCodes), whites, string(Rest).
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
%! git_ls_remote(+GitURL, -Refs, +Options) is det.
|
|
531
|
+
%
|
|
532
|
+
% Execute =|git ls-remote|= against the remote repository to fetch
|
|
533
|
+
% references from the remote. Options processed:
|
|
534
|
+
%
|
|
535
|
+
% * heads(Boolean)
|
|
536
|
+
% * tags(Boolean)
|
|
537
|
+
% * refs(List)
|
|
538
|
+
%
|
|
539
|
+
% For example, to find the hash of the remote =HEAD=, one can use
|
|
540
|
+
%
|
|
541
|
+
% ==
|
|
542
|
+
% ?- git_ls_remote('git://www.swi-prolog.org/home/pl/git/pl-devel.git',
|
|
543
|
+
% Refs, [refs(['HEAD'])]).
|
|
544
|
+
% Refs = ['5d596c52aa969d88e7959f86327f5c7ff23695f3'-'HEAD'].
|
|
545
|
+
% ==
|
|
546
|
+
%
|
|
547
|
+
% @param Refs is a list of pairs hash-name.
|
|
548
|
+
|
|
549
|
+
git_ls_remote(GitURL, Refs, Options) :-
|
|
550
|
+
findall(O, ls_remote_option(Options, O), RemoteOptions),
|
|
551
|
+
option(refs(LimitRefs), Options, []),
|
|
552
|
+
must_be(list(atom), LimitRefs),
|
|
553
|
+
append([ 'ls-remote' | RemoteOptions], [GitURL|LimitRefs], Argv),
|
|
554
|
+
git_process_output(Argv, remote_refs(Refs), Options).
|
|
555
|
+
|
|
556
|
+
ls_remote_option(Options, '--heads') :-
|
|
557
|
+
option(heads(true), Options).
|
|
558
|
+
ls_remote_option(Options, '--tags') :-
|
|
559
|
+
option(tags(true), Options).
|
|
560
|
+
|
|
561
|
+
remote_refs(Refs, Out) :-
|
|
562
|
+
read_line_to_codes(Out, Line0),
|
|
563
|
+
remote_refs(Line0, Out, Refs).
|
|
564
|
+
|
|
565
|
+
remote_refs(end_of_file, _, []) :- !.
|
|
566
|
+
remote_refs(Line, Out, [Hash-Ref|Tail]) :-
|
|
567
|
+
phrase(remote_ref(Hash,Ref), Line),
|
|
568
|
+
read_line_to_codes(Out, Line1),
|
|
569
|
+
remote_refs(Line1, Out, Tail).
|
|
570
|
+
|
|
571
|
+
remote_ref(Hash, Ref) -->
|
|
572
|
+
string_without("\t ", HashCodes),
|
|
573
|
+
whites,
|
|
574
|
+
string_without("\t ", RefCodes),
|
|
575
|
+
{ atom_codes(Hash, HashCodes),
|
|
576
|
+
atom_codes(Ref, RefCodes)
|
|
577
|
+
}.
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
%! git_remote_branches(+GitURL, -Branches) is det.
|
|
581
|
+
%
|
|
582
|
+
% Exploit git_ls_remote/3 to fetch the branches from a remote
|
|
583
|
+
% repository without downloading it.
|
|
584
|
+
|
|
585
|
+
git_remote_branches(GitURL, Branches) :-
|
|
586
|
+
git_ls_remote(GitURL, Refs, [heads(true)]),
|
|
587
|
+
findall(B, (member(_-Head, Refs),
|
|
588
|
+
atom_concat('refs/heads/', B, Head)),
|
|
589
|
+
Branches).
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
%! git_default_branch(-BranchName, +Options) is det.
|
|
593
|
+
%
|
|
594
|
+
% True when BranchName is the default branch of a repository. This is
|
|
595
|
+
% hard to define. If possible, we perform ``rev-parse`` on
|
|
596
|
+
% ``origin/HEAD``. If not, we look at branches shared between the
|
|
597
|
+
% local and remote and select `main` or `master` or the first common
|
|
598
|
+
% breach. Options:
|
|
599
|
+
%
|
|
600
|
+
% - remote(+Remote)
|
|
601
|
+
% Remote used to detect the default branch. Default is `origin`.
|
|
602
|
+
|
|
603
|
+
git_default_branch(BranchName, Options) :-
|
|
604
|
+
option(remote(Remote), Options, origin),
|
|
605
|
+
atomic_list_concat([Remote, 'HEAD'], '/', HeadRef),
|
|
606
|
+
git_process_output(['rev-parse', '--abbrev-ref', HeadRef],
|
|
607
|
+
read_default_branch(BranchName),
|
|
608
|
+
[ error(_),
|
|
609
|
+
status(Status)
|
|
610
|
+
| Options
|
|
611
|
+
]),
|
|
612
|
+
Status == exit(0),
|
|
613
|
+
!.
|
|
614
|
+
git_default_branch(BranchName, Options) :-
|
|
615
|
+
option(remote(Remote), Options, origin),
|
|
616
|
+
git_branches(MyBranches, []),
|
|
617
|
+
git_branches(RemoteBranches, [remote(true)]),
|
|
618
|
+
( preferred_default_branch(BranchName),
|
|
619
|
+
shared_branch(Remote, MyBranches, RemoteBranches, BranchName)
|
|
620
|
+
-> true
|
|
621
|
+
; shared_branch(Remote, MyBranches, RemoteBranches, BranchName)
|
|
622
|
+
-> true
|
|
623
|
+
).
|
|
624
|
+
|
|
625
|
+
preferred_default_branch(main).
|
|
626
|
+
preferred_default_branch(master).
|
|
627
|
+
|
|
628
|
+
shared_branch(Remote, MyBranches, RemoteBranches, BranchName) :-
|
|
629
|
+
member(BranchName, MyBranches),
|
|
630
|
+
atomic_list_concat([Remote, BranchName], '/', Orig),
|
|
631
|
+
memberchk(Orig, RemoteBranches).
|
|
632
|
+
|
|
633
|
+
read_default_branch(BranchName, In) :-
|
|
634
|
+
read_line_to_string(In, Result),
|
|
635
|
+
split_string(Result, "/", "", [_Origin,BranchString]),
|
|
636
|
+
atom_string(BranchName, BranchString).
|
|
637
|
+
|
|
638
|
+
%! git_default_branch(-BranchName, +Options) is semidet.
|
|
639
|
+
%
|
|
640
|
+
% True when BranchName is the current branch of a repository. Fails
|
|
641
|
+
% if the repo HEAD is detached
|
|
642
|
+
|
|
643
|
+
git_current_branch(BranchName, Options) :-
|
|
644
|
+
git_process_output([branch],
|
|
645
|
+
read_current_branch(BranchName),
|
|
646
|
+
Options).
|
|
647
|
+
|
|
648
|
+
read_current_branch(BranchName, In) :-
|
|
649
|
+
repeat,
|
|
650
|
+
read_line_to_codes(In, Line),
|
|
651
|
+
( Line == end_of_file
|
|
652
|
+
-> !, fail
|
|
653
|
+
; phrase(current_branch(Codes), Line)
|
|
654
|
+
-> !, atom_codes(BranchName, Codes),
|
|
655
|
+
\+ sub_atom(BranchName, _, _, _, '(HEAD detached')
|
|
656
|
+
).
|
|
657
|
+
|
|
658
|
+
current_branch(Rest) -->
|
|
659
|
+
"*", whites, string(Rest).
|
|
660
|
+
|
|
661
|
+
%! git_branches(-Branches, +Options) is det.
|
|
662
|
+
%
|
|
663
|
+
% True when Branches is the list of branches in the repository.
|
|
664
|
+
% In addition to the usual options, this processes:
|
|
665
|
+
%
|
|
666
|
+
% - contains(Commit)
|
|
667
|
+
% Return only branches that contain Commit.
|
|
668
|
+
% - remote(true)
|
|
669
|
+
% Return remote branches
|
|
670
|
+
|
|
671
|
+
git_branches(Branches, Options) :-
|
|
672
|
+
( select_option(commit(Commit), Options, GitOptions)
|
|
673
|
+
-> Extra = ['--contains', Commit]
|
|
674
|
+
; select_option(remote(true), Options, GitOptions)
|
|
675
|
+
-> Extra = ['-r']
|
|
676
|
+
; Extra = [],
|
|
677
|
+
GitOptions = Options
|
|
678
|
+
),
|
|
679
|
+
git_process_output([branch|Extra],
|
|
680
|
+
read_branches(Branches),
|
|
681
|
+
GitOptions).
|
|
682
|
+
|
|
683
|
+
read_branches(Branches, In) :-
|
|
684
|
+
read_line_to_codes(In, Line),
|
|
685
|
+
( Line == end_of_file
|
|
686
|
+
-> Branches = []
|
|
687
|
+
; Line = [_,_|Codes],
|
|
688
|
+
atom_codes(H, Codes),
|
|
689
|
+
( sub_atom(H, _, _, _, '(HEAD detached at')
|
|
690
|
+
-> Branches = T
|
|
691
|
+
; Branches = [H|T]
|
|
692
|
+
),
|
|
693
|
+
read_branches(T, In)
|
|
694
|
+
).
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
%! git_tags(-Tags, +Options) is det.
|
|
698
|
+
%
|
|
699
|
+
% True when Tags is a list of git tags defined on the repository.
|
|
700
|
+
|
|
701
|
+
git_tags(Tags, Options) :-
|
|
702
|
+
git_process_output([tag],
|
|
703
|
+
read_lines_to_atoms(Tags),
|
|
704
|
+
Options).
|
|
705
|
+
|
|
706
|
+
read_lines_to_atoms(Atoms, In) :-
|
|
707
|
+
read_line_to_string(In, Line),
|
|
708
|
+
( Line == end_of_file
|
|
709
|
+
-> Atoms = []
|
|
710
|
+
; atom_string(Atom, Line),
|
|
711
|
+
Atoms = [Atom|T],
|
|
712
|
+
read_lines_to_atoms(T, In)
|
|
713
|
+
).
|
|
714
|
+
|
|
715
|
+
%! git_tags_on_branch(+Dir, +Branch, -Tags) is det.
|
|
716
|
+
%
|
|
717
|
+
% Tags is a list of tags in Branch on the GIT repository Dir, most
|
|
718
|
+
% recent tag first.
|
|
719
|
+
%
|
|
720
|
+
% @see Git tricks at http://mislav.uniqpath.com/2010/07/git-tips/
|
|
721
|
+
|
|
722
|
+
git_tags_on_branch(Dir, Branch, Tags) :-
|
|
723
|
+
git_process_output([ log, '--oneline', '--decorate', Branch ],
|
|
724
|
+
log_to_tags(Tags),
|
|
725
|
+
[ directory(Dir) ]).
|
|
726
|
+
|
|
727
|
+
log_to_tags(Tags, Out) :-
|
|
728
|
+
read_line_to_codes(Out, Line0),
|
|
729
|
+
log_to_tags(Line0, Out, Tags, []).
|
|
730
|
+
|
|
731
|
+
log_to_tags(end_of_file, _, Tags, Tags) :- !.
|
|
732
|
+
log_to_tags(Line, Out, Tags, Tail) :-
|
|
733
|
+
phrase(tags_on_line(Tags, Tail1), Line),
|
|
734
|
+
read_line_to_codes(Out, Line1),
|
|
735
|
+
log_to_tags(Line1, Out, Tail1, Tail).
|
|
736
|
+
|
|
737
|
+
tags_on_line(Tags, Tail) -->
|
|
738
|
+
string_without(" ", _Hash),
|
|
739
|
+
tags(Tags, Tail),
|
|
740
|
+
skip_rest.
|
|
741
|
+
|
|
742
|
+
tags(Tags, Tail) -->
|
|
743
|
+
whites,
|
|
744
|
+
"(",
|
|
745
|
+
tag_list(Tags, Rest),
|
|
746
|
+
!,
|
|
747
|
+
tags(Rest, Tail).
|
|
748
|
+
tags(Tags, Tags) -->
|
|
749
|
+
skip_rest.
|
|
750
|
+
|
|
751
|
+
tag_list([H|T], Rest) -->
|
|
752
|
+
"tag:", !, whites,
|
|
753
|
+
string(Codes),
|
|
754
|
+
( ")"
|
|
755
|
+
-> { atom_codes(H, Codes),
|
|
756
|
+
T = Rest
|
|
757
|
+
}
|
|
758
|
+
; ","
|
|
759
|
+
-> { atom_codes(H, Codes)
|
|
760
|
+
},
|
|
761
|
+
whites,
|
|
762
|
+
tag_list(T, Rest)
|
|
763
|
+
).
|
|
764
|
+
tag_list(List, Rest) -->
|
|
765
|
+
string(_),
|
|
766
|
+
( ")"
|
|
767
|
+
-> { List = Rest }
|
|
768
|
+
; ","
|
|
769
|
+
-> whites,
|
|
770
|
+
tag_list(List, Rest)
|
|
771
|
+
).
|
|
772
|
+
|
|
773
|
+
skip_rest(_,_).
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
/*******************************
|
|
777
|
+
* READ GIT HISTORY *
|
|
778
|
+
*******************************/
|
|
779
|
+
|
|
780
|
+
%! git_shortlog(+Dir, -ShortLog, +Options) is det.
|
|
781
|
+
%
|
|
782
|
+
% Fetch information like the GitWeb change overview. Processed
|
|
783
|
+
% options:
|
|
784
|
+
%
|
|
785
|
+
% * limit(+Count)
|
|
786
|
+
% Maximum number of commits to show (default is 10)
|
|
787
|
+
% * revisions(+Revisions)
|
|
788
|
+
% Git revision specification
|
|
789
|
+
% * path(+Path)
|
|
790
|
+
% Only show commits that affect Path. Path is the path of
|
|
791
|
+
% a checked out file.
|
|
792
|
+
% * git_path(+Path)
|
|
793
|
+
% Similar to =path=, but Path is relative to the repository.
|
|
794
|
+
%
|
|
795
|
+
% @param ShortLog is a list of =git_log= records.
|
|
796
|
+
|
|
797
|
+
:- record
|
|
798
|
+
git_log(commit_hash:atom,
|
|
799
|
+
author_name:atom,
|
|
800
|
+
author_date_relative:atom,
|
|
801
|
+
committer_name:atom,
|
|
802
|
+
committer_date_relative:atom,
|
|
803
|
+
committer_date_unix:integer,
|
|
804
|
+
subject:atom,
|
|
805
|
+
ref_names:list).
|
|
806
|
+
|
|
807
|
+
git_shortlog(Dir, ShortLog, Options) :-
|
|
808
|
+
( option(revisions(Range), Options)
|
|
809
|
+
-> RangeSpec = [Range]
|
|
810
|
+
; option(limit(Limit), Options, 10),
|
|
811
|
+
RangeSpec = ['-n', Limit]
|
|
812
|
+
),
|
|
813
|
+
( option(git_path(Path), Options)
|
|
814
|
+
-> Extra = ['--', Path]
|
|
815
|
+
; option(path(Path), Options)
|
|
816
|
+
-> relative_file_name(Path, Dir, RelPath),
|
|
817
|
+
Extra = ['--', RelPath]
|
|
818
|
+
; Extra = []
|
|
819
|
+
),
|
|
820
|
+
git_format_string(git_log, Fields, Format),
|
|
821
|
+
append([[log, Format], RangeSpec, Extra], GitArgv),
|
|
822
|
+
git_process_output(GitArgv,
|
|
823
|
+
read_git_formatted(git_log, Fields, ShortLog),
|
|
824
|
+
[directory(Dir)]).
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
read_git_formatted(Record, Fields, ShortLog, In) :-
|
|
828
|
+
read_line_to_codes(In, Line0),
|
|
829
|
+
read_git_formatted(Line0, In, Record, Fields, ShortLog).
|
|
830
|
+
|
|
831
|
+
read_git_formatted(end_of_file, _, _, _, []) :- !.
|
|
832
|
+
read_git_formatted(Line, In, Record, Fields, [H|T]) :-
|
|
833
|
+
record_from_line(Record, Fields, Line, H),
|
|
834
|
+
read_line_to_codes(In, Line1),
|
|
835
|
+
read_git_formatted(Line1, In, Record, Fields, T).
|
|
836
|
+
|
|
837
|
+
record_from_line(RecordName, Fields, Line, Record) :-
|
|
838
|
+
phrase(fields_from_line(Fields, Values), Line),
|
|
839
|
+
Record =.. [RecordName|Values].
|
|
840
|
+
|
|
841
|
+
fields_from_line([], []) --> [].
|
|
842
|
+
fields_from_line([F|FT], [V|VT]) -->
|
|
843
|
+
to_nul_s(Codes),
|
|
844
|
+
{ field_to_prolog(F, Codes, V) },
|
|
845
|
+
fields_from_line(FT, VT).
|
|
846
|
+
|
|
847
|
+
to_nul_s([]) --> [0], !.
|
|
848
|
+
to_nul_s([H|T]) --> [H], to_nul_s(T).
|
|
849
|
+
|
|
850
|
+
field_to_prolog(ref_names, Line, List) :-
|
|
851
|
+
phrase(ref_names(List), Line),
|
|
852
|
+
!.
|
|
853
|
+
field_to_prolog(committer_date_unix, Line, Stamp) :-
|
|
854
|
+
!,
|
|
855
|
+
number_codes(Stamp, Line).
|
|
856
|
+
field_to_prolog(_, Line, Atom) :-
|
|
857
|
+
atom_codes(Atom, Line).
|
|
858
|
+
|
|
859
|
+
ref_names([]) --> [].
|
|
860
|
+
ref_names(List) -->
|
|
861
|
+
blanks, "(", ref_name_list(List), ")".
|
|
862
|
+
|
|
863
|
+
ref_name_list([H|T]) -->
|
|
864
|
+
string_without(",)", Codes),
|
|
865
|
+
{ atom_codes(H, Codes) },
|
|
866
|
+
( ",", blanks
|
|
867
|
+
-> ref_name_list(T)
|
|
868
|
+
; {T=[]}
|
|
869
|
+
).
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
%! git_show(+Dir, +Hash, -Commit, +Options) is det.
|
|
873
|
+
%
|
|
874
|
+
% Fetch info from a GIT commit. Options processed:
|
|
875
|
+
%
|
|
876
|
+
% * diff(Diff)
|
|
877
|
+
% GIT option on how to format diffs. E.g. =stat=
|
|
878
|
+
% * max_lines(Count)
|
|
879
|
+
% Truncate the body at Count lines.
|
|
880
|
+
%
|
|
881
|
+
% @param Commit is a term git_commit(...)-Body. Body is currently
|
|
882
|
+
% a list of lines, each line represented as a list of
|
|
883
|
+
% codes.
|
|
884
|
+
|
|
885
|
+
:- record
|
|
886
|
+
git_commit(tree_hash:atom,
|
|
887
|
+
parent_hashes:list,
|
|
888
|
+
author_name:atom,
|
|
889
|
+
author_date:atom,
|
|
890
|
+
committer_name:atom,
|
|
891
|
+
committer_date:atom,
|
|
892
|
+
subject:atom).
|
|
893
|
+
|
|
894
|
+
git_show(Dir, Hash, Commit, Options) :-
|
|
895
|
+
git_format_string(git_commit, Fields, Format),
|
|
896
|
+
option(diff(Diff), Options, patch),
|
|
897
|
+
diff_arg(Diff, DiffArg),
|
|
898
|
+
git_process_output([ show, DiffArg, Hash, Format ],
|
|
899
|
+
read_commit(Fields, Commit, Options),
|
|
900
|
+
[directory(Dir)]).
|
|
901
|
+
|
|
902
|
+
diff_arg(patch, '-p').
|
|
903
|
+
diff_arg(stat, '--stat').
|
|
904
|
+
|
|
905
|
+
read_commit(Fields, Data-Body, Options, In) :-
|
|
906
|
+
read_line_to_codes(In, Line1),
|
|
907
|
+
record_from_line(git_commit, Fields, Line1, Data),
|
|
908
|
+
read_line_to_codes(In, Line2),
|
|
909
|
+
( Line2 == []
|
|
910
|
+
-> option(max_lines(Max), Options, -1),
|
|
911
|
+
read_n_lines(In, Max, Body)
|
|
912
|
+
; Line2 == end_of_file
|
|
913
|
+
-> Body = []
|
|
914
|
+
).
|
|
915
|
+
|
|
916
|
+
read_n_lines(In, Max, Lines) :-
|
|
917
|
+
read_line_to_codes(In, Line1),
|
|
918
|
+
read_n_lines(Line1, Max, In, Lines).
|
|
919
|
+
|
|
920
|
+
read_n_lines(end_of_file, _, _, []) :- !.
|
|
921
|
+
read_n_lines(_, 0, In, []) :-
|
|
922
|
+
!,
|
|
923
|
+
setup_call_cleanup(open_null_stream(Out),
|
|
924
|
+
copy_stream_data(In, Out),
|
|
925
|
+
close(Out)).
|
|
926
|
+
read_n_lines(Line, Max0, In, [Line|More]) :-
|
|
927
|
+
read_line_to_codes(In, Line2),
|
|
928
|
+
Max is Max0-1,
|
|
929
|
+
read_n_lines(Line2, Max, In, More).
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
%! git_format_string(:Record, -FieldNames, -Format)
|
|
933
|
+
%
|
|
934
|
+
% If Record is a record with fields whose names match the GIT
|
|
935
|
+
% format field-names, Format is a git =|--format=|= argument with
|
|
936
|
+
% the appropriate format-specifiers, terminated by %x00, which
|
|
937
|
+
% causes the actual field to be 0-terminated.
|
|
938
|
+
|
|
939
|
+
:- meta_predicate
|
|
940
|
+
git_format_string(:, -, -).
|
|
941
|
+
|
|
942
|
+
git_format_string(M:RecordName, Fields, Format) :-
|
|
943
|
+
current_record(RecordName, M:Term),
|
|
944
|
+
findall(F, record_field(Term, F), Fields),
|
|
945
|
+
maplist(git_field_format, Fields, Formats),
|
|
946
|
+
atomic_list_concat(['--format='|Formats], Format).
|
|
947
|
+
|
|
948
|
+
record_field(Term, Name) :-
|
|
949
|
+
arg(_, Term, Field),
|
|
950
|
+
field_name(Field, Name).
|
|
951
|
+
|
|
952
|
+
field_name(Name:_Type=_Default, Name) :- !.
|
|
953
|
+
field_name(Name:_Type, Name) :- !.
|
|
954
|
+
field_name(Name=_Default, Name) :- !.
|
|
955
|
+
field_name(Name, Name).
|
|
956
|
+
|
|
957
|
+
git_field_format(Field, Fmt) :-
|
|
958
|
+
( git_format(NoPercent, Field)
|
|
959
|
+
-> atomic_list_concat(['%', NoPercent, '%x00'], Fmt)
|
|
960
|
+
; existence_error(git_format, Field)
|
|
961
|
+
).
|
|
962
|
+
|
|
963
|
+
git_format('H', commit_hash).
|
|
964
|
+
git_format('h', abbreviated_commit_hash).
|
|
965
|
+
git_format('T', tree_hash).
|
|
966
|
+
git_format('t', abbreviated_tree_hash).
|
|
967
|
+
git_format('P', parent_hashes).
|
|
968
|
+
git_format('p', abbreviated_parent_hashes).
|
|
969
|
+
|
|
970
|
+
git_format('an', author_name).
|
|
971
|
+
git_format('aN', author_name_mailcap).
|
|
972
|
+
git_format('ae', author_email).
|
|
973
|
+
git_format('aE', author_email_mailcap).
|
|
974
|
+
git_format('ad', author_date).
|
|
975
|
+
git_format('aD', author_date_rfc2822).
|
|
976
|
+
git_format('ar', author_date_relative).
|
|
977
|
+
git_format('at', author_date_unix).
|
|
978
|
+
git_format('ai', author_date_iso8601).
|
|
979
|
+
|
|
980
|
+
git_format('cn', committer_name).
|
|
981
|
+
git_format('cN', committer_name_mailcap).
|
|
982
|
+
git_format('ce', committer_email).
|
|
983
|
+
git_format('cE', committer_email_mailcap).
|
|
984
|
+
git_format('cd', committer_date).
|
|
985
|
+
git_format('cD', committer_date_rfc2822).
|
|
986
|
+
git_format('cr', committer_date_relative).
|
|
987
|
+
git_format('ct', committer_date_unix).
|
|
988
|
+
git_format('ci', committer_date_iso8601).
|
|
989
|
+
|
|
990
|
+
git_format('d', ref_names). % git log?
|
|
991
|
+
git_format('e', encoding). % git log?
|
|
992
|
+
|
|
993
|
+
git_format('s', subject).
|
|
994
|
+
git_format('f', subject_sanitized).
|
|
995
|
+
git_format('b', body).
|
|
996
|
+
git_format('N', notes).
|
|
997
|
+
|
|
998
|
+
git_format('gD', reflog_selector).
|
|
999
|
+
git_format('gd', shortened_reflog_selector).
|
|
1000
|
+
git_format('gs', reflog_subject).
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
/*******************************
|
|
1004
|
+
* MESSAGES *
|
|
1005
|
+
*******************************/
|
|
1006
|
+
|
|
1007
|
+
:- multifile
|
|
1008
|
+
prolog:message//1.
|
|
1009
|
+
|
|
1010
|
+
prolog:message(git(output(Codes))) -->
|
|
1011
|
+
{ split_lines(Codes, Lines) },
|
|
1012
|
+
git_lines(Lines).
|
|
1013
|
+
|
|
1014
|
+
git_lines([]) --> [].
|
|
1015
|
+
git_lines([H|T]) -->
|
|
1016
|
+
[ '~s'-[H] ],
|
|
1017
|
+
( {T==[]}
|
|
1018
|
+
-> []
|
|
1019
|
+
; [nl], git_lines(T)
|
|
1020
|
+
).
|
|
1021
|
+
|
|
1022
|
+
split_lines([], []) :- !.
|
|
1023
|
+
split_lines(All, [Line1|More]) :-
|
|
1024
|
+
append(Line1, [0'\n|Rest], All),
|
|
1025
|
+
!,
|
|
1026
|
+
split_lines(Rest, More).
|
|
1027
|
+
split_lines(Line, [Line]).
|