diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -5869,7 +5869,7 @@ def summary(ui, repo, **opts): """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 @@ def summary(ui, repo, **opts): 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'): diff --git a/tests/test-backout.t b/tests/test-backout.t --- a/tests/test-backout.t +++ b/tests/test-backout.t @@ -42,6 +42,7 @@ specified explicitly) branch: default commit: (clean) update: (current) + phases: 3 draft (draft) commit option @@ -69,6 +70,7 @@ commit option branch: default commit: (clean) update: (current) + phases: 4 draft (draft) $ echo ypples > a $ hg commit -d '5 0' -m ypples @@ -83,6 +85,7 @@ commit option 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 @@ specified explicitly) branch: default commit: (clean) update: (current) + phases: 3 draft (draft) backout of backout is as if nothing happened @@ -124,6 +128,7 @@ backout of backout is as if nothing happ branch: default commit: (clean) update: (current) + phases: 4 draft (draft) across branch @@ -144,6 +149,7 @@ across branch branch: default commit: (clean) update: 1 new changesets (update) + phases: 2 draft (draft) should fail @@ -160,6 +166,7 @@ should fail branch: default commit: (clean) update: 1 new changesets, 2 branch heads (merge) + phases: 3 draft (draft) should fail @@ -172,6 +179,7 @@ should fail branch: default commit: (clean) update: 1 new changesets, 2 branch heads (merge) + phases: 3 draft (draft) backout with merge @@ -189,6 +197,7 @@ backout with merge branch: default commit: (clean) update: (current) + phases: 1 draft (draft) remove line 1 @@ -213,6 +222,7 @@ remove line 1 branch: default commit: (clean) update: (current) + phases: 5 draft (draft) check line 1 is back @@ -241,6 +251,7 @@ backout should not back out subsequent c branch: default commit: (clean) update: (current) + phases: 3 draft (draft) without --merge $ hg backout -d '3 0' 1 --tool=true @@ -258,6 +269,7 @@ without --merge 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 @@ with --merge branch: default commit: (clean) update: (current) + phases: 5 draft (draft) backout of merge should fail @@ -332,6 +345,7 @@ backout with valid parent should be ok 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 @@ backout with valid parent should be ok 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 @@ backout with valid parent should be ok branch: default commit: (clean) update: (current) + phases: 6 draft (draft) $ cd .. @@ -394,6 +410,7 @@ without --merge 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 @@ explicitly regardless of '--message') 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 @@ on branch2 with branch1 not merged, so f 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 @@ on branch2 with branch1 merged, so file1 branch: branch2 commit: (clean) update: (current) + phases: 5 draft (draft) on branch1, so no file1 and file2: @@ -474,6 +494,7 @@ on branch1, so no file1 and file2: branch: branch1 commit: (clean) update: (current) + phases: 5 draft (draft) $ cd .. @@ -553,6 +574,7 @@ Test usage of `hg resolve` in case of co 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 @@ Test usage of `hg resolve` in case of co branch: default commit: 1 modified, 1 unknown update: (current) + phases: 3 draft (draft) $ cat foo one two diff --git a/tests/test-bisect.t b/tests/test-bisect.t --- a/tests/test-bisect.t +++ b/tests/test-bisect.t @@ -190,6 +190,7 @@ bisect test 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 diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t --- a/tests/test-bookmarks.t +++ b/tests/test-bookmarks.t @@ -393,6 +393,7 @@ test summary 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 @@ update to current bookmark if it's not t 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 diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t --- a/tests/test-commit-amend.t +++ b/tests/test-commit-amend.t @@ -72,6 +72,7 @@ Check proper abort for empty message 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 @@ Check proper abort for empty message branch: default commit: 1 added, 1 unknown update: (current) + phases: 2 draft (draft) Add new file: $ hg ci --amend -m 'amend base1 new file' diff --git a/tests/test-commit-interactive.t b/tests/test-commit-interactive.t --- a/tests/test-commit-interactive.t +++ b/tests/test-commit-interactive.t @@ -81,6 +81,7 @@ Summary shows we updated to the new cset branch: default commit: (clean) update: (current) + phases: 1 draft (draft) Rename empty file diff --git a/tests/test-copy.t b/tests/test-copy.t --- a/tests/test-copy.t +++ b/tests/test-copy.t @@ -19,6 +19,7 @@ branch: default commit: 1 copied update: (current) + phases: 1 draft (draft) $ hg --debug commit -m "2" committing files: b diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t --- a/tests/test-histedit-edit.t +++ b/tests/test-histedit-edit.t @@ -246,6 +246,7 @@ check histedit_source 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 diff --git a/tests/test-histedit-no-change.t b/tests/test-histedit-no-change.t --- a/tests/test-histedit-no-change.t +++ b/tests/test-histedit-no-change.t @@ -183,6 +183,7 @@ abort editing session, after first forci 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 diff --git a/tests/test-import.t b/tests/test-import.t --- a/tests/test-import.t +++ b/tests/test-import.t @@ -990,6 +990,7 @@ Issue2102: hg export and hg import speak 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 diff --git a/tests/test-largefiles-misc.t b/tests/test-largefiles-misc.t --- a/tests/test-largefiles-misc.t +++ b/tests/test-largefiles-misc.t @@ -228,6 +228,7 @@ verify that large files in subrepos hand branch: default commit: 1 subrepos update: (current) + phases: 2 draft (draft) $ hg st $ hg st -S A subrepo/large.txt @@ -245,6 +246,7 @@ verify that large files in subrepos hand 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 @@ verify that large files in subrepos hand 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 @@ because it can't be reproduced easily. 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 @@ check messages when there is no files to 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 @@ check messages when there are files to u 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 @@ check messages when there are files to u 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 @@ check messages when there are files to u 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 @@ and #5 refer it. 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) diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t --- a/tests/test-largefiles.t +++ b/tests/test-largefiles.t @@ -67,6 +67,7 @@ Test status and dirstate of largefiles a branch: default commit: (clean) update: (current) + phases: 2 draft (draft) largefiles: (no remote repo) Commit preserved largefile contents. @@ -999,6 +1000,7 @@ Test cloning with --all-largefiles flag 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 @@ Test cloning with --all-largefiles flag 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 @@ Test cloning with --all-largefiles flag branch: default commit: (clean) update: 8 new changesets (update) + phases: 8 draft (public) Show computed destination directory: diff --git a/tests/test-merge1.t b/tests/test-merge1.t --- a/tests/test-merge1.t +++ b/tests/test-merge1.t @@ -40,6 +40,7 @@ Test interrupted updates by exploiting o 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 @@ Test interrupted updates by exploiting o branch: default commit: (clean) update: (current) + phases: 2 draft (draft) Prepare a basic merge diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -164,6 +164,7 @@ check that summary does not report them branch: default commit: (clean) update: (current) + phases: 3 draft (draft) remote: 3 outgoing $ hg summary --remote --hidden @@ -172,6 +173,7 @@ check that summary does not report them 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 diff --git a/tests/test-phases.t b/tests/test-phases.t --- a/tests/test-phases.t +++ b/tests/test-phases.t @@ -242,6 +242,25 @@ Test secret changeset are not cloned 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 diff --git a/tests/test-rebase-abort.t b/tests/test-rebase-abort.t --- a/tests/test-rebase-abort.t +++ b/tests/test-rebase-abort.t @@ -321,3 +321,4 @@ during a rebase (issue4661) branch: default commit: (clean) update: 1 new changesets, 2 branch heads (merge) + phases: 4 draft (draft) diff --git a/tests/test-rebase-parameters.t b/tests/test-rebase-parameters.t --- a/tests/test-rebase-parameters.t +++ b/tests/test-rebase-parameters.t @@ -476,6 +476,7 @@ Test --tool parameter: branch: default commit: 1 modified, 1 unresolved (merge) update: (current) + phases: 3 draft (draft) rebase: 0 rebased, 1 remaining (rebase --continue) $ hg resolve -l diff --git a/tests/test-rename.t b/tests/test-rename.t --- a/tests/test-rename.t +++ b/tests/test-rename.t @@ -20,6 +20,7 @@ rename a single file branch: default commit: 1 renamed update: (current) + phases: 1 draft (draft) $ hg status -C A d2/c d1/d11/a1 diff --git a/tests/test-revert.t b/tests/test-revert.t --- a/tests/test-revert.t +++ b/tests/test-revert.t @@ -360,6 +360,7 @@ merge it with the other head branch: default commit: 2 modified, 1 removed (merge) update: (current) + phases: 3 draft (draft) clarifies who added what diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -782,6 +782,7 @@ is a no-op), works (issue4398) 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 diff --git a/tests/test-strip.t b/tests/test-strip.t --- a/tests/test-strip.t +++ b/tests/test-strip.t @@ -526,6 +526,7 @@ Verify strip protects against stripping 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 @@ Verify strip protects against stripping branch: default commit: 1 modified, 1 unknown update: (current) + phases: 1 draft (draft) mq: 3 unapplied Strip adds, removes, modifies with --keep diff --git a/tests/test-subrepo-svn.t b/tests/test-subrepo-svn.t --- a/tests/test-subrepo-svn.t +++ b/tests/test-subrepo-svn.t @@ -72,6 +72,7 @@ make sure we avoid empty commits (issue2 branch: default commit: (clean) update: (current) + phases: 2 draft (draft) $ hg ci -moops nothing changed [1] @@ -96,6 +97,7 @@ change file in svn and hg, commit 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 @@ bringing any changes. branch: default commit: (clean) update: (current) + phases: 3 draft (draft) $ echo a > s/a diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t --- a/tests/test-subrepo.t +++ b/tests/test-subrepo.t @@ -38,6 +38,7 @@ Issue2232: committing a subrepo without 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 @@ Issue2022: update -C 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 @@ Issue2022: update -C branch: default commit: (clean) update: (current) + phases: 2 draft (draft) commands that require a clean repo should respect subrepos @@ -113,6 +116,7 @@ add sub sub 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 @@ add sub sub branch: default commit: (clean) update: (current) + phases: 3 draft (draft) test handling .hgsubstate "modified" explicitly. diff --git a/tests/test-url-rev.t b/tests/test-url-rev.t --- a/tests/test-url-rev.t +++ b/tests/test-url-rev.t @@ -101,6 +101,7 @@ Changing original repo: branch: default commit: (clean) update: (current) + phases: 4 draft (draft) remote: 2 outgoing $ hg -q outgoing '../clone#foo' 2:faba9097cad4 @@ -110,6 +111,7 @@ Changing original repo: branch: default commit: (clean) update: (current) + phases: 4 draft (draft) remote: 1 outgoing $ hg -q --cwd ../clone incoming '../repo#foo' @@ -282,6 +284,7 @@ Test handling common incoming revisions 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 @@ Test handling common incoming revisions 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 @@ Test handling common incoming revisions branch: default commit: (clean) update: (current) + phases: 1 draft (draft) remote: 1 outgoing $ hg clone -q -r 0 . ../another @@ -311,6 +316,7 @@ Test handling common incoming revisions branch: default commit: (clean) update: (current) + phases: 1 draft (draft) remote: 1 outgoing $ cd ..