Files

307 lines
28 KiB
Plaintext
Raw Permalink Normal View History

Episode: 2564
Title: HPR2564: Intro to Fossil
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr2564/hpr2564.mp3
Transcribed: 2025-10-19 05:42:16
---
This in HPR episode 2564 entitled Intro to Fossil, it is hosted by Klaatu and in about 33 minutes long and carrying a clean flag.
The summary is Klaatu talks about the Fossil version control system.
This episode of HPR is brought to you by an honesthost.com.
Get 15% discount on all shared hosting with the offer code HPR15, that's HPR15.
Bet your web hosting that's honest and fair at An honesthost.com.
Hey, when this is Klaatu, you're listening to Hacquafala Radio. I want to talk about Fossil,
the source control management system. This is something I've been playing around with lately,
just because a friend of mine, over two, won't stop bugging me about it. He keeps telling me,
oh, you should try Fossil. And I've ignored him for a good, I don't know, two years.
So finally, last month or so, two months ago maybe, I decided I was going to finally try Fossil.
And I tried it, and I quite like it, actually. And you might think, oh my gosh, are you saying
you're not going to use Get anymore because you've got a whole series on Get on Hacquafala Radio.
And indeed, I do have a whole series of Get, and I'm not walking away from Get by any means.
I just think that it's good to have a variety of tools. That's one of the advantages of open
source. So looking at Fossil, finally, after several years of being bugged about it,
I've looked at it, and darn it, I like it. It's a really solid tool. I'm having a good time with
it, and I thought I would share it with you, the friendly Hacquafala Radio audience.
So first of all, of course, you need to install Fossil. If you're on Linux, you can just
pull it from your software repository, you know, sort of a DNF install Fossil, maybe your Fossil-SCM.
I'm not sure which one that would be on Slackware, it's just Fossil. So you can just
pull it down from SlackBuilds.org and compile and install. Or, of course, if you're on another
platform, or if you like to compile from source manually yourself, then you can go to Fossil-SCM.org
and go to click on the Downloads tab on that page, and you'll see all the different downloads
that they offer. So that's easy. That's the easy part, getting it installed. So let's review
some of the basics, and that's really, you know, disclaimer here. I don't know that much about
Fossil yet. I've only been using it for a couple of months, and then only on one project.
And it's a single-person project. I'm not collaborating with other people over Fossil. It's
very limited in my usage so far, but I still want to introduce you to it. So that's what this is
going to be, an introduction to the basics. So I'm going to make a new directory, and I'm going to
call it hpr-fossil. I'll just do that so that everything's sort of self-contained.
Although, to be honest, Fossil is quite self-contained itself. You'll see what I mean. So the first
command that you want to issue when using Fossil probably is, well, the first one should be a Fossil
help. That gives you a list of all the sub-commands that Fossil has available to it. So if you think of
commands like, well, certainly like Git, but I know that there are quite a few others that I'm not
thinking of right now, where you've got sort of the main role zipper on OpenStooth. You know,
you've got the command, and then you've got that sort of verb afterwards. That's how it kind of
Fossil's structure as well. So you have Fossil, and then a bunch of other Fossil commands that you'll
be issuing. Now, you don't have to do all of this from a Unix shell. You certainly can, like I
am, but there are other ways to interface with Fossil, just like there are other ways to
interface with SVN or Git. The big one that I know exists is called Fuel F-U-E-L, and that is a
cute-based GUI interface to Fossil. I've never used it, cannot vouch for it. So Fossil
says that there are, well, the command that you would probably latch onto as if you've used
version control systems before is init, i-n-i-t, for initialize. Now, that is actually
simlinked or synonymous with new in EW, which I think not everybody knows what init means. It could
be initiative, it could be initial, be initialize. All of them are related, obviously, those terms, but
init does not necessarily, to a lot of people, mean create a new project here. So I'm going to be
progressive, and I'm going to use Fossil new, because I like that. And then I'm going to give it a
project name of show notes, because that's what I'm going to be working on as I do this example.
I'll be documenting the example for show notes. All right, so it spits out a bunch of information
at me. One is the project ID, one is the server ID, and one is the admin user. Now, this is unique
to me, at least, coming from Git. I had no concept of this, that there would be an admin user of the
repository that you're creating. So the admin user is class 2. The initial password is, it gives me
like this little random six character string for my initial password for the repository. So I'm going
to copy that to my clipboard, just because I'll probably paste it somewhere in a moment. And
this is kind of a hint of the things to come, because in Git, of course, there is no idea that
someone owns a repository, really. I mean, the instance of that Git repository that you have on
your computer is your instance, and you are the admin user of it. But this this thing is telling
me that there's an admin user of this of this repository, almost like something like Githolite would
have. If you don't know what Githolite is, I did a hacker public radio episode on it previously.
You should go listen to it sometime. I mean, if you're interested in admin string Git. So here's
a repository that I have. If I do an LS, sure enough, there is a single file called show notes.
If I do an LS-A, because that is what I did the first time that I was doing this,
it's still just show notes. There are no hidden files. There's nothing extra here. This is
the repository that I've just created is called show notes, and that contains everything.
That's really kind of cool. It's a file. It is a single file. The repository is
just one file. In fact, if I do file space show notes, it tells me the show notes file is a
fossil repository, specifically SQLite 3 database. SQLite 3, what an interesting choice the author
of fossil has made. So now we'll do fossil open show notes, and it spits some more information out
at me. I won't cover it all because not all of it is relevant, but the something to note is that
the comment is that this was the initial empty check-in user clatu, and the check-ins so far
have been one. There have been one check-ins so far. Well, then it's time to generate some more
data and start committing some data to our repository. So I'm going to create a new file with EMAX
and call it show notes.html. And into this new file, I'm going to type some instructions, which
should ideally contain pretty much everything that I've done up to this point and a step or two
thereafter. So I'm going to create a new fossil repository with fossil new show notes, add the work
with fossil ad show notes.html, and then commit your work with fossil commit-m for message. I
guess or comment added show note HTML file. All right. So now I'm going to actually follow through
on those things. So if I do an LS, now I see show notes, the repository file, and I also see show notes
.html, which is the show notes that, once you, by the time you hear this episode, will be in the show
notes of a of hacker public radio. So that's two files. So if I do a fossil status, it shows me that
I still only have my most recent commit. So there's a comment, which was the initial empty check-in.
So that's all I've got so far in fossil is just that one thing that I did when I first created it.
In order to get my new work into my repository, I need to first add that file to a kind of staging
area so that when I do a commit, it pulls that file in off the staging area and puts it into the
repository. And it's probably worth mentioning that the staging area is not a physical place. It's
not we're not actually moving my file into some other directory or anything like that. It's
almost like we're tagging it to be added at some point. So I'll do a fossil add show notes .html.
And that tells me in no uncertain terms added show notes. So now nothing's been committed yet.
It's just added. It's sort of ready to go. And in fact, if I do a fossil status, now I get all that
information plus a line at the bottom that says added show notes dot html. So I know that show
notes dot html, that file that I just added to my or that I just created is imminent. It is going
to be committed the next time I tell fossil to commit stuff. So now let's tell fossil to commit stuff.
So I'm going to do a fossil commit dash dash comment or dash in if you're lazy. And and then I'll
put the message added show note html file. So notice that I didn't have to tell it what to commit.
I just told fossil to commit and it it committed stuff. What did it commit? Well, it committed
everything that was waiting to be committed. So if I do a fossil status now, remember last time
it said added show note dot html at the bottom of that message. Now it just comes up with a clean
state. It tells me, yep, here's your repository. The latest thing that you did was added show note
html file user. I think a really great way to demonstrate the next thing is to break stuff. So
we're going to open up. Actually, we'll just do an echo quote, oops quote. And then we'll redirect
that into show notes dot html. And now if I were to do a cat of show notes dot html, of course,
I would get one line instead of the show notes that I've been building as I've made this episode.
And that would be a bad thing. So how do I revert back to to the file that I did to the last
known good version of a file in fossil? Well, we could do fossil help and kind of review some of these
these commands. I'll just tell you. I'll cheat and just let you know that it's the sub command
for reverting to an old file is revert. So fossil revert show notes dot html. And it tells me,
again, sort of in big capital letters, hey, we've just reverted show notes dot html. And that even
helpfully tells me that hey, if you didn't mean to revert, you can undo the revert. So so first
with fossil undo. So first I'm going to do a cat of show notes dot html. Yes, all of the contents
are there that it's been restored. So reverted. But let's pretend for a minute that no, I didn't
mean to do that. So now if I do a fossil undo show notes dot html, it undoes that reverse revert
action. If I do a cat, I'm back to oops. So now I can do fossil revert again to get back to my
original file. So at this point, I can make other changes to the file and I can do other
I can add it again with all my changes. And then I can commit it again with a message,
some updates. And so that's kind of your your daily routine would be fossil open at the
beginning of the day, do your work. And then yes, you can do a fossil close. So if I do fossil
close show notes, yeah, just show notes, then you are closing your connection with the database,
the fossil help close as the opposite of open, close the current database connection requires
dash dash force flag. If there are unsaved changes in the current checkout, or if there is a
non empty stash, probably won't talk about stash, but the the thing about this is that
that when you're finished, you want to you want to commit all of your stuff or or do whatever
you need to do with your your unfinished work and then close out your database connection.
Now it's pretty resilient. And if you don't close it and and turn off your computer or something,
I haven't had a problem. I'm just saying you can close the database. Yeah, the the repository
thereby severing the connection with it now at this point with it closed, if I let's do an echo
oops again into show notes dot HTML. And then I try to let's say add show notes dot HTML,
fossil add, then it tells me that the current directory is not within an open checkout.
And just just the same if I tried to do a fossil revert show notes dot HTML gives me the
the same error message. So now if I do a fossil open show notes, it detects that the local
version like my my copy of this file has changed since the last time I've had my repository open.
So it is asking me should my repository in show notes the the database file overwrite home
clad to hpr-fossil show notes dot HTML. So in this case, I'm going to say yes.
So now if I do a cat of show notes dot HTML, I've got my full file there that I had committed
earlier and and my my oops echo into that file is is now reverted. So that's something to be
aware of that there is an open and closed state in fossil. I don't really know if there's an
equivalent to that in other control version control systems, but that's the first time I'd really come
across it. Okay, so that's that's the basics of fossil creating a repository making change or
creating data, adding it, committing it, screwing things up, reverting it. That's more or less
the workflow for fossil. Let's really briefly look at this this thing that everyone's really excited
about, which is the interface of fossil. So it turns out it's interestingly that fossil has its own
is its own host. In fact, if you go to fossil-scm.org, you're looking at a fossil repository.
I know that seems crazy, but it's true. That is that is a fossil repository. You can see this
on your own computer in action. So I've got fossil open. I'm going to do fossil open show notes.
Okay, so that's open now. Well, it was already open, but I've confirmed that it's open. And now I'm
going to do fossil space UI, and it says listening for HTTP requests on TCP report 8080, and it even
launches a track, a file, what are they called? Web browser. Inconquer, no less. I wonder how I
set that. I must have set that somewhere. Well, anyway, what I'm looking at here is an unnamed
fossil project, and I'm looking at the timeline. Now, this is a fairly, I don't want to say fully
featured website, but I mean, it kind of is. It's got more features, maybe, than you'd think it would.
So I'll kind of quickly go over a couple of them. So up in the right corner, I see that I am logged
in this class too, and I can log. Well, if I click log out, it won't actually let me log out,
because I've launched this from the fossil UI. But what I can do from this page in this
ostensible log out page is change my password or update my password. So remember the password
string that it gave you. It was like six characters. When you first create the repository,
if you use that in the area where it says change password, then you can, you put the old one in
the old password box and put a new password in in the new ones, and then click update, and that
changes your password. It then drops you off at the main, well, the homepage for your repository,
really. So right now, unnamed fossil project slash home. And it tells you, this is a stub homepage
for your project. To fill this page in, first go to set up slash config and establish a project name,
then create a wiki page with that name. The content of that wiki page will be displayed in
place of this message. So if I go to set up config, there are text fields here. I could put in,
I think this was HPR fossil show notes. So I'll put that in. And there are other options, like,
you know, descriptions for the project so that visitors to the site would know what it's all about
and so on. So you can fill all that stuff in, have a look at it yourself. Apply the changes,
go back to the home tab to get the browser to refresh its view. And indeed, it says now HPR
fossil show notes slash HPR fossil show notes. If I click on the timeline, then it does show me
kind of a view of all the different commits, all what three of them technically. And you can look
at the file listing. So it shows that you've got this file here. You can click on it. And it
tells you the history of this file. You can look at the text contained in the file or you can look
at the HTML render of the text in the file. It is, it's pretty much like if you think of a typical
Git lab or GitHub or whatever online rendition of a Git repository that you are used to. It is,
it's, it's, it's that. It has, it has its place for documentation. It's got a little wiki on it.
It has got a listing of all the branches and of all the files contained in the repository.
It's got a ticketing system built in. It's got everything that you would expect to find from,
you know, one of those sites self contained just as a feature as a feature of, you know,
it's just included with the package. It's just, it just comes as is. You get all, you inherit all
of this. It's actually quite amazing. If you think of how many people really do believe that
something like Git Hub, for instance, has revolutionized Git by, by adding all these great features
and, you know, they kind of go crazy over it. And Fossil just has it all bundled in as part of,
as part of the repository. It's really, really crazy. And, and so every repository is its own
hosting service in a way. I mean, it's not because you still need a place to put it online
or, or in your intranet. But it comes with that interface, that interactive interface for everyone
to, to contribute to in some way. And, and obviously it has its own user management system.
You can add users. You can grant them permission for different users permission to do different
things. All that stuff. It's, it's all, if you just go to the admin tab, you have all kinds of
different options in the admin section. And, and this is all driven, you know, by SQL,
SQLite, I guess. And, and it's all within that little tiny repository file that you created
at the very beginning of this episode. It's very, very impressive. I, I don't know how to go on
about it enough. It, it's just, when you see it in action, like really see it, then,
then you kind of get a feel for just how cool it is. And, it's funny because for two years,
my friend Cobra 2 has been telling me what I'm telling you now. It's, it's amazing. It's,
it's all this stuff built in. Didn't care, didn't care, didn't care. But now that I'm seeing it,
I'm really excited about it. It's really, really cool. And, when I say really, really cool,
I mean, the, the potential is really, really cool because frankly, I'm not going to use half of
these features. And, and I guess that's, that's why it took me two years to try this. But,
but I could see myself using these features. And, and I, I can see myself using these features
for certain projects. You know, this, this, this could be really, really ideal for, for a certain set
of, of projects that maybe don't need to have the kind of, um, stumble upon chance that others,
others do. I mean, I've always said that about those get hosting sites. The, the, the real,
the real advantage there is that, or, well, the, the primary advantage for me is that they mirror
my stuff. It's a quick and easy way to get pretty cheap and easy cloud host, you know, a cloud
backup of a lot of the data that I, I, that I produce that I'm going to publish publicly anyway.
So that's nice. But the other one is that there is that opportunity for people to kind of
stumble across them because they think, they, you know, because they're just, they're looking
around on, get something and, and they find a project that they, they can use or fork or
contribute to or whatever. All right. So now what we're going to do is we're going to put this
thing on a server because that is, I think, I mean, while you can use Fossil locally, just fine.
I think part of the, the real reason that one would think to, to use Fossil is to then distribute,
distribute the code or the contents of their repository. So we will move this, first I'm going to
do a Fossil close to close the connection with the database. And then I'm going to go over to a
server, just a Raspberry Pi that I have in my house running, running NetBSD.
And oh, no, I'm not going to do that. Looks like NetBSD or at least whatever I installed. I mean,
I know that it's NetBSD. Whatever version of package source I installed on my NetBSD Pi,
it's a very old version of Fossil. And I'm afraid. So if you do Fossil version, it will tell you
what version you're on. And on my Slackware box that I'm sitting at right now, it's version 2.6.
And on this NetBSD, it's 1.3 and on a Debian server that I have access to.
It looks like it is 1.29. So that's even older. So, okay. So I'm not going to do that right now.
Just because I've experienced problems with older versions versus newer versions. So what I'll do instead
is I will just do it locally and it will be the same theory, just like, you know, I'm just doing
it locally instead of actually a over server. I do know that this works from server to server.
And it does even work bridging the versions. It still has, it still has got the functionality,
but I've had problems going from something that was created in a very new version of Fossil,
sending it back to an old version of Fossil and expecting it to work smoothly. So if I go the other
way, it's fine. And I haven't really followed up on that. So don't take that as an authoritative
word on that subject, but that's what we're doing for now. So I'm going to look at my HPR-Fossil
folder. And inside that folder, we know that we have show notes and show notes.html.
So the Fossil repository is not HPR-Fossil. It's not the outside. It's not the parent folder.
It's the actual file. That's the thing that I keep having to remind myself. So I'm reminding you
probably over much. So I'm going to make a new folder called HPR-Clone. And then I'll do a Fossil
clone. And then you have to prefix the kind of clone action that you're doing with either file
colon slash slash or SSH colon slash slash or I think HTTPS colon slash slash. So I will do file colon
slash slash. And then strangely, another slash. We didn't put another slash. And I'm saying this,
again, because when I was cloning stuff before, I kept doing a clone from SSH colon slash slash
example.com. And then I do colon and then like till the slash path to Fossil. Well, don't do it
that way. It ate one of my slashes or it ate a character or something. And so the point is
when in doubt put a slash in front of your in front of your absolute path because Fossil
you might Fossil expects prefixes more often than you might be used to from other
version control applications. That's what I've found. So file colon slash slash slash slash slash
that's three home slash clatu slash HPR-Fossil slash show notes. That's the repository. And then I
need to give it a destination. So I'll do this as show clone. It goes out to the fake server that
we're using in grabs show notes, the Fossil repository and drops it into my current directory as
show clone. So now I can do a show. I mean, a Fossil open show clone. And it sort of extracts,
if you will, show notes dot HTML and dumps it into your current directory. If we do a cat on show
notes, dot HTML, everything is there as expected. So now let's transfer some data back and forth.
So we'll just really quickly. I guess let's just add a new a new file at this point. So I'll just
I'll do an email text file dot TXT. I'll put some text in here, some text in here. I'll save that.
And now I'm going to instead of I'm not going to do any I'm not going to add or commit yet. I
want to do one thing to kind of emphasize something to you. So there's a again, if I do a
Fossil help, you can see this, but I'll just tell it tell it to you. So fossil remote dash URL.
And that reveals to you what this is a clone of. Okay. So in this case, it's just another file on
my hard drive. It's pretty easy to access. It is something that I have available to me.
And and if it would have been an SSH or if it had been a server and I had all the SSH stuff sorted
like the keys and things like that all installed for the different for for copying
between the two servers, then that would be accessible. And the reason I'm saying that is because
now I'm going to do a fossil add test file. And then I'm going to do a fossil commit dash m
for my commit message. And I'll say that this is a new file. And now this commit as you as you
watch it, if you're if you were to watch it, it doesn't auto sync after it commits. So that means
that it actually goes out to the remote copy of this repository. And so you're pushing the change
or essentially you're you're committing it to your local repository, but you're also pushing it
to your remote. So in fact, if I go CD dot dot slash HPR dash fossil. And I do a fossil update.
Nope. Sorry, it's not open. So fossil open. And as it opens, actually, it detects that it has a new
file committed to it. It copies or it sort of extracts test file dot TXT from the repository
and places it into my local directory. And it even confirms to me that yes, there have been four
check-ins now. And the latest comment was here is a new file from user class two. So the two
repositories are now equal. They are the same. So as you can see, it's it's fairly easy actually to
implement a shared fossil repository. I mean, things like geto light exist, forget, but fossil
just has that built in. You put your fossil repository on a server that the internet can access.
And now your collaborators can they can you can create accounts for them. They can log in clone
repositories, push changes, branch things, file tickets, just everything that you would want to do
in any kind of online hosting thing. Now, if for whatever reason, maybe you don't have access
to a server that you can put your fossil repository onto, if if for some reason you want hosting,
like GitHub style hosting, that isn't just your fossil repository. There is such a place. It is
called chisel app. That's C-H-I-S-E-L-A-P-P dot com. And it's a free hosting site for fossil projects.
I don't know who runs it. I don't know where it came from. It is referenced on the fossil dash
S-C-M website. So fossil at least knows that it exists. But I don't know anything else about that
site. I do have an account there. I did throw some data on there for kicks. It's been working
pretty well so far. I haven't really used it all that much, to be honest. But I've kind of been
trying it out a little bit. And it seems to be capable of some things. So there you go. There's the,
I guess, that social coding or whatever they say, that experience of, hey, I want to look at a
bunch of random open source projects. Let me see a bunch of repositories. And then clicking through,
that'll get you that experience. That's about everything I have on fossil. I hope this has been
informative. If nothing else, I hope this has encouraged you to try out fossil. Don't be like me
kids and be blind to other options in the open source world. Try different things. For instance,
fossil instead of get. That said, I'm a big fan of get. And I'm not suggesting anyone migrate
one from the other. But I do think that they're both handy tools to have. And open source is all
about choice. And who knows? Maybe you'll be in a project with, with people who just cannot
wrap their mind around get or don't want to use it. Or for whatever reason, think that that's not
the right choice for their project. Or maybe you need something with an easy, a quick and easy
web interface for people to go interact with. Fossil, maybe the thing that you're looking for.
So check it out today. Have it in your back pocket when you need it. Or switch to it for all I care.
I don't know. I don't have a horse in this race. Thanks for listening. I'll talk to you next time.
You've been listening to heckaPublicRadio at heckaPublicRadio.org. We are a community podcast
network that releases shows every weekday, Monday through Friday. Today's show, like all our shows,
was contributed by an HPR listener like yourself. If you ever thought of recording a podcast,
then click on our contribute link to find out how easy it really is. Hecka Public Radio was
founded by the digital dog pound and the infonomicum computer club. And it's part of the binary
revolution at binrev.com. If you have comments on today's show, please email the host directly,
leave a comment on the website or record a follow-up episode yourself. Unless otherwise status,
today's show is released on the creative comments, attribution, share a light, 3.0 license.