libfossil: Fossil SCM Library API
This source code repository houses an in-development C99-compliant library API for the Fossil SCM. The primary goal is to port existing behaviour into a library form (the fossil app is extremely monolithic in nature). This effort, officially called "libfossil", intends to provide an alternative interface into fossil repositories, as opposed to a replacement for the core fossil application. It does not aim to provide 100% feature-parity with the main app - see TODOs for details about features which are considered out of scope or otherwise unlikely. It's instead intended to enhance one's ability to access and manipulate fossil repositories. The f-apps page demonstrates what features are currently ported over.
The library has not yet reached core feature parity with fossil, but is far enough along to be able to create a wide range of custom mini-applications, e.g. custom reporting apps or custom timeline apps are trivial to create using the "fcli" API: see the f-apps for numerous examples. The fnc project offers an ncurses-based front-end to browsing fossil repositories, powered by libfossil. fnc is developed closely with this project and a copy of fnc is included in this source tree (and vice versa: the libfossil amalgamation is included in that tree), but that remote one is the canonical version.
License: same as Fossil: the "2-Clause BSD" a.k.a. "FreeBSD License".
Update Feb. 2021: Back from the Dead
After a 6-year forced hiatus due to chronic RSI, libfossil is again making some headway. In early Feb. 2021 its hashing support was brought up to date with regard to fossil's hardened SHA1 and SHA3-256 hashes. That was the major technical hurdle preventing further progress, so now they way is clear (or clearer) for bringing the library into the 2020's.
A chat room and forum have been established for this effort but they are currently limited to developers. Please get in touch if you are a participant and need info about either. This project is currently only opened to active participants of the Fossil SCM project (as committers and/or forum participants). That said, it does not require the same code release waiver which that project requires. If/when the project reaches a client-usable state, it will be opened up for wider participation.
Status, TODOs, and Whatnot
All of this code is an experiment, and it does not represent a commitment by anyone. It is alpha quality. What's there works but is subject to change and there is still a great deal of the higher-level SCM bits left to port in and refactor to make them usable via library-style interfaces. Anyone looking for a project roadmap/timeline is asked respectfully to look elsewhere - there is no timebox on nor schedule for this project/experiment. That said: the f-apps demonstrate what functionality is working.
The code changes can be followed via the timeline.
As of this writing (2021-11-01), libfossil is known to build and work on a variety of compilers on Intel-like (32- and 64-bit), ARM (32- and 64-bit), and SPARC64 platforms. The primary development systems are Linux on x86/64 and ARM (32- and 64-bit), but it also gets a good deal of BSD and Mac test exposure via the fnc project.
As of December 2021, the library is far enough along that the the library's provided client applications can be used for the majority of CLI-based "daily driver" fossil operations, e.g. merging, diffing, and checking in/out. The most significant outlier is that fossil is still required for network synchronization. (Note, however, that this project does not aim to replace the fossil web UI, and that interface provides many app-level features (as opposed to library-level ones) which will never be duplicated here.)
"Rules" for Code Contributors
- When working on bits which themselves write to the repository, e.g. creating checkins, please be exceedingly careful not to corrupt the db :-D. The library has several layers of defense against the injection of problematic control artifacts, but still... be careful.
- Please try to conform to the rough overall coding style (as initially laid out by Fossil v1). We're not picky about whether or not spaces belong before/after an
if, but the general overall style should be more or less uniform.
- Please build with the highest possible warning level and enable fatal warnings (in GCC and similar compilers:
-Wall -Werror -pedantic).
- The trunk currently has no stability guarantees and is very much in flux, so feel free to work there instead of a branch if you like. Insofar as possible/reasonable, using libfossil's own f-apps for working with the repository is recommended (e.g. using
f-cito perform checkins and
f-mergefor merging branches).
There is nothing holy or sacred about this repo, so feel free to hack at will. Most of the library's sanity tests are packaged in f-sanity.c. See cli.h for a mini-framework to bootstrap new apps and f-apps.
Notable changes (newest at the top)...
- 20130919: Realized i hadn't updated the news in a while. Future news will be posted as technotes in the /timeline.
- 20130901: Milestone: side-by-side (SBS) diff generation was ported in.
- 20130831: Milestone: the basic diff-generation code has been ported in (context diffs only, not yet SBS).
- 20130828: Milestone: we can now create new repos.
- 20130825: Minor milestone: clients can now hook in to the crosslinking phase. This is the first step needed for generating native-language timeline views.
- 20130824: Minor milestone: saved the first wiki changes today.
- 20130822: Milestone: the "verify at commit" operation, which ensures that fossil can actually read back what the user would like to save before the transaction is committed, is in place and working (or not failing ;). This was the last missing piece of the lower-level SCM bits (or the last piece which was holding anything up - there might be more pieces to port once i get around to the 'rebuild' functionality).
- 20130819: Minor milestone: we can now losslessly round-trip Event Artifacts to/from fossil. Event crosslinking was implemented.
- 20130816: Milestone: manifest parsing is more or less complete, covering the whole range of control artifact types. Strict validation is done (including the Z-card hash) to ensure that bogus manifests cannot be read (and the generator does the same at several different levels). "Parsing," in this context means converting a raw Fossil manifest to a higher-level (OO) construct. That construct can then be output to a new manifest which is identical to the old one, providing a 100% loss-less round-trip conversion. (Such round-trips are useful only for testing/proof-of-concept, and are not needed in practice.)
- 20130815: the past couple days have seen many incremental additions to the manifest machinery. We can now "round-trip" some artifact types, parsing them into a high-level form and re-generating them from that high-level form.
- 20130812: Started the f-apps.
- 20130811: Got "manifest crosslinking" of control artifact (tag changes) ported in.
- 20130810: Milestone: the library saved its first tag today! (The timestamp of the tag was intentionally falsified for testing purposes.)
- 20130808: Restructured source tree and ported build configuration process to autosetup (because that's what Fossil uses). Existing build files (not the sources) still require GNU Make on a Unix platform, though. Many thanks to Steve Bennett (autosetup's author) for his assistance.
- 20130804: ported in the symbol-to-uuid resolution bits from the main repo. These are what allow apps to use short-form UUIDs and symbolic names like "trunk," instead of having to use 40-byte UUIDs everywhere.
- 20130803: most of the infrastructure for creating manifests and control artifacts is in place, but we don't yet write them to the db.
- 20130801: ported in the delta generation/apply code and added script bindings for them.
- 20130730: changed internal handling of DBs from 1 connection per db to a single main connection to an in-memory db and attaching the repo/config/checkout to that. Not yet sure if this is a feature or a bug, but it simplifies the internal tracking of db handles notably.
- 20130728: it can now search for and open a checkout based on a directory name, analog to how v1 finds an open checkout.
- 20130727: started work on a th1ish script engine binding for v2. It is of course a work-in-progress but it is extended in parallel to the core lib because that simplifies testing and helps work the kinks out of the core API.
- 20130726: when opening a repo db, the library now validates that it is a repo db, and can distinguish between/report various types of errors, e.g. repo schema is out of data or the db is not a fossil repo.
- 20130725: removed the per-instance allocator configuration - it is now library-wide. This simplifies buffer usage and makes it legal to use them before instantiating a fossil context.
- fossil-logo-3.png [download] added by stephan on 2021-07-16 18:12:00. [details]