From e721f137bc9642cfa949f0e09c778bad89ee0e3f Mon Sep 17 00:00:00 2001 From: Aditya Pillai Date: Tue, 19 Oct 2021 10:01:50 -0700 Subject: [PATCH] Show commit being rebased during unfinished rebase Summary: Adds ``` # Currently rebasing {hash}: {message} ``` during an unfinished rebase state. Differential Revision: D31743065 fbshipit-source-id: fe3f3365052eec7ed9360aaaed5e9bca7b4e39a3 --- eden/scm/edenscm/hgext/morestatus.py | 13 +++++++++++++ eden/scm/tests/test-fb-hgext-morestatus.t | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/eden/scm/edenscm/hgext/morestatus.py b/eden/scm/edenscm/hgext/morestatus.py index 0dd2276afebfb..3c3046d580748 100644 --- a/eden/scm/edenscm/hgext/morestatus.py +++ b/eden/scm/edenscm/hgext/morestatus.py @@ -12,6 +12,7 @@ import math import os +from edenscm.hgext.rebase import rebaseruntime from edenscm.mercurial import ( commands, hbisect, @@ -83,6 +84,18 @@ def helpmessage(ui, continuecmd, abortcmd): def rebasemsg(repo, ui): helpmessage(ui, "hg rebase --continue", "hg rebase --abort") + rbsrt = rebaseruntime(repo, ui, None, {}) + rbsrt.restorestatus() + for (src, dest) in rbsrt.destmap.items(): + if dest == rbsrt.originalwd: + ui.warn( + prefixlines( + f"\nCurrently rebasing {repo[src]}: {repo[src].shortdescription()}" + ) + ) + break + + def histeditmsg(repo, ui): helpmessage(ui, "hg histedit --continue", "hg histedit --abort") diff --git a/eden/scm/tests/test-fb-hgext-morestatus.t b/eden/scm/tests/test-fb-hgext-morestatus.t index b53327dfdbb45..f789c4150b097 100644 --- a/eden/scm/tests/test-fb-hgext-morestatus.t +++ b/eden/scm/tests/test-fb-hgext-morestatus.t @@ -143,6 +143,8 @@ Test rebase state # To mark files as resolved: hg resolve --mark FILE # To continue: hg rebase --continue # To abort: hg rebase --abort + # + # Currently rebasing 2977a57ce863: remove content Test status in rebase state with resolved files $ hg resolve --mark a @@ -156,6 +158,8 @@ Test status in rebase state with resolved files # No unresolved merge conflicts. # To continue: hg rebase --continue # To abort: hg rebase --abort + # + # Currently rebasing 2977a57ce863: remove content Test hg status is normal after rebase abort $ hg rebase --abort -q @@ -173,6 +177,8 @@ Test rebase with an interrupted update: # The repository is in an unfinished *rebase* state. # To continue: hg rebase --continue # To abort: hg rebase --abort + # + # Currently rebasing 2977a57ce863: remove content $ hg rebase --abort -q rebase aborted