fastws-cli 0.0.4__tar.gz → 0.0.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  <!-- do not remove -->
2
2
 
3
- ## 0.0.4
3
+ ## 0.0.5
4
4
 
5
5
  ### New Features
6
6
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastws-cli
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: Fast workspace tools for multi-repo management
5
5
  Author: Jeremy Howard
6
6
  License: Apache-2.0
@@ -66,6 +66,7 @@ Show uncommitted changes and unpushed commits:
66
66
 
67
67
  ```bash
68
68
  ws-status
69
+ ws-status --branches
69
70
  ```
70
71
 
71
72
  ### `ws-branches`
@@ -45,6 +45,7 @@ Show uncommitted changes and unpushed commits:
45
45
 
46
46
  ```bash
47
47
  ws-status
48
+ ws-status --branches
48
49
  ```
49
50
 
50
51
  ### `ws-branches`
@@ -1,4 +1,5 @@
1
- __version__ = "0.0.4"
1
+ __version__ = "0.0.5"
2
+
2
3
 
3
4
 
4
5
  from .core import *
@@ -254,8 +254,9 @@ def ws_pull_cli(
254
254
 
255
255
  def ws_status(
256
256
  repos_file: str = "repos.txt", # File containing repo list
257
+ branches: bool = False, # Show unpushed commit details
257
258
  ):
258
- "Show uncommitted changes and unpushed commits across repos."
259
+ "Show uncommitted changes and optionally unpushed commit details across repos."
259
260
  repos = _load_repos(repos_file)
260
261
  for repo in repos:
261
262
  d = _repo_dir(repo)
@@ -265,18 +266,22 @@ def ws_status(
265
266
  changes = g.status('-s') or ""
266
267
  if isinstance(changes, list): changes = "\n".join(changes)
267
268
  unpushed = ""
268
- try: unpushed = g.log('--branches', '--not', '--remotes', format='%h %s') or ""
269
+ try:
270
+ if branches: unpushed = g.log('--branches', '--not', '--remotes', format='%h %s') or ""
271
+ elif (branch := g.branch(show_current=True).strip()) in ('main', 'master'):
272
+ unpushed = g.log('@{upstream}..HEAD', '-1', format='%h %s') or ""
269
273
  except Exception: pass
270
274
  if isinstance(unpushed, list): unpushed = "\n".join(unpushed)
271
275
  if changes or unpushed:
272
276
  print(f"\n=== {d} ===")
273
277
  if changes: print(changes)
274
- if unpushed: print(unpushed)
278
+ if unpushed: print(unpushed if branches else "unpushed commits")
275
279
 
276
280
  @call_parse
277
281
  def ws_status_cli(
278
282
  repos_file: str = "repos.txt", # File containing repo list
279
- ): ws_status(repos_file)
283
+ branches: bool = False, # Show unpushed commit details
284
+ ): ws_status(repos_file, branches)
280
285
 
281
286
  def ws_branches(
282
287
  repos_file: str = "repos.txt", # File containing repo list
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastws-cli
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: Fast workspace tools for multi-repo management
5
5
  Author: Jeremy Howard
6
6
  License: Apache-2.0
@@ -66,6 +66,7 @@ Show uncommitted changes and unpushed commits:
66
66
 
67
67
  ```bash
68
68
  ws-status
69
+ ws-status --branches
69
70
  ```
70
71
 
71
72
  ### `ws-branches`
@@ -166,3 +166,62 @@ def test_ws_add_updates_repos_then_runs_sync(tmp_path, monkeypatch):
166
166
 
167
167
  assert (tmp_path/"repos.txt").read_text() == "AnswerDotAI/existing\nanswerdotai/fastws\n"
168
168
  assert calls == [(str(tmp_path), "repos.txt", "pyproject.toml", "pyproject.tmpl")]
169
+
170
+
171
+ def test_ws_status_summarizes_unpushed_commits_by_default(tmp_path, monkeypatch, capsys):
172
+ (tmp_path/"repo1").mkdir()
173
+
174
+ class FakeGit:
175
+ exists = True
176
+ def __init__(self, d): pass
177
+ def branch(self, **kwargs): return "main"
178
+ def status(self, *args): return ""
179
+ def log(self, *args, **kwargs): return "abc first commit"
180
+
181
+ monkeypatch.chdir(tmp_path)
182
+ monkeypatch.setattr(core, "_load_repos", lambda repos_file="repos.txt": ["AnswerDotAI/repo1"])
183
+ monkeypatch.setattr(core, "Git", FakeGit)
184
+
185
+ core.ws_status()
186
+ out = capsys.readouterr().out
187
+
188
+ assert "unpushed commits" in out
189
+ assert "abc first commit" not in out
190
+
191
+
192
+ def test_ws_status_ignores_unpushed_commits_off_main_by_default(tmp_path, monkeypatch, capsys):
193
+ (tmp_path/"repo1").mkdir()
194
+
195
+ class FakeGit:
196
+ exists = True
197
+ def __init__(self, d): pass
198
+ def branch(self, **kwargs): return "feature"
199
+ def status(self, *args): return ""
200
+ def log(self, *args, **kwargs): return "abc first commit"
201
+
202
+ monkeypatch.chdir(tmp_path)
203
+ monkeypatch.setattr(core, "_load_repos", lambda repos_file="repos.txt": ["AnswerDotAI/repo1"])
204
+ monkeypatch.setattr(core, "Git", FakeGit)
205
+
206
+ core.ws_status()
207
+
208
+ assert capsys.readouterr().out == ""
209
+
210
+
211
+ def test_ws_status_shows_unpushed_commits_with_branches_flag(tmp_path, monkeypatch, capsys):
212
+ (tmp_path/"repo1").mkdir()
213
+
214
+ class FakeGit:
215
+ exists = True
216
+ def __init__(self, d): pass
217
+ def branch(self, **kwargs): return "feature"
218
+ def status(self, *args): return ""
219
+ def log(self, *args, **kwargs): return "abc first commit"
220
+
221
+ monkeypatch.chdir(tmp_path)
222
+ monkeypatch.setattr(core, "_load_repos", lambda repos_file="repos.txt": ["AnswerDotAI/repo1"])
223
+ monkeypatch.setattr(core, "Git", FakeGit)
224
+
225
+ core.ws_status(branches=True)
226
+
227
+ assert "abc first commit" in capsys.readouterr().out
File without changes
File without changes
File without changes
File without changes