Show More
@@ -619,63 +619,8 b' To mark files as resolved: hg resolve -' | |||||
619 |
|
619 | |||
620 | return _commentlines(msg) |
|
620 | return _commentlines(msg) | |
621 |
|
621 | |||
622 | def _helpmessage(continuecmd, abortcmd): |
|
|||
623 | msg = _('To continue: %s\n' |
|
|||
624 | 'To abort: %s') % (continuecmd, abortcmd) |
|
|||
625 | return _commentlines(msg) |
|
|||
626 |
|
||||
627 | def _rebasemsg(): |
|
|||
628 | return _helpmessage('hg rebase --continue', 'hg rebase --abort') |
|
|||
629 |
|
||||
630 | def _histeditmsg(): |
|
|||
631 | return _helpmessage('hg histedit --continue', 'hg histedit --abort') |
|
|||
632 |
|
||||
633 | def _unshelvemsg(): |
|
|||
634 | return _helpmessage('hg unshelve --continue', 'hg unshelve --abort') |
|
|||
635 |
|
||||
636 | def _graftmsg(): |
|
|||
637 | return _helpmessage('hg graft --continue', 'hg graft --abort') |
|
|||
638 |
|
||||
639 | def _mergemsg(): |
|
|||
640 | return _helpmessage('hg commit', 'hg merge --abort') |
|
|||
641 |
|
||||
642 | def _bisectmsg(): |
|
|||
643 | msg = _('To mark the changeset good: hg bisect --good\n' |
|
|||
644 | 'To mark the changeset bad: hg bisect --bad\n' |
|
|||
645 | 'To abort: hg bisect --reset\n') |
|
|||
646 | return _commentlines(msg) |
|
|||
647 |
|
||||
648 | def fileexistspredicate(filename): |
|
|||
649 | return lambda repo: repo.vfs.exists(filename) |
|
|||
650 |
|
||||
651 | def _mergepredicate(repo): |
|
|||
652 | return len(repo[None].parents()) > 1 |
|
|||
653 |
|
||||
654 | STATES = ( |
|
|||
655 | # (state, predicate to detect states, helpful message function) |
|
|||
656 | ('histedit', fileexistspredicate('histedit-state'), _histeditmsg), |
|
|||
657 | ('bisect', fileexistspredicate('bisect.state'), _bisectmsg), |
|
|||
658 | ('graft', fileexistspredicate('graftstate'), _graftmsg), |
|
|||
659 | ('unshelve', fileexistspredicate('shelvedstate'), _unshelvemsg), |
|
|||
660 | ('rebase', fileexistspredicate('rebasestate'), _rebasemsg), |
|
|||
661 | # The merge state is part of a list that will be iterated over. |
|
|||
662 | # They need to be last because some of the other unfinished states may also |
|
|||
663 | # be in a merge or update state (eg. rebase, histedit, graft, etc). |
|
|||
664 | # We want those to have priority. |
|
|||
665 | ('merge', _mergepredicate, _mergemsg), |
|
|||
666 | ) |
|
|||
667 |
|
||||
668 | def _getrepostate(repo): |
|
|||
669 | # experimental config: commands.status.skipstates |
|
|||
670 | skip = set(repo.ui.configlist('commands', 'status.skipstates')) |
|
|||
671 | for state, statedetectionpredicate, msgfn in STATES: |
|
|||
672 | if state in skip: |
|
|||
673 | continue |
|
|||
674 | if statedetectionpredicate(repo): |
|
|||
675 | return (state, statedetectionpredicate, msgfn) |
|
|||
676 |
|
||||
677 | def morestatus(repo, fm): |
|
622 | def morestatus(repo, fm): | |
678 |
statetuple = |
|
623 | statetuple = statemod.getrepostate(repo) | |
679 | label = 'status.morestatus' |
|
624 | label = 'status.morestatus' | |
680 | if statetuple: |
|
625 | if statetuple: | |
681 | state, statedetectionpredicate, helpfulmsg = statetuple |
|
626 | state, statedetectionpredicate, helpfulmsg = statetuple |
@@ -155,3 +155,64 b' addunfinished(' | |||||
155 | cmdmsg=_('last update was interrupted'), |
|
155 | cmdmsg=_('last update was interrupted'), | |
156 | cmdhint=_("use 'hg update' to get a consistent checkout") |
|
156 | cmdhint=_("use 'hg update' to get a consistent checkout") | |
157 | ) |
|
157 | ) | |
|
158 | ||||
|
159 | def _commentlines(raw): | |||
|
160 | '''Surround lineswith a comment char and a new line''' | |||
|
161 | lines = raw.splitlines() | |||
|
162 | commentedlines = ['# %s' % line for line in lines] | |||
|
163 | return '\n'.join(commentedlines) + '\n' | |||
|
164 | ||||
|
165 | def _helpmessage(continuecmd, abortcmd): | |||
|
166 | msg = _('To continue: %s\n' | |||
|
167 | 'To abort: %s') % (continuecmd, abortcmd) | |||
|
168 | return _commentlines(msg) | |||
|
169 | ||||
|
170 | def _rebasemsg(): | |||
|
171 | return _helpmessage('hg rebase --continue', 'hg rebase --abort') | |||
|
172 | ||||
|
173 | def _histeditmsg(): | |||
|
174 | return _helpmessage('hg histedit --continue', 'hg histedit --abort') | |||
|
175 | ||||
|
176 | def _unshelvemsg(): | |||
|
177 | return _helpmessage('hg unshelve --continue', 'hg unshelve --abort') | |||
|
178 | ||||
|
179 | def _graftmsg(): | |||
|
180 | return _helpmessage('hg graft --continue', 'hg graft --abort') | |||
|
181 | ||||
|
182 | def _mergemsg(): | |||
|
183 | return _helpmessage('hg commit', 'hg merge --abort') | |||
|
184 | ||||
|
185 | def _bisectmsg(): | |||
|
186 | msg = _('To mark the changeset good: hg bisect --good\n' | |||
|
187 | 'To mark the changeset bad: hg bisect --bad\n' | |||
|
188 | 'To abort: hg bisect --reset\n') | |||
|
189 | return _commentlines(msg) | |||
|
190 | ||||
|
191 | def fileexistspredicate(filename): | |||
|
192 | return lambda repo: repo.vfs.exists(filename) | |||
|
193 | ||||
|
194 | def _mergepredicate(repo): | |||
|
195 | return len(repo[None].parents()) > 1 | |||
|
196 | ||||
|
197 | STATES = ( | |||
|
198 | # (state, predicate to detect states, helpful message function) | |||
|
199 | ('histedit', fileexistspredicate('histedit-state'), _histeditmsg), | |||
|
200 | ('bisect', fileexistspredicate('bisect.state'), _bisectmsg), | |||
|
201 | ('graft', fileexistspredicate('graftstate'), _graftmsg), | |||
|
202 | ('unshelve', fileexistspredicate('shelvedstate'), _unshelvemsg), | |||
|
203 | ('rebase', fileexistspredicate('rebasestate'), _rebasemsg), | |||
|
204 | # The merge state is part of a list that will be iterated over. | |||
|
205 | # They need to be last because some of the other unfinished states may also | |||
|
206 | # be in a merge or update state (eg. rebase, histedit, graft, etc). | |||
|
207 | # We want those to have priority. | |||
|
208 | ('merge', _mergepredicate, _mergemsg), | |||
|
209 | ) | |||
|
210 | ||||
|
211 | def getrepostate(repo): | |||
|
212 | # experimental config: commands.status.skipstates | |||
|
213 | skip = set(repo.ui.configlist('commands', 'status.skipstates')) | |||
|
214 | for state, statedetectionpredicate, msgfn in STATES: | |||
|
215 | if state in skip: | |||
|
216 | continue | |||
|
217 | if statedetectionpredicate(repo): | |||
|
218 | return (state, statedetectionpredicate, msgfn) |
General Comments 0
You need to be logged in to leave comments.
Login now