GEOS-ESM / mepo

Tool to manage (m)ultiple git r(epo)sitories
Apache License 2.0
3 stars 2 forks source link

repo group and context #283

Open pchakraborty opened 5 months ago

pchakraborty commented 5 months ago

gita (https://github.com/nosarthur/gita) has the concept of repo groups and context. Essentially one can define a repo-group and execute gita commands on this group. This might be helpful when working with several related repositories. https://github.com/nosarthur/gita?tab=readme-ov-file#define-repo-group-and-context.

mepo group create group-name repository [repository ...]

Create a group of repositories

positional arguments:
  group-name   name of group
  repository   repository that is part of the group

This might be useful for maintaining consistency across a repository hierarchy. For example, if we were make changes in GOCART (a la #288), we might do

GOCART steps

Local

(Local) Step 0: Create hierarchical group

mepo group create h-gocart GOCART GEOSchem_GridComp GEOSgcm_GridComp GEOSgcm_GridComp

(Local) Step 1: Create branch in GOCART and its upstream repositories

mepo checkout -b feature/<user>/gocart/some-change --group h-gocart

(Local) Step 2: Modify GOCART files and commit

Commit all changes to feature/<user>/gocart/some-change in GOCART and its upstream repositories

mepo commit -m "message" --group h-gocart

(Local) Step 3: Save current state and update registry

mepo save --group h-gocart

save ensures that all repositories, that are part of h-gocart, are clean, i.e. all sources have been committed to a branch. It then writes a new state file in .mepo and updates the registry (components.yaml).

(Local) Step 4: Push all changes

Push `feature//gocart/some-change from GOCART and its upstream repositories to remote

mepo push --group h-gocart

[!NOTE]
We can further simplify the command by defining a context

mepo context h-gocart

Then the mepo commands from earlier become

mepo checkout -b feature/<user>/gocart/some-change
mepo commit -m "message"
mepo save
mepo push

and apply to each member of h-gocart.

pchakraborty commented 5 months ago

@tclune @amdasilva @mathomp4 Thoughts?

mathomp4 commented 5 months ago

Hmm. Interesting. I'll have to stare at that for a bit to absorb it. Though I suppose the "automatic" grouping is sort of interesting.

tclune commented 5 months ago

Arlindo did look into this prior to proposing the "man pages" you have for HEPO. I don't recall which aspects led him to want to develop a separate tool, but my memory is that he thought gita was a great proof of concept.