[morestatus] messages in status for histedit, graft, unshelve, merge states

Summary:
Continuation of D2502125. Let's help people when they're in a wierd states by
displaying a helpful message below the output of `hg status`

Example output:
  10/07 16:53 cdelahousse@dev4253 ~/local/clearmereg/testrepos/states/merge
  $ hg status
  M a

  # The repository is in an unfinished *merge* state.
  # Unresolved merge conflicts:
  #
  #     a
  #
  # To mark files as resolved:  hg resolve --mark FILE
  # To continue:                hg commit
  # To abort:                   hg update --clean .

For more example output, see the tests

Test Plan: See tests: `tests/test-morestatus.t`

Reviewers: #sourcecontrol, durham

Reviewed By: durham

Subscribers: akushner

Differential Revision: https://phabricator.fb.com/D2520272

Tasks: 8563305

Signature: t1:2520272:1444287977:b90b747538754ef4f4f0f8fab3e56f3aa288d3e5
This commit is contained in:
Christian Delahousse 2015-10-07 17:03:17 -07:00
parent 89beed4ce9
commit b5ee3f4aed
2 changed files with 50 additions and 5 deletions

View File

@ -49,19 +49,34 @@ def helpmessage(ui, continuecmd, abortcmd):
ui.warn(prefixlines(msg))
def rebasemsg(ui):
return helpmessage(ui, 'hg rebase --continue', 'hg rebase --abort')
helpmessage(ui, 'hg rebase --continue', 'hg rebase --abort')
def histeditmsg(ui):
helpmessage(ui, 'hg histedit --continue', 'hg histedit --abort')
def unshelvemsg(ui):
helpmessage(ui, 'hg unshelve --continue', 'hg unshelve --abort')
def graftmsg(ui):
# tweakdefaults requires `update` to have a rev hence the `.`
helpmessage(ui, 'hg graft --continue', 'hg update .')
def mergemsg(ui):
# tweakdefaults requires `update` to have a rev hence the `.`
helpmessage(ui, 'hg commit', 'hg update --clean . (warning: this will '
'erase all uncommitted changed)')
STATES = (
# (state, file path indicating states, helpful message function)
('histedit', 'histedit-state', None),
('histedit', 'histedit-state', histeditmsg),
('bisect', 'bisect.state', None),
('graft', 'graftstate', None),
('unshelve', 'unshelverebasestate', None),
('graft', 'graftstate', graftmsg),
('unshelve', 'unshelverebasestate', unshelvemsg),
('rebase', 'rebasestate', rebasemsg),
# The merge state is part of a list that will be iterated over. It needs to
# be last because some of the other unfinished states may also be in a merge
# state (eg. histedit, graft, etc). We want those to have priority.
('merge', 'merge', None),
('merge', 'merge', mergemsg),
)
def extsetup(ui):

View File

@ -24,6 +24,8 @@ Test status on histedit stop
$ hg status
# The repository is in an unfinished *histedit* state.
# To continue: hg histedit --continue
# To abort: hg histedit --abort
Test disabling output. Nothing should be shown
$ hg status --config morestatus.show=False
@ -67,6 +69,8 @@ Test graft state
# a
#
# To mark files as resolved: hg resolve --mark FILE
# To continue: hg graft --continue
# To abort: hg update .
Test hg status is normal after graft abort
$ hg up --clean -q
@ -98,6 +102,8 @@ Test unshelve state
# a
#
# To mark files as resolved: hg resolve --mark FILE
# To continue: hg unshelve --continue
# To abort: hg unshelve --abort
Test hg status is normal after unshelve abort
$ hg unshelve --abort
@ -148,3 +154,27 @@ Test hg status is normal after rebase abort
$ hg status
? a.orig
$ rm a.orig
Test merge state
$ hg merge -q
warning: conflicts during merge.
merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
[1]
$ hg status
M a
? a.orig
# The repository is in an unfinished *merge* state.
# Unresolved merge conflicts:
#
# a
#
# To mark files as resolved: hg resolve --mark FILE
# To continue: hg commit
# To abort: hg update --clean . (warning: this will erase all uncommitted changed)
Test hg status is normal after merge abort
$ hg update --clean -q
$ hg status
? a.orig
$ rm a.orig