push --json reports the state each accepted bookmark now holds, to look up what the push started (such as its checks) 60a1223c894f
refs andymccall/oxygenhub#20
- Author
- Andy McCall @andymccall <[email protected]>
- When
- · 2026-09-28 19:58 UTC
- Signature
- ✔ signed by Andy McCall
- Hash
60a1223c894fc10e022c0ce16abdbdf27064ca478400353c117f8d8f70caf951
- Depends on
- 75167672ebcd c6aa5bd9d1c8 fce44ae9ad29
- Depended on by
- nothing yet
- In bookmarks
- agents-in-readme bare-hashes carried-not-removed carry-identical doctor-trust identical-sides keyless-tags main merge-remote-bookmark only-help-103 paths-for-resolutions-and-amend push-notes show-stat subrepo-pin-state switch-says
- In tags
- v0.1.0 v0.10.0 v0.11.0 v0.2.0 v0.3.0 v0.3.1 v0.4.0 v0.4.1 v0.4.2 v0.4.3 v0.4.4 v0.4.5 v0.4.6 v0.5.0 v0.5.1 v0.6.0 v0.7.0 v0.8.0 v0.9.0
- Edits
- 4 atoms, 0 tree operations, 2 files
Browse the tree at this change
modified
src/cli/sync.rs
+18 −5
|
|
… |
253 unchanged lines |
| 254 |
254 |
|
}; |
| 255 |
255 |
|
sp.clear(); |
| 256 |
256 |
|
if as_json { |
|
257 |
+ |
// The state each accepted bookmark now holds on the remote (its local |
|
258 |
+ |
// state object), so a caller can look up what the push started, such |
|
259 |
+ |
// as the checks a forge runs on it. |
|
260 |
+ |
let view = repo.view()?; |
| 257 |
261 |
|
println!( |
| 258 |
262 |
|
"{}", |
| 259 |
|
- |
json::arr(results.iter().map(|r| json::obj([ |
| 260 |
|
- |
("name", json::s(&r.name)), |
| 261 |
|
- |
("ok", json::b(r.ok)), |
| 262 |
|
- |
("reason", json::s(&r.reason)) |
| 263 |
|
- |
]))) |
|
263 |
+ |
json::arr(results.iter().map(|r| { |
|
264 |
+ |
let state = view |
|
265 |
+ |
.bookmarks |
|
266 |
+ |
.get(&r.name) |
|
267 |
+ |
.filter(|_| r.ok) |
|
268 |
+ |
.map(|st| st.to_hex()) |
|
269 |
+ |
.unwrap_or_default(); |
|
270 |
+ |
json::obj([ |
|
271 |
+ |
("name", json::s(&r.name)), |
|
272 |
+ |
("ok", json::b(r.ok)), |
|
273 |
+ |
("reason", json::s(&r.reason)), |
|
274 |
+ |
("state", json::s(&state)), |
|
275 |
+ |
]) |
|
276 |
+ |
})) |
| 264 |
277 |
|
); |
| 265 |
278 |
|
return Ok(if results.iter().all(|r| r.ok) { 0 } else { 1 }); |
| 266 |
279 |
|
} |
|
|
… |
355 unchanged lines |
modified
tests/cli_json.rs
+5 −0
|
|
… |
185 unchanged lines |
| 186 |
186 |
|
assert_eq!(remotes[0]["name"], "origin"); |
| 187 |
187 |
|
let push = json(r, &home, &["push", "--json"]); |
| 188 |
188 |
|
assert_eq!(push[0]["ok"], true, "{push}"); |
|
189 |
+ |
let state = push[0]["state"].as_str().unwrap(); |
|
190 |
+ |
assert!( |
|
191 |
+ |
state.len() == 64 && state.chars().all(|c| c.is_ascii_hexdigit()), |
|
192 |
+ |
"the state the push moved the bookmark to: {push}" |
|
193 |
+ |
); |
| 189 |
194 |
|
let fetch = json(r, &home, &["fetch", "--json"]); |
| 190 |
195 |
|
assert_eq!(fetch["remote"], "origin"); |
| 191 |
196 |
|
let pull = json(r, &home, &["pull", "--json"]); |
|
|
… |
26 unchanged lines |