Skip to content

Commit

Permalink
align repo msg (#250)
Browse files Browse the repository at this point in the history
* align repo msg

* fix unit tests
  • Loading branch information
nosarthur authored Jul 13, 2023
1 parent fe06bd2 commit db47e28
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
install:
pip3 install -e .
test:
pytest tests --cov=./gita $(TEST_ARGS) -n=auto
pytest tests --cov=./gita $(TEST_ARGS) -n=auto -vv
dist:
python3 setup.py sdist
twine:
Expand Down
5 changes: 3 additions & 2 deletions gita/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,10 @@ def get_commit_time(prop: Dict[str, str]) -> str:
def get_repo_status(prop: Dict[str, str], no_colors=False) -> str:
head = get_head(prop["path"])
dirty, staged, untracked, color = _get_repo_status(prop, no_colors)
info = f"{head:<10} [{dirty+staged+untracked}]"
if color:
return f"{color}{head+' ['+dirty+staged+untracked+']':<13}{Color.end}"
return f"{head+' ['+dirty+staged+untracked+']':<13}"
return f"{color}{info:<17}{Color.end}"
return f"{info:<17}"


def get_repo_branch(prop: Dict[str, str]) -> str:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
setup(
name="gita",
packages=["gita"],
version="0.16.4",
version="0.16.4.2",
license="MIT",
description="Manage multiple git repos with sanity",
long_description=long_description,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ def test_ls(self, monkeypatch, capfd):
[
(
PATH_FNAME,
"repo1 cmaster [dsu] \x1b[0m msg \nrepo2 cmaster [dsu] \x1b[0m msg \nxxx cmaster [dsu] \x1b[0m msg \n",
"repo1 cmaster [dsu] \x1b[0m msg \nrepo2 cmaster [dsu] \x1b[0m msg \nxxx cmaster [dsu] \x1b[0m msg \n",
),
(PATH_FNAME_EMPTY, ""),
(
PATH_FNAME_CLASH,
"repo1 cmaster [dsu] \x1b[0m msg \nrepo2 cmaster [dsu] \x1b[0m msg \n",
"repo1 cmaster [dsu] \x1b[0m msg \nrepo2 cmaster [dsu] \x1b[0m msg \n",
),
],
)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,17 @@ def test_auto_group(repos, paths, expected):
(
[{"abc": {"path": "/root/repo/", "type": "", "flags": []}}, False],
True,
"abc \x1b[31mrepo [*+?] \x1b[0m msg xx",
"abc \x1b[31mrepo [*+?] \x1b[0m msg xx",
),
(
[{"abc": {"path": "/root/repo/", "type": "", "flags": []}}, True],
True,
"abc repo [*+?] msg xx",
"abc repo [*+?] msg xx",
),
(
[{"repo": {"path": "/root/repo2/", "type": "", "flags": []}}, False],
False,
"repo \x1b[32mrepo [?] \x1b[0m msg xx",
"repo \x1b[32mrepo [?] \x1b[0m msg xx",
),
],
)
Expand Down

0 comments on commit db47e28

Please sign in to comment.