Fossil User Forum

Managing multiple repos
Login

Managing multiple repos

Managing multiple repos

(1) By anonymous on 2025-01-11 19:09:57 [link] [source]

Fossil embeds SQLite, yet it does not appear that Fossil has any features that ease the use of multiple repos. I've never really liked the way Git does it, and I wonder if there is any effort/interest in improving Fossil in that regard. Does anybody do something more elegant than "copy the amalgamation"?

My development cycle is generally this: projects start as snippets of code that test/prove out my basic idea. When it's clear it's not just a throw-away chunk, I version it in a "catch all" repo that holds a lot of little growing projects (when free time allows :-). They live in there until they grow to become proper projects, worthy of being broken out into their own repo. There, they usually continue to grow until they become large enough that it makes sense to spin-off separate repos (e.g., an app gets refactored to be app + web api + core lib). In the process, new projects are created that are dependent on some existing repo (could be linked as a lib, or could be embedded, or whatever).

Abstractly, I suppose, it has to do with managing the history of individual files/artifacts across databases. I haven't dug into the guts of Fossil, so I'm not sure how heavy of a lift that would be. Am I barking up the wrong tree? Is my development process so unusual that no SCM has it as a use case? Thanks.

(2) By anonymous on 2025-01-17 20:33:18 in reply to 1 [link] [source]

Snippets that are not yet proven to be better than throw-away junk might belong in a PIM/IDE/outliner that can be used to organize them and keep notes about the development work. Leo is such a tool. Version control is not built in to it, but you can maintain multiple versions of a given snippet, either by giving each version is unique file name, or by putting each one in a folder of its own. Proper use of the outline can keep things organized.

Leo's Home Page []: https://leo-editor.github.io/leo-editor/

(3) By Stephan Beal (stephan) on 2025-01-17 20:58:45 in reply to 1 [link] [source]

When it's clear it's not just a throw-away chunk, I version it in a "catch all" repo that holds a lot of little growing projects (when free time allows :-). They live in there until they grow to become proper projects, worthy of being broken out into their own repo.

FWIW: fossil makes setting up new repos, including remote access, almost entirely painles (and 100% painless if no remote access is involved0. That is, i opine, less pain than trying to migrate a given bit of code through three separate lifecycles as its evolves. i.e. putting it in its own repo from the start will involve less long-term effort.

(4) By anonymous on 2025-01-18 18:32:06 in reply to 3 [link] [source]

It's one lifecycle as I see it, where code grows and gets restructured and shared. It happens between Fossil and SQLite, as I noted. While managing many open repos certainly seems to be made easy by Fossil, that still doesn't mean I want to create a hundred different databases each with the starting one-liner shell script that may or may not eventually be expanded on.

My hope was/is that Fossil would support some clever use of the database that made it easy to ATTACH (or whatever) to other repos so that they could be merged/split with ease. It's not a deal breaker or anything, and I certainly haven't found it in other tools, either (at least not in anything that doesn't target massive enterprise-level "cradle to grave" auditing). The whole "Mono Repo vs. Multi Repo" debate could stop if there was just a tool that erased the distinction.

(5) By Stephan Beal (stephan) on 2025-01-18 20:23:44 in reply to 4 [link] [source]

My hope was/is that Fossil would support some clever use of the database that made it easy to ATTACH (or whatever) to other repos so that they could be merged/split with ease.

Combining repos "can" be done with the deconstruct and reconstruct commands, combining the results of several deconstruct calls into one reconstruct call, but it requires some manual cleanup to avoid things like duplicate trunk branches or overwritten wiki pages when two repos share the same wiki page names (done that!).

Splitting repos is "not possible" (for a given value of "not possible") because Fossil's architecture is designed to provide a 100% auditable history which does not/"cannot" contain holes (barring the obligatory exception of "shunning"). Yes, it can be done, but it's a hassle and requires a fair amount of scripting and/or manual effort.

(7) By anonymous on 2025-01-19 22:19:49 in reply to 5 [link] [source]

Conceptually, I don't see a split repo as having "holes" so long as there is some method to reference another repo where the artifact can be found (by whatever mechanism). A larger Fossil-verse, if you will, that maybe expands on the idea of shun lists to represent something intentionally externalized. Or maybe the idea would be that the trunk of any given repo could be mapped to a branch of some larger repo that subsumes it, Barnsley fern style. I don't know the guts of Fossil well enough to know the best mechanism to base it on, and I appreciate it may be much harder to do than I'm thinking it is, which is why I don't already see any SCM that makes it simple.

(6.1) By Andy Bradford (andybradford) on 2025-01-18 22:29:07 edited from 6.0 in reply to 4 [link] [source]

> My  hope was/is  that  Fossil would  support some  clever  use of  the
> database that made  it easy to ATTACH (or whatever)  to other repos so
> that they could be merged/split with ease.

The closest you can get is to have multiple DAGs in the same repository.
It isn't  simple and  you'll have  to learn more  about Fossil  than you
probably want,  but it can  be done. See [1]  and [2] for  discussion of
DAG.

Here's an example of multiple DAGs in the same repository:

http://fossil.bradfords.org:11072/multidags

You'll notice  that all 3 timelines  are independent of one  another and
have no relationship.  If the branches were all named  "trunk" you would
get warnings about the repository having multiple "trunks". That's why I
named the other 2 differently.

If I  decide that  I want to  break off  one of the  DAGs into  it's own
separate repository,  I can  use the "fossil  bundle" command  to export
just one of the trunks:

$ fossil bundle export /tmp/multidags-trunk3.fossil --branch trunk3

Now, I'll need a new repository for it:

$ fossil new /tmp/singledag.fossil        
project-id: 387d45d94eb835be63308aa9d0ff7992910f33a0
server-id:  a360e5350748688ef6e26c33c7e4b4c38ea7a2b2
...

Keep track of the  project-id here as I'm going to need  it for use with
the bundle that I exported because they must match:

$ echo "UPDATE bconfig SET bcvalue = '387d45d94eb835be63308aa9d0ff7992910f33a0' WHERE bcname = 'project-code';" | sqlite3 /tmp/multidags-trunk3.fossil

$ cd /tmp
$ mkdir singledag
$ cd singledag
$ fossil open ../singledag.fossil
...
project-code: 387d45d94eb835be63308aa9d0ff7992910f33a0
checkout:     73faacda583672b68c27e9d3eeec8c08d25b26a8 2025-01-18 21:02:09 UTC
...

The  "fossil open"  output includes  a new  checkout, the  initial empty
checkout that Fossil creates by default, that I may want to remove.

$ fossil bundle import /tmp/multidags-trunk3.fossil --publish
Imported content:
  8bce244b2f719e22 check-in to trunk3 by tester on 2025-01-18 20:48 
  fa793b70eb5f7ca2 file script3.sh 
  2aef7a455cb58a2e check-in to trunk3 by tester on 2025-01-18 20:49 
  ec4fe297f74af5f0 file script3.sh 
  53696174b715c03e check-in to trunk3 by tester on 2025-01-18 20:51 
  beddb34d97e76336 file script3.sh 

To remove the empty commit in the new single DAG repository:

$ fossil ui -p info/73faacda583672b68c27e9d3eeec8c08d25b26a8

Click  the "Shun"  button  which will  place the  complete  hash of  the
artifact into the shun dialog and  you can then press "Review" to review
followed  by "Shun"  to make  it "disappear".  To completely  purge that
checkin  from the  repository, however,  you'll  have to  rebuild it  by
pressing the "Rebuild" button. It  appears that somewhere along the line
Fossil renamed the "trunk3" to "trunk".

Et voila: http://fossil.bradfords.org:11072/singledag

You may also want to remove the "trunk3" tag from the now new "trunk".


Now, there are  some caveats. First, are  you sure you want  to do this?
Second, the "fossil bundle export" might only export a linear history [I
haven't ever used it before], so if you have multiple branches in one of
your  DAGs it  may  not produce  the  desired result.  You  may have  to
experiment some with  this. Third, because this  utilizes multiple DAGs,
while you will be able to see all files in the UI, files in one DAG will
not "checkout" at the same time  as that of another (they are isolated).
Fourth, the  shunning of artifacts  is a  nuclear option that  should be
reserved for  extreme occasions. Please  see [0] for a  discussion about
shunning.

[0] https://www.fossil-scm.org/home/doc/trunk/www/shunning.wiki
[1] https://www.fossil-scm.org/home/doc/trunk/www/whyusefossil.wiki
[2] https://www.fossil-scm.org/home/doc/trunk/www/branching.wiki

(8) By anonymous on 2025-01-19 22:32:49 in reply to 6.1 [link] [source]

Thank you for the detailed how-to! Definitely far more daunting/clunky than anyone would want to do on a regular basis, and I have to assume that if there were any cleaner solutions at hand that DRH would have already hit upon them in the co-development of Fossil and SQLite. I guess my hunt for a fractal SCM continues. :-)

(9) By pjm (PhilMaker) on 2025-01-20 07:59:17 in reply to 8 [link] [source]

FWIW,

A script to create fossil repos is fairly easy though I must admit I've solved the problem a few times and each time its taken a day to do properly.

If anyone is interested drop me a line at philip.maker@gmail.com and we can discuss it. The main challenge is the diversity of fossil web engines and setups which is fossils strength.

The current solution is to create a repo you specify a new name and zero or more templates (e.g. manual, code...):

% a-make new a-green-tree-frog template-animal

Which is a TCL script that builds a repo a-green-tree-frog using the template-animal as a basis for contents. This uses either a ssh login or a fossil /ext extension to do the work. Either way the real problem comes when you need to populate a working directory with all the repos you need.

So at the risk of causing version hell each repo has a USES file containing repo tag/version pairs so that if you run the following in a repo:

% a-make all  

It clones/updates/... all the ../repos according to USES in each repo so you have all the repos you need with the correct settings, e.g. remote-url

Then it does a build/install cycle breadth first across the repos USES and do installs into ../bin, ../include etc.

% a-make clone ;# clones every repo on the remote server
% a-make update ;# same as fossil all update for ../* (in case you have other collections).

(13) By Andy Bradford (andybradford) on 2025-01-23 15:32:53 in reply to 8 [link] [source]

> I guess my hunt for a fractal SCM continues. 

If the  file or  idea really  has no relationship  with other  files and
ideas, I usually just put it in it's own repository. I have well over 80
Fossil repositories,  some of which have  just one or two  files in them
that are managed.

In fact,  at one point I  did experiment with having  multiple unrelated
files  (at the  time I  thought ther  e was  at least  some relationship
between them in that they were all in the same "category"), but later on
I realized  it was a  mistake because it  became difficult to  work with
branches and  commit comments  were often  not relevant  to most  of the
content int  he repository. Since then  I just split things  up from the
very start of  a project---I don't think I've ever  thought that I might
want to join some  of the projects, however, if I  did, I would probably
keep the originals and close all the branches (including trunk) and then
start new  Fossil repository  with them combined  or something.  I'm not
sure though because I've never had the need.

Andy

(10) By Richard Hipp (drh) on 2025-01-20 11:38:38 in reply to 1 [link] [source]

Am I barking up the wrong tree? Is my development process so unusual that no SCM has it as a use case?

Possibly. I don't precisely understand how your work, though.

Remember: I wrote Fossil for one reason → to support the development of SQLite. As it happens, Fossil has proven useful on countless other projects as well. But the key point here is that I never intended for Fossil to solve every SCM problem. Nor should it.

If you can get Fossil to work for your scenario, that is great. Perhaps write up a detailed report about how you got it working, in case that will help others. But please do not expect Fossil to evolve to meet your specific needs, unless you yourself do that evolution.

(11) By anonymous on 2025-01-20 17:47:00 in reply to 1 [link] [source]

... They live in there until they grow to become proper projects, worthy of being broken out into their own repo.

I may be speaking from a different experience, but when a project transitions through phases from a sketch to some "worthy" state, a lot of past changes may be seen as purely tactical which, indeed, belong to their own historical context. Thus it's just reasonable to let the earlier stages live in whatever repos they have been spawned. This minimizes the noise when analyzing the changes for the "worthy" state.

To maintain some historical continuity, I would just include a reference to the repo (or a specific path within) of the "past" state. This could be done via commit message (for the initial commit in the "worthy" repo), or via Tech-note (it also appears on the Timeline).

By design and principle Fossil does not allow physical changes to the history, so there's little gain in splitting-off -- it's just as good as duplication. That's why just including some reference to the past repo/repos serves the purpose without much overhead.

When an idea has been first materialized on a napkin (or back of an envelope), it makes sense to keep it as-is (if for some sentimental reason). A published work usually has some reference, so others may refer to it.

(12) By anonymous on 2025-01-20 22:23:45 in reply to 11 [link] [source]

Thus it's just reasonable to let the earlier stages live in whatever repos they have been spawned.

That is indeed my current git process (init a new repo from some "final" checkout branch of the old). But that creates a situation where the entire history is essentially "shunned", not to mention all the other features Fossil provides for a project also dropping into a black hole. It would be awfully handy to have that "include a reference to the repo" functionality managed by the SCM itself. If I ever dig far enough into the guts of Fossil I may implement it myself, unless I discover along the way that it is indeed a fool's errand. :-)

(14.2) By Andy Bradford (andybradford) on 2025-01-23 15:49:15 edited from 14.1 in reply to 12 [link] [source]

> But that creates  a situation where the entire  history is essentially
> "shunned", not to mention all the other features Fossil provides for a
> project also dropping into a black hole.

You could  include the  entire history  of the old  project in  your new
project using "fossil deconstruct" and "fossil reconstruct" as mentioned
by Stephan. Also, although Fossil will easily work with duplicate branch
names between  the DAGs,  you might  want to  rename branches  that have
conflicting names just to avoid the nags that Fossil emits. For example,
you would probably want to rename "trunk" at the very least to something
like "trunkpast" or something.

Basically you would  run "fossil init" to create a  new repository, then
use "fossil  deconstruct" to blast  out all  the artifacts from  the old
repository, and also from the new. Copy all the directories from the old
deconstructed repository  into the  new, then run  "fossil reconstruct".
This  retains both  the old  and the  new "project"  in the  same Fossil
repository.

That being said, I'm  not sure about the Tickets and  Wiki but you could
experiment and report back. Maybe this  is the "other features" that you
mention above.

Happy Fossiling.

Andy

[edits]

p.s On second thought, if you're going to do this, you might as well not
do anything and just  keep using the old project. I  think now that what
you were talking about is retaining the  history of a single file, not a
single project.

p.p.s  You specifically  mention a  branch,  you could  use the  "fossil
bundle"  command to  export  just  a single  branch  and  make that  the
beginning of your new project.

And of course this is all very  complex for someone not as familiar with
Fossil and maybe there's a reason why no SCM currently does this to your
satisfaction.

(16) By anonymous on 2025-01-24 18:06:16 in reply to 14.2 [link] [source]

That being said, I'm not sure about the Tickets and Wiki but you could experiment and report back. Maybe this is the "other features" that you mention above.

Yes; being new to Fossil I'm still playing around with what features it has and how they can best support the ways I'm doing things (e.g., I started converting my blog into a Fossil site and I experimented with Wiki vs. Tech Note vs. Forum vs. whatever as the replacement mechanism for posts). I'm still not sure I'm picking the right things, so I'm trying to think ahead on any and all operations I may have to leverage to clean up any repos I convert from Git. I like Fossil's "what you actually did" approach, but at the same time I don't usually want to bother others with my early confusion while learning.

You specifically mention a branch, you could use the "fossil bundle" command to export just a single branch and make that the beginning of your new project.

Thanks for that pointer to bundle. When I finally get a project into a state where it makes sense to split or join repos, I'll dig into all the commands that might do what I want. I was just hoping that there was some feature that either existed or was planned that made it dead-simple, based on the connection between SQLite and Fossil.

(15) By anonymous on 2025-01-24 15:05:17 in reply to 1 [link] [source]

Why do you use version controll for throw away code?

(17) By anonymous on 2025-01-24 18:28:07 in reply to 15 [source]

Well, I don't. It generally lives in my shell history or temp files. But when I find myself going back to run it again, or think of different contexts it can be used in, I want to keep it around and keep track of the tweaks that get made as it grows in functionality. It certainly seems like most developers work that way, but maybe they don't, or simply think of things differently (hence the common practice to ditch an old repo completely and start a fresh one). I'm still more interested in where they make a distinction between Mono Repo and Multi Repo approaches, and what tools they manage it with.