Skip to content

Adding "ahead/behind" info to status #353

@mathomp4

Description

@mathomp4

This is a new functionality requested by @sdrabenh.

He was wondering if there is a way for mepo to display if your repos are behind (or ahead) of its remote. So a user can do mepo fetch to fetch all the repos. And then we could have:

❯ mepo status
Checking status...
MAPL       | (b) release/MAPL-v3
ESMA_env   | (t) v4.35.0 (DH)
ESMA_cmake | (b) testing-behind [stashes: 1] [ahead 1, behind 1]
ecbuild    | (t) geos/v1.4.0 (DH)

I think this is doable via:

git for-each-ref --format="%(upstream:track)" refs/heads/$(git symbolic-ref --short HEAD)

which on the above ESMA_cmake repo actually outputs:

❯ git for-each-ref --format="%(upstream:track)" refs/heads/$(git symbolic-ref --short HEAD)
[ahead 1, behind 1]

I'm not sure if for "niceness" we should have it be [stashes 1] as well, but...eh. The message is there.

Also, maybe the ahead/behind can be in orange? Or some nice color to stand out?

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions