I’ve been using myrepos for a while - as someone who juggles a lot of repositories, both for personal projects and as a Fedora and CentOS packager, a ~/.mrconfig synced via Nextcloud really makes checking out repositories consistently, on different computers, straightforward.

As the number of tracked repos grow, however, trying to remember where each repo is checked out gets a bit time consuming – and also, keeping the configuration file organized as well; mr register on an existing repo would add the entry for that repo at the end of the file, and I was previously resorting to editing the file by hand to get it sorted - with a varying degree of success.

Here’s a very simplified version of how my repositories are organized:

tree ~/src/
├── fedora
│   └── folly
├── github
│   └── folly
├── gitlab
│   └── blog
└── sourcehut
    └── ansible

Note that there are two repositories named folly: one for the upstream source code, and one for the Fedora dist-git repo that controls its packaging.

After one too many times finding myself doing grep repo ~/.mrconfig, I decided to write a tool to help. It’s reasonably simple, thanks to myrepos using an INI file for its configuration that Python’s configparser handles perfectly fine.

Behold myrepos-utils; it currently provides two commands:

  • find takes a query consisting of one or more strings and spit out the repositories matching them
  • sort sorts ~/.mrconfig so it’s easier to read (as a byproduct it also reindents it)

So with our example layout,

$ mr-utils find folly
$ mr-utils find fed folly
$ cd $(mr-utils find git folly)
$ pwd

Hey presto!

Chain-loading multiple .mrconfig files not supported yet, and conversely, filtering out repositories that are not checked out yet is also not supported yet (but trivial to add). But so far this has really simplified my daily workflows!

Coming soon to a Fedora mirror near you.

This post is day 18 of my #100DaysToOffload challenge. Visit https://100daystooffload.com to get more info, or to get involved.

Have a comment on one of my posts? Start a discussion in my public inbox by sending an email to ~michel-slm/public-inbox@lists.sr.ht [mailing list etiquette]

Posts are also tooted to @michel_slm@floss.social