Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 43945:07ebb567e8bb
status: make unresolved files always be in the morestatus structured output
We don't know the status of those files, only that they're unresolved, so
we don't output the status for those - any code parsing this will have to be
tolerant to that.
Differential Revision: https://phab.mercurial-scm.org/D7668
author | Rodrigo Damazio Bovendorp <rdamazio@google.com> |
---|---|
date | Wed, 18 Dec 2019 23:45:11 -0800 |
parents | 489fdf27769c |
children | dfac25883dbf |
comparison
equal
deleted
inserted
replaced
43944:489fdf27769c | 43945:07ebb567e8bb |
---|---|
809 reporoot = attr.ib() | 809 reporoot = attr.ib() |
810 unfinishedop = attr.ib() | 810 unfinishedop = attr.ib() |
811 unfinishedmsg = attr.ib() | 811 unfinishedmsg = attr.ib() |
812 activemerge = attr.ib() | 812 activemerge = attr.ib() |
813 unresolvedpaths = attr.ib() | 813 unresolvedpaths = attr.ib() |
814 _formattedpaths = attr.ib(init=False, default=set()) | |
814 _label = b'status.morestatus' | 815 _label = b'status.morestatus' |
815 | 816 |
816 def formatfile(self, path, fm): | 817 def formatfile(self, path, fm): |
818 self._formattedpaths.add(path) | |
817 if self.activemerge and path in self.unresolvedpaths: | 819 if self.activemerge and path in self.unresolvedpaths: |
818 fm.data(unresolved=True) | 820 fm.data(unresolved=True) |
819 | 821 |
820 def formatfooter(self, fm): | 822 def formatfooter(self, fm): |
821 if self.unfinishedop or self.unfinishedmsg: | 823 if self.unfinishedop or self.unfinishedmsg: |
830 ) | 832 ) |
831 fm.plain(b'%s\n' % _commentlines(statemsg), label=self._label) | 833 fm.plain(b'%s\n' % _commentlines(statemsg), label=self._label) |
832 if self.unfinishedmsg: | 834 if self.unfinishedmsg: |
833 fm.data(unfinishedmsg=self.unfinishedmsg) | 835 fm.data(unfinishedmsg=self.unfinishedmsg) |
834 | 836 |
837 # May also start new data items. | |
835 self._formatconflicts(fm) | 838 self._formatconflicts(fm) |
836 | 839 |
837 if self.unfinishedmsg: | 840 if self.unfinishedmsg: |
838 fm.plain( | 841 fm.plain( |
839 b'%s\n' % _commentlines(self.unfinishedmsg), label=self._label | 842 b'%s\n' % _commentlines(self.unfinishedmsg), label=self._label |
859 | 862 |
860 To mark files as resolved: hg resolve --mark FILE''' | 863 To mark files as resolved: hg resolve --mark FILE''' |
861 ) | 864 ) |
862 % mergeliststr | 865 % mergeliststr |
863 ) | 866 ) |
867 | |
868 # If any paths with unresolved conflicts were not previously | |
869 # formatted, output them now. | |
870 for f in self.unresolvedpaths: | |
871 if f in self._formattedpaths: | |
872 # Already output. | |
873 continue | |
874 fm.startitem() | |
875 # We can't claim to know the status of the file - it may just | |
876 # have been in one of the states that were not requested for | |
877 # display, so it could be anything. | |
878 fm.data(itemtype=b'file', path=f, unresolved=True) | |
879 | |
864 else: | 880 else: |
865 msg = _(b'No unresolved merge conflicts.') | 881 msg = _(b'No unresolved merge conflicts.') |
866 | 882 |
867 fm.plain(b'%s\n' % _commentlines(msg), label=self._label) | 883 fm.plain(b'%s\n' % _commentlines(msg), label=self._label) |
868 | 884 |