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.
--- 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'):
--- a/tests/test-backout.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-backout.t Thu May 14 17:38:38 2015 +0200
@@ -42,6 +42,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 3 draft (draft)
commit option
@@ -69,6 +70,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 4 draft (draft)
$ echo ypples > a
$ hg commit -d '5 0' -m ypples
@@ -83,6 +85,7 @@
branch: default
commit: 1 unresolved (clean)
update: (current)
+ phases: 5 draft (draft)
file that was removed is recreated
(this also tests that editor is not invoked if the commit message is
@@ -110,6 +113,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 3 draft (draft)
backout of backout is as if nothing happened
@@ -124,6 +128,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 4 draft (draft)
across branch
@@ -144,6 +149,7 @@
branch: default
commit: (clean)
update: 1 new changesets (update)
+ phases: 2 draft (draft)
should fail
@@ -160,6 +166,7 @@
branch: default
commit: (clean)
update: 1 new changesets, 2 branch heads (merge)
+ phases: 3 draft (draft)
should fail
@@ -172,6 +179,7 @@
branch: default
commit: (clean)
update: 1 new changesets, 2 branch heads (merge)
+ phases: 3 draft (draft)
backout with merge
@@ -189,6 +197,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 1 draft (draft)
remove line 1
@@ -213,6 +222,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 5 draft (draft)
check line 1 is back
@@ -241,6 +251,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 3 draft (draft)
without --merge
$ hg backout -d '3 0' 1 --tool=true
@@ -258,6 +269,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 3 draft (draft)
with --merge
$ hg backout --merge -d '3 0' 1 --tool=true
@@ -302,6 +314,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 5 draft (draft)
backout of merge should fail
@@ -332,6 +345,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 6 draft (draft)
$ hg rollback
repository tip rolled back to revision 4 (undo commit)
@@ -344,6 +358,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 5 draft (draft)
$ hg backout -d '6 0' --parent 3 4 --tool=true
removing c
@@ -354,6 +369,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 6 draft (draft)
$ cd ..
@@ -394,6 +410,7 @@
branch: branch2
commit: 1 removed
update: (current)
+ phases: 3 draft (draft)
with --merge
(this also tests that editor is invoked if '--edit' is specified
@@ -424,6 +441,7 @@
branch: branch2
commit: 1 removed (merge)
update: (current)
+ phases: 4 draft (draft)
$ hg update -q -C 2
on branch2 with branch1 not merged, so file1 should still exist:
@@ -440,6 +458,7 @@
branch: branch2
commit: (clean)
update: 1 new changesets, 2 branch heads (merge)
+ phases: 4 draft (draft)
on branch2 with branch1 merged, so file1 should be gone:
@@ -458,6 +477,7 @@
branch: branch2
commit: (clean)
update: (current)
+ phases: 5 draft (draft)
on branch1, so no file1 and file2:
@@ -474,6 +494,7 @@
branch: branch1
commit: (clean)
update: (current)
+ phases: 5 draft (draft)
$ cd ..
@@ -553,6 +574,7 @@
branch: default
commit: 1 unresolved (clean)
update: (current)
+ phases: 3 draft (draft)
$ hg resolve --all --debug
picked tool 'internal:merge' for foo (binary False symlink False)
merging foo
@@ -570,6 +592,7 @@
branch: default
commit: 1 modified, 1 unknown
update: (current)
+ phases: 3 draft (draft)
$ cat foo
one
two
--- a/tests/test-bisect.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-bisect.t Thu May 14 17:38:38 2015 +0200
@@ -190,6 +190,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 32 draft (draft)
$ hg bisect -g 1
Testing changeset 16:a2e6ea4973e9 (30 changesets remaining, ~4 tests)
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-bookmarks.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-bookmarks.t Thu May 14 17:38:38 2015 +0200
@@ -393,6 +393,7 @@
bookmarks: *Z Y x y
commit: (clean)
update: 1 new changesets, 2 branch heads (merge)
+ phases: 3 draft (draft)
test id
@@ -538,6 +539,7 @@
bookmarks: *Z Y x y
commit: 1 added, 1 unknown (new branch head)
update: 2 new changesets (update)
+ phases: 5 draft (draft)
$ hg update
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
updating bookmark Z
--- a/tests/test-commit-amend.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-commit-amend.t Thu May 14 17:38:38 2015 +0200
@@ -72,6 +72,7 @@
branch: default
commit: 1 added, 1 unknown
update: (current)
+ phases: 2 draft (draft)
$ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
transaction abort!
rollback completed
@@ -83,6 +84,7 @@
branch: default
commit: 1 added, 1 unknown
update: (current)
+ phases: 2 draft (draft)
Add new file:
$ hg ci --amend -m 'amend base1 new file'
--- a/tests/test-commit-interactive.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-commit-interactive.t Thu May 14 17:38:38 2015 +0200
@@ -81,6 +81,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 1 draft (draft)
Rename empty file
--- a/tests/test-copy.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-copy.t Thu May 14 17:38:38 2015 +0200
@@ -19,6 +19,7 @@
branch: default
commit: 1 copied
update: (current)
+ phases: 1 draft (draft)
$ hg --debug commit -m "2"
committing files:
b
--- a/tests/test-histedit-edit.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-histedit-edit.t Thu May 14 17:38:38 2015 +0200
@@ -246,6 +246,7 @@
branch: default
commit: 1 added (new branch head)
update: 1 new changesets (update)
+ phases: 7 draft (draft)
hist: 1 remaining (histedit --continue)
(test also that editor is invoked if histedit is continued for
--- a/tests/test-histedit-no-change.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-histedit-no-change.t Thu May 14 17:38:38 2015 +0200
@@ -183,6 +183,7 @@
branch: default
commit: 1 added, 1 unknown (new branch head)
update: 6 new changesets (update)
+ phases: 7 draft (draft)
hist: 2 remaining (histedit --continue)
$ hg histedit --abort 2>&1 | fixbundle
--- a/tests/test-import.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-import.t Thu May 14 17:38:38 2015 +0200
@@ -990,6 +990,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 2 draft (draft)
$ hg diff --git -c tip
diff --git a/lib/place-holder b/lib/place-holder
--- a/tests/test-largefiles-misc.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-largefiles-misc.t Thu May 14 17:38:38 2015 +0200
@@ -228,6 +228,7 @@
branch: default
commit: 1 subrepos
update: (current)
+ phases: 2 draft (draft)
$ hg st
$ hg st -S
A subrepo/large.txt
@@ -245,6 +246,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 3 draft (draft)
$ echo "rev 2" > subrepo/large.txt
$ hg st -S
M subrepo/large.txt
@@ -254,6 +256,7 @@
branch: default
commit: 1 subrepos
update: (current)
+ phases: 3 draft (draft)
$ hg ci -m "this commit should fail without -S"
abort: uncommitted changes in subrepository 'subrepo'
(use --subrepos for recursive commit)
@@ -567,6 +570,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 1 draft (draft)
largefiles: (no remote repo)
check messages when there is no files to upload:
@@ -581,6 +585,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 1 draft (draft)
largefiles: (no files to upload)
$ hg -R clone2 outgoing --large
comparing with $TESTTMP/issue3651/src (glob)
@@ -608,6 +613,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 2 draft (draft)
largefiles: 1 entities for 1 files to upload
$ hg -R clone2 outgoing --large
comparing with $TESTTMP/issue3651/src (glob)
@@ -643,6 +649,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 3 draft (draft)
largefiles: 1 entities for 3 files to upload
$ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
comparing with $TESTTMP/issue3651/src (glob)
@@ -692,6 +699,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 6 draft (draft)
largefiles: 3 entities for 3 files to upload
$ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
comparing with $TESTTMP/issue3651/src (glob)
@@ -750,6 +758,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 6 draft (draft)
largefiles: 2 entities for 1 files to upload
$ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
comparing with $TESTTMP/issue3651/src (glob)
--- a/tests/test-largefiles.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-largefiles.t Thu May 14 17:38:38 2015 +0200
@@ -67,6 +67,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 2 draft (draft)
largefiles: (no remote repo)
Commit preserved largefile contents.
@@ -999,6 +1000,7 @@
branch: default
commit: (clean)
update: 7 new changesets (update)
+ phases: 8 draft (draft)
$ rm "${USERCACHE}"/*
$ hg clone --all-largefiles -u 1 a a-clone1
@@ -1021,6 +1023,7 @@
branch: default
commit: (clean)
update: 6 new changesets (update)
+ phases: 8 draft (draft)
$ rm "${USERCACHE}"/*
$ hg clone --all-largefiles -U a a-clone-u
@@ -1030,6 +1033,7 @@
branch: default
commit: (clean)
update: 8 new changesets (update)
+ phases: 8 draft (public)
Show computed destination directory:
--- a/tests/test-merge1.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-merge1.t Thu May 14 17:38:38 2015 +0200
@@ -40,6 +40,7 @@
branch: default
commit: (interrupted update)
update: 1 new changesets (update)
+ phases: 2 draft (draft)
$ rmdir b
$ hg up
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -49,6 +50,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 2 draft (draft)
Prepare a basic merge
--- a/tests/test-obsolete.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-obsolete.t Thu May 14 17:38:38 2015 +0200
@@ -164,6 +164,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 3 draft (draft)
remote: 3 outgoing
$ hg summary --remote --hidden
@@ -172,6 +173,7 @@
branch: default
commit: (clean)
update: 3 new changesets, 4 branch heads (merge)
+ phases: 6 draft (draft)
remote: 3 outgoing
check that various commands work well with filtering
--- a/tests/test-phases.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-phases.t Thu May 14 17:38:38 2015 +0200
@@ -242,6 +242,25 @@
1 0 B
0 0 A
+Test summary
+
+ $ hg summary -R clone-dest --verbose
+ parent: -1:000000000000 (no revision checked out)
+ branch: default
+ commit: (clean)
+ update: 5 new changesets (update)
+ phases: (public)
+ $ hg summary -R initialrepo
+ parent: 7:17a481b3bccb tip
+ merge B' and E
+ branch: default
+ commit: (clean)
+ update: 1 new changesets, 2 branch heads (merge)
+ phases: 3 draft, 3 secret (secret)
+ $ hg summary -R initialrepo --quiet
+ parent: 7:17a481b3bccb tip
+ update: 1 new changesets, 2 branch heads (merge)
+
Test revset
$ cd initialrepo
--- a/tests/test-rebase-abort.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-rebase-abort.t Thu May 14 17:38:38 2015 +0200
@@ -321,3 +321,4 @@
branch: default
commit: (clean)
update: 1 new changesets, 2 branch heads (merge)
+ phases: 4 draft (draft)
--- a/tests/test-rebase-parameters.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-rebase-parameters.t Thu May 14 17:38:38 2015 +0200
@@ -476,6 +476,7 @@
branch: default
commit: 1 modified, 1 unresolved (merge)
update: (current)
+ phases: 3 draft (draft)
rebase: 0 rebased, 1 remaining (rebase --continue)
$ hg resolve -l
--- a/tests/test-rename.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-rename.t Thu May 14 17:38:38 2015 +0200
@@ -20,6 +20,7 @@
branch: default
commit: 1 renamed
update: (current)
+ phases: 1 draft (draft)
$ hg status -C
A d2/c
d1/d11/a1
--- a/tests/test-revert.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-revert.t Thu May 14 17:38:38 2015 +0200
@@ -360,6 +360,7 @@
branch: default
commit: 2 modified, 1 removed (merge)
update: (current)
+ phases: 3 draft (draft)
clarifies who added what
--- a/tests/test-shelve.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-shelve.t Thu May 14 17:38:38 2015 +0200
@@ -782,6 +782,7 @@
bookmarks: *test
commit: 2 unknown (clean)
update: (current)
+ phases: 5 draft (draft)
$ hg shelve --delete --stat
abort: options '--delete' and '--stat' may not be used together
--- a/tests/test-strip.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-strip.t Thu May 14 17:38:38 2015 +0200
@@ -526,6 +526,7 @@
branch: default
commit: 1 modified, 1 unknown, 1 unresolved
update: (current)
+ phases: 2 draft (draft)
mq: 3 unapplied
$ echo c > b
@@ -553,6 +554,7 @@
branch: default
commit: 1 modified, 1 unknown
update: (current)
+ phases: 1 draft (draft)
mq: 3 unapplied
Strip adds, removes, modifies with --keep
--- a/tests/test-subrepo-svn.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-subrepo-svn.t Thu May 14 17:38:38 2015 +0200
@@ -72,6 +72,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 2 draft (draft)
$ hg ci -moops
nothing changed
[1]
@@ -96,6 +97,7 @@
branch: default
commit: 1 modified, 1 subrepos
update: (current)
+ phases: 2 draft (draft)
$ hg commit --subrepos -m 'Message!' | grep -v Updating
committing subrepository s
Sending*s/alpha (glob)
@@ -136,6 +138,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 3 draft (draft)
$ echo a > s/a
--- a/tests/test-subrepo.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-subrepo.t Thu May 14 17:38:38 2015 +0200
@@ -38,6 +38,7 @@
branch: default
commit: 1 added, 1 subrepos
update: (current)
+ phases: 1 draft (draft)
$ hg ci -m1
test handling .hgsubstate "added" explicitly.
@@ -83,6 +84,7 @@
branch: default
commit: 1 subrepos
update: (current)
+ phases: 2 draft (draft)
$ hg co -C 1
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg sum
@@ -91,6 +93,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 2 draft (draft)
commands that require a clean repo should respect subrepos
@@ -113,6 +116,7 @@
branch: default
commit: 1 subrepos
update: (current)
+ phases: 2 draft (draft)
$ hg ci -m2
committing subrepository s
committing subrepository s/ss (glob)
@@ -122,6 +126,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 3 draft (draft)
test handling .hgsubstate "modified" explicitly.
--- a/tests/test-url-rev.t Fri May 15 12:19:51 2015 +0800
+++ b/tests/test-url-rev.t Thu May 14 17:38:38 2015 +0200
@@ -101,6 +101,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 4 draft (draft)
remote: 2 outgoing
$ hg -q outgoing '../clone#foo'
2:faba9097cad4
@@ -110,6 +111,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 4 draft (draft)
remote: 1 outgoing
$ hg -q --cwd ../clone incoming '../repo#foo'
@@ -282,6 +284,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 1 draft (draft)
remote: 1 outgoing
$ hg summary --remote --config paths.default='../clone#foo' --config paths.default-push='../clone'
@@ -290,6 +293,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 1 draft (draft)
remote: 2 outgoing
$ hg summary --remote --config paths.default='../clone' --config paths.default-push='../clone#foo'
@@ -298,6 +302,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 1 draft (draft)
remote: 1 outgoing
$ hg clone -q -r 0 . ../another
@@ -311,6 +316,7 @@
branch: default
commit: (clean)
update: (current)
+ phases: 1 draft (draft)
remote: 1 outgoing
$ cd ..