# HG changeset patch # User Anton Shestakov # Date 1710443339 10800 # Node ID 0592ae24c47005b13a2721449e2780e472f88922 # Parent cd22d260d8ccdbe6f8c55b103c8d9656014a157b topic: get changeset node using the designated functions It's a bit wasteful to reach for an entire context if we just want to get the node from revnum, and also using manual slice instead of node.short(). diff -r cd22d260d8cc -r 0592ae24c470 hgext3rd/topic/flow.py --- a/hgext3rd/topic/flow.py Thu Mar 14 14:33:47 2024 -0300 +++ b/hgext3rd/topic/flow.py Thu Mar 14 16:08:59 2024 -0300 @@ -47,7 +47,8 @@ untopiced = repo.revs(b'not public() and (%n:) - hidden() - topic()', startnode) if untopiced: num = len(untopiced) - fnode = repo[untopiced.first()].hex()[:10] + cl = repo.changelog + fnode = node.short(cl.node(untopiced.first())) if num == 1: msg = _(b"%s") % fnode else: diff -r cd22d260d8cc -r 0592ae24c470 tests/test-topic-flow-reject-untopiced.t --- a/tests/test-topic-flow-reject-untopiced.t Thu Mar 14 14:33:47 2024 -0300 +++ b/tests/test-topic-flow-reject-untopiced.t Thu Mar 14 16:08:59 2024 -0300 @@ -75,7 +75,7 @@ adding file changes transaction abort! rollback completed - abort: rejecting draft changesets: 4e8b0e0237 + abort: rejecting draft changesets: 4e8b0e0237c6 [255] $ hg push ../server -f @@ -86,7 +86,7 @@ adding file changes transaction abort! rollback completed - abort: rejecting draft changesets: 4e8b0e0237 + abort: rejecting draft changesets: 4e8b0e0237c6 [255] Grow the stack with more changesets having topic @@ -121,7 +121,7 @@ adding file changes transaction abort! rollback completed - abort: rejecting draft changesets: 4e8b0e0237 + abort: rejecting draft changesets: 4e8b0e0237c6 [255] Testing case when both experimental.topic-mode.server and @@ -138,7 +138,7 @@ adding file changes transaction abort! rollback completed - abort: rejecting draft changesets: 4e8b0e0237 + abort: rejecting draft changesets: 4e8b0e0237c6 [255] Turning the changeset public and testing push