Show More
@@ -1466,8 +1466,8 b' def _changesetlabels(ctx):' | |||||
1466 | labels.append('changeset.obsolete') |
|
1466 | labels.append('changeset.obsolete') | |
1467 | if ctx.troubled(): |
|
1467 | if ctx.troubled(): | |
1468 | labels.append('changeset.troubled') |
|
1468 | labels.append('changeset.troubled') | |
1469 |
for |
|
1469 | for instability in ctx.instabilities(): | |
1470 |
labels.append('trouble.%s' % |
|
1470 | labels.append('trouble.%s' % instability) | |
1471 | return ' '.join(labels) |
|
1471 | return ' '.join(labels) | |
1472 |
|
1472 | |||
1473 | class changeset_printer(object): |
|
1473 | class changeset_printer(object): | |
@@ -1579,7 +1579,8 b' class changeset_printer(object):' | |||||
1579 |
|
1579 | |||
1580 | if ctx.troubled(): |
|
1580 | if ctx.troubled(): | |
1581 | # i18n: column positioning for "hg log" |
|
1581 | # i18n: column positioning for "hg log" | |
1582 | self.ui.write(_("instability: %s\n") % ', '.join(ctx.troubles()), |
|
1582 | instabilities = ctx.instabilities() | |
|
1583 | self.ui.write(_("instability: %s\n") % ', '.join(instabilities), | |||
1583 | label='log.trouble') |
|
1584 | label='log.trouble') | |
1584 |
|
1585 | |||
1585 | self._exthook(ctx) |
|
1586 | self._exthook(ctx) |
@@ -4850,9 +4850,10 b' def summary(ui, repo, **opts):' | |||||
4850 | if p.obsolete(): |
|
4850 | if p.obsolete(): | |
4851 | ui.write(_(' (obsolete)')) |
|
4851 | ui.write(_(' (obsolete)')) | |
4852 | if p.troubled(): |
|
4852 | if p.troubled(): | |
|
4853 | instabilities = (ui.label(instability, 'trouble.%s' % instability) | |||
|
4854 | for instability in p.instabilities()) | |||
4853 | ui.write(' (' |
|
4855 | ui.write(' (' | |
4854 |
+ ', '.join( |
|
4856 | + ', '.join(instabilities) | |
4855 | for trouble in p.troubles()) |
|
|||
4856 | + ')') |
|
4857 | + ')') | |
4857 | ui.write('\n') |
|
4858 | ui.write('\n') | |
4858 | if p.description(): |
|
4859 | if p.description(): |
@@ -226,21 +226,38 b' class basectx(object):' | |||||
226 | return self.unstable() or self.bumped() or self.divergent() |
|
226 | return self.unstable() or self.bumped() or self.divergent() | |
227 |
|
227 | |||
228 | def troubles(self): |
|
228 | def troubles(self): | |
229 | """return the list of troubles affecting this changesets. |
|
229 | """Keep the old version around in order to avoid breaking extensions | |
|
230 | about different return values. | |||
|
231 | """ | |||
|
232 | msg = ("'context.troubles' is deprecated, " | |||
|
233 | "use 'context.instabilities'") | |||
|
234 | self._repo.ui.deprecwarn(msg, '4.4') | |||
230 |
|
235 | |||
231 | Troubles are returned as strings. possible values are: |
|
236 | troubles = [] | |
|
237 | if self.unstable(): | |||
|
238 | troubles.append('orphan') | |||
|
239 | if self.bumped(): | |||
|
240 | troubles.append('bumped') | |||
|
241 | if self.divergent(): | |||
|
242 | troubles.append('divergent') | |||
|
243 | return troubles | |||
|
244 | ||||
|
245 | def instabilities(self): | |||
|
246 | """return the list of instabilities affecting this changeset. | |||
|
247 | ||||
|
248 | Instabilities are returned as strings. possible values are: | |||
232 | - orphan, |
|
249 | - orphan, | |
233 | - phase-divergent, |
|
250 | - phase-divergent, | |
234 | - content-divergent. |
|
251 | - content-divergent. | |
235 | """ |
|
252 | """ | |
236 |
|
|
253 | instabilities = [] | |
237 | if self.unstable(): |
|
254 | if self.unstable(): | |
238 |
|
|
255 | instabilities.append('orphan') | |
239 | if self.bumped(): |
|
256 | if self.bumped(): | |
240 |
|
|
257 | instabilities.append('phase-divergent') | |
241 | if self.divergent(): |
|
258 | if self.divergent(): | |
242 |
|
|
259 | instabilities.append('content-divergent') | |
243 |
return |
|
260 | return instabilities | |
244 |
|
261 | |||
245 | def parents(self): |
|
262 | def parents(self): | |
246 | """return contexts for each parent changeset""" |
|
263 | """return contexts for each parent changeset""" |
@@ -681,7 +681,9 b' def _pushcheckoutgoing(pushop):' | |||||
681 | if ctx.obsolete(): |
|
681 | if ctx.obsolete(): | |
682 | raise error.Abort(mso % ctx) |
|
682 | raise error.Abort(mso % ctx) | |
683 | elif ctx.troubled(): |
|
683 | elif ctx.troubled(): | |
684 | raise error.Abort(mst[ctx.troubles()[0]] % ctx) |
|
684 | # TODO print more than one instability in the abort | |
|
685 | # message | |||
|
686 | raise error.Abort(mst[ctx.instabilities()[0]] % ctx) | |||
685 |
|
687 | |||
686 | discovery.checkheads(pushop) |
|
688 | discovery.checkheads(pushop) | |
687 | return True |
|
689 | return True |
@@ -783,7 +783,7 b' def showinstabilities(**args):' | |||||
783 | (EXPERIMENTAL) |
|
783 | (EXPERIMENTAL) | |
784 | """ |
|
784 | """ | |
785 | args = pycompat.byteskwargs(args) |
|
785 | args = pycompat.byteskwargs(args) | |
786 |
return showlist('trouble', args['ctx']. |
|
786 | return showlist('trouble', args['ctx'].instabilities(), args) | |
787 |
|
787 | |||
788 | # tell hggettext to extract docstrings from these functions: |
|
788 | # tell hggettext to extract docstrings from these functions: | |
789 | i18nfunctions = keywords.values() |
|
789 | i18nfunctions = keywords.values() |
General Comments 0
You need to be logged in to leave comments.
Login now