Mercurial > public > mercurial-scm > hg-stable
diff mercurial/commands.py @ 25111:1ef96a3b8b89
summary: add a phase line (draft, secret) to the output
The number of draft and secret changesets are currently not summarized.
This is an important information because the number of drafts give some rough
idea of the number of outgoing changesets in typical workflows, without needing
to probe a remote repository. And a non-zero number of secrets means that
those changeset will not be pushed.
If the repository is "dirty" - some draft or secret changesets exists - then
summary will display a line like:
phases: X draft, Y secret (public)
The phase in parenthesis corresponds to the highest phase of the parents of
the working directory, i.e. the current phase.
By default, the line is not printed if the repository is "clean" - all
changesets are public - but if verbose is activated, it will display:
phases: (public)
On the other hand, nothing will be printed if quiet is in action.
A few tests have been added in test-phases.t to cover the -v and -q cases.
author | Gilles Moris <gilles.moris@free.fr> |
---|---|
date | Thu, 14 May 2015 17:38:38 +0200 |
parents | e30b66bb7d4d |
children | 49c583ca48c4 |
line wrap: on
line diff
--- a/mercurial/commands.py Fri May 15 12:19:51 2015 +0800 +++ b/mercurial/commands.py Thu May 14 17:38:38 2015 +0200 @@ -5869,7 +5869,7 @@ """summarize working directory state This generates a brief summary of the working directory state, - including parents, branch, commit status, and available updates. + including parents, branch, commit status, phase and available updates. With the --remote option, this will check the default paths for incoming and outgoing changes. This can be time-consuming. @@ -5997,6 +5997,25 @@ ui.write(_('update: %d new changesets, %d branch heads (merge)\n') % (new, len(bheads))) + t = [] + draft = len(repo.revs('draft()')) + if draft: + t.append(_('%d draft') % draft) + secret = len(repo.revs('secret()')) + if secret: + t.append(_('%d secret') % secret) + + if parents: + parentphase = max(p.phase() for p in parents) + else: + parentphase = phases.public + + if draft or secret: + ui.status(_('phases: %s (%s)\n') % (', '.join(t), + phases.phasenames[parentphase])) + else: + ui.note(_('phases: (%s)\n') % phases.phasenames[parentphase]) + cmdutil.summaryhooks(ui, repo) if opts.get('remote'):