The need for Negentropy

What if you are a developer, working on a number of repositories, some of your own, some open just for documentation. Wouldn't it be nice if you had a database with all the names, the endpoints, and what they do in one place?

Wouldn't it be nice to have it automatically sorted in a local schema like this ?

CREATE TABLE projects ( id char(36), name text, description text, type text, project_group text, oldpath text, status text, mod_time char(32));

CREATE TABLE repos ( id char(36), id_project char(36), refname text, description text, mod_time char(32));

CREATE TABLE project_type ( id char(36), name text, description text, mod_time char(32));

Well, turns out that this is possible.

Go get negentropy! The configuration will go in:

~/.negentropy.cfg 

Since I am not a maniac of control, I can just define the top dirs that I intend to scan for esisting local clones like that:

ROOT_DIRS="~/some-dir ~/some-other-dir ~/yet/another/dir"

This way, entropy is IN. But for new upcoming projects and clones, we will want a single new destination to be used, therefore:

CHECKOUT_DIR=$HOME/dev/simple

then a custom place to save the db file:

PROJECTS_DB=$HOME/.negentropy.db

and, where you see that you are working in a company and the git endpoints always have the same prefixes, you can have:

REPO_SERVER_PREFIX=gituser@gitserver:some-prefix/

To cut it short, you can have my config as example:

cat ~/.negentropy.cfg 
ROOT_DIRS="~/some-dir ~/some-other-dir ~/yet/another/dir"
CHECKOUT_DIR=$HOME/dev/simple
PROJECTS_DB=$HOME/.negentropy.db
REPO_SERVER_PREFIX=gituser@someserver:customer/

Do you want to import all of your repo into the database ? Just do:

negentropy -i

If now you want to list all the repos in your database, jou can just do:

negentropy -l

Now that you ruled out the entropy of sparse repos laying around, every time that you create a new project/repo for yourself, you can just do:

negentropy -n  <project> 

and enter by hand a minimum of description about the project for the purpose of the info database. You can create a local clone by issuing the command:

negentropy -c  <project> 

For a quick oiverview of all the options, you can just type:

$ negentropy -h
negentropy <options>

-i                     : bulk import projects on disk
-s  <name>             : search for <name> in the project name
-c  <repository>       : clones <repository>
-n  <project>          : create new <project>
-D  <id_project>       : delete <project> by uuid
-e  <id_project>       : edit project description for <id_project>
-p  <id_project>       : print description for <id_project>
-X  <target_dir>       : create all repos dir in <target_dir>
-z  <name><target_dir> : exports as *.tgz repo <name> in <target_dir>
-Z  <target_dir>       : exports as *.tar all repos in <target_dir>
-l                     : list all projects on db
-h                     : prints this help

Paolo Lulli 2021



[git]