Show More
@@ -24,6 +24,7 b' from .pycompat import (' | |||||
24 | open, |
|
24 | open, | |
25 | setattr, |
|
25 | setattr, | |
26 | ) |
|
26 | ) | |
|
27 | from .thirdparty import attr | |||
27 |
|
28 | |||
28 | from . import ( |
|
29 | from . import ( | |
29 | bookmarks, |
|
30 | bookmarks, | |
@@ -778,47 +779,66 b' def _commentlines(raw):' | |||||
778 | return b'\n'.join(commentedlines) + b'\n' |
|
779 | return b'\n'.join(commentedlines) + b'\n' | |
779 |
|
780 | |||
780 |
|
781 | |||
781 | def _conflictsmsg(repo): |
|
782 | @attr.s(frozen=True) | |
782 | mergestate = mergemod.mergestate.read(repo) |
|
783 | class morestatus(object): | |
783 | if not mergestate.active(): |
|
784 | reporoot = attr.ib() | |
784 | return |
|
785 | unfinishedop = attr.ib() | |
785 |
|
786 | unfinishedmsg = attr.ib() | ||
786 | unresolvedlist = sorted(mergestate.unresolved()) |
|
787 | inmergestate = attr.ib() | |
787 | if unresolvedlist: |
|
788 | unresolvedpaths = attr.ib() | |
788 | mergeliststr = b'\n'.join( |
|
789 | _label = b'status.morestatus' | |
789 | [ |
|
790 | ||
790 | b' %s' % util.pathto(repo.root, encoding.getcwd(), path) |
|
791 | def formatfooter(self, fm): | |
791 | for path in unresolvedlist |
|
792 | statemsg = _(b'The repository is in an unfinished *%s* state.' | |
792 | ] |
|
793 | ) % self.unfinishedop | |
793 | ) |
|
794 | fm.plain(b'%s\n' % _commentlines(statemsg), label=self._label) | |
794 | msg = ( |
|
795 | ||
795 | _( |
|
796 | self._formatconflicts(fm) | |
796 | '''Unresolved merge conflicts: |
|
797 | if self.unfinishedmsg: | |
|
798 | fm.plain(b'%s\n' % _commentlines(self.unfinishedmsg), | |||
|
799 | label=self._label) | |||
|
800 | ||||
|
801 | def _formatconflicts(self, fm): | |||
|
802 | if not self.inmergestate: | |||
|
803 | return | |||
|
804 | ||||
|
805 | if self.unresolvedpaths: | |||
|
806 | mergeliststr = b'\n'.join( | |||
|
807 | [ | |||
|
808 | b' %s' % util.pathto(self.reporoot, encoding.getcwd(), | |||
|
809 | path) | |||
|
810 | for path in self.unresolvedpaths | |||
|
811 | ] | |||
|
812 | ) | |||
|
813 | msg = ( | |||
|
814 | _( | |||
|
815 | '''Unresolved merge conflicts: | |||
797 |
|
816 | |||
798 | %s |
|
817 | %s | |
799 |
|
818 | |||
800 | To mark files as resolved: hg resolve --mark FILE''' |
|
819 | To mark files as resolved: hg resolve --mark FILE''' | |
|
820 | ) | |||
|
821 | % mergeliststr | |||
801 | ) |
|
822 | ) | |
802 | % mergeliststr |
|
823 | else: | |
803 | ) |
|
824 | msg = _(b'No unresolved merge conflicts.') | |
804 | else: |
|
825 | ||
805 | msg = _(b'No unresolved merge conflicts.') |
|
826 | fm.plain(b'%s\n' % _commentlines(msg), label=self._label) | |
806 |
|
827 | |||
807 | return _commentlines(msg) |
|
828 | ||
808 |
|
829 | def readmorestatus(repo): | ||
809 |
|
830 | """Returns a morestatus object if the repo has unfinished state.""" | ||
810 | def morestatus(repo, fm): |
|
|||
811 | statetuple = statemod.getrepostate(repo) |
|
831 | statetuple = statemod.getrepostate(repo) | |
812 | label = b'status.morestatus' |
|
832 | if not statetuple: | |
813 | if statetuple: |
|
833 | return None | |
814 | state, helpfulmsg = statetuple |
|
834 | ||
815 | statemsg = _(b'The repository is in an unfinished *%s* state.') % state |
|
835 | unfinishedop, unfinishedmsg = statetuple | |
816 | fm.plain(b'%s\n' % _commentlines(statemsg), label=label) |
|
836 | mergestate = mergemod.mergestate.read(repo) | |
817 | conmsg = _conflictsmsg(repo) |
|
837 | unresolved = None | |
818 | if conmsg: |
|
838 | if mergestate.active(): | |
819 | fm.plain(b'%s\n' % conmsg, label=label) |
|
839 | unresolved = sorted(mergestate.unresolved()) | |
820 | if helpfulmsg: |
|
840 | return morestatus(repo.root, unfinishedop, unfinishedmsg, | |
821 | fm.plain(b'%s\n' % _commentlines(helpfulmsg), label=label) |
|
841 | unresolved is not None, unresolved) | |
822 |
|
842 | |||
823 |
|
843 | |||
824 | def findpossible(cmd, table, strict=False): |
|
844 | def findpossible(cmd, table, strict=False): |
@@ -6867,6 +6867,12 b' def status(ui, repo, *pats, **opts):' | |||||
6867 | ) and not opts.get(b'no_status'): |
|
6867 | ) and not opts.get(b'no_status'): | |
6868 | copy = copies.pathcopies(ctx1, ctx2, m) |
|
6868 | copy = copies.pathcopies(ctx1, ctx2, m) | |
6869 |
|
6869 | |||
|
6870 | morestatus = None | |||
|
6871 | if ( | |||
|
6872 | ui.verbose or ui.configbool(b'commands', b'status.verbose') | |||
|
6873 | ) and not ui.plain(): | |||
|
6874 | morestatus = cmdutil.readmorestatus(repo) | |||
|
6875 | ||||
6870 | ui.pager(b'status') |
|
6876 | ui.pager(b'status') | |
6871 | fm = ui.formatter(b'status', opts) |
|
6877 | fm = ui.formatter(b'status', opts) | |
6872 | fmt = b'%s' + end |
|
6878 | fmt = b'%s' + end | |
@@ -6888,10 +6894,8 b' def status(ui, repo, *pats, **opts):' | |||||
6888 | label=b'status.copied', |
|
6894 | label=b'status.copied', | |
6889 | ) |
|
6895 | ) | |
6890 |
|
6896 | |||
6891 | if ( |
|
6897 | if morestatus: | |
6892 | ui.verbose or ui.configbool(b'commands', b'status.verbose') |
|
6898 | morestatus.formatfooter(fm) | |
6893 | ) and not ui.plain(): |
|
|||
6894 | cmdutil.morestatus(repo, fm) |
|
|||
6895 | fm.end() |
|
6899 | fm.end() | |
6896 |
|
6900 | |||
6897 |
|
6901 |
General Comments 0
You need to be logged in to leave comments.
Login now