absorb: skip obsolete commits in the stack

Summary:
The case that I met was like the following DAG, and I'd like to skip those `Landed` commits when running `hg ab` since they already landed.

```
╷ o  zzz  Apr 21 at 18:18  zhaolong
╷ │  commit zzz
╷ │
╷ o  yyy  Apr 21 at 17:18  zhaolong
╷ │  commit yyy
╷ │
╷ x  ccc [Landed as ddd]  Apr 21 at 9:00  zhaolong
╷ ╷  commit bbb
╷ ╷
╷ x  aaa [Landed as bbb]  Apr 12 at 08:00  zhaolong
╭─╯  commit aaa
```

Reviewed By: sggutier

Differential Revision: D45184140

fbshipit-source-id: a539468843032d41ab4d61e5c461b9a1de53cb40
This commit is contained in:
Zhaolong Zhu 2023-04-21 14:52:40 -07:00 committed by Facebook GitHub Bot
parent 733ec587f4
commit 25e8cf5efc

View File

@ -119,7 +119,7 @@ def getdraftstack(headctx, limit=None):
"""
ctx = headctx
result = []
while ctx.phase() != phases.public:
while ctx.phase() != phases.public and not ctx.obsolete():
if limit and len(result) >= limit:
break
if len(ctx.parents()) > 1: