Mercurial > evolve
changeset 2290:a36a8c6a09ac
ui: change the hidden revision error message
It now display the same details than the warning
when the working directory parent become obsolete
like:
$ hg update 0
abort: hidden revision '0' (successor: f301a99bd857)!
$ hg up 1
abort: hidden revision '1' (pruned)!
$ hg update 0
abort: hidden revision '0' (successors: 91311af6da10, 70653776ec4c)!
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Fri, 28 Apr 2017 16:56:09 +0200 |
parents | 61d073590fb7 |
children | e719645cf743 |
files | README hgext3rd/evolve/__init__.py tests/test-evolve-obshistory.t tests/test-evolve.t tests/test-inhibit.t tests/test-prune.t tests/test-userguide.t |
diffstat | 7 files changed, 73 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/README Fri Apr 28 16:57:41 2017 +0200 +++ b/README Fri Apr 28 16:56:09 2017 +0200 @@ -115,7 +115,8 @@ 6.1.0 - in progress ------------------- - - improve messages about obsolete working copy parent, + - improve message about obsolete working copy parent, + - improve message issued when accessing hidden nodes, - add a 'experimental.auto-publish' config. Set it so 'warn' to get a warning when a push is publishing some draft changesets and 'abort' to prevent that to happen at all.
--- a/hgext3rd/evolve/__init__.py Fri Apr 28 16:57:41 2017 +0200 +++ b/hgext3rd/evolve/__init__.py Fri Apr 28 16:56:09 2017 +0200 @@ -3186,3 +3186,35 @@ f.write(orig.topic()) return merge.graft(repo, orig, pctx, ['local', 'graft'], True) + + +@eh.wrapfunction(context, '_filterederror') +def evolve_filtererror(original, repo, changeid): + """build an exception to be raised about a filtered changeid + + This is extracted in a function to help extensions (eg: evolve) to + experiment with various message variants.""" + if repo.filtername.startswith('visible'): + + unfilteredrepo = repo.unfiltered() + rev = unfilteredrepo[changeid] + reason, successors = _getobsoletereason(unfilteredrepo, rev.node()) + + # Be more precise in cqse the revision is superseed + if reason == 'superseed': + reason = _("successor: %s") % successors[0] + elif reason == 'superseed_split': + if len(successors) <= 2: + reason = _("successors: %s") % ", ".join(successors) + else: + firstsuccessors = ", ".join(successors[:2]) + remainingnumber = len(successors) - 2 + successorsmsg = _("%s and %d more") % (firstsuccessors, remainingnumber) + reason = _("successors: %s") % successorsmsg + + msg = _("hidden revision '%s'") % changeid + hint = _('use --hidden to access hidden revisions; %s') % reason + return error.FilteredRepoLookupError(msg, hint=hint) + msg = _("filtered revision '%s' (not in '%s' subset)") + msg %= (changeid, repo.filtername) + return error.FilteredRepoLookupError(msg)
--- a/tests/test-evolve-obshistory.t Fri Apr 28 16:57:41 2017 +0200 +++ b/tests/test-evolve-obshistory.t Fri Apr 28 16:56:09 2017 +0200 @@ -52,6 +52,10 @@ Actual test ----------- + $ hg update 471f378eab4c + abort: hidden revision '471f378eab4c'! + (use --hidden to access hidden revisions; successor: a468dc9b3633) + [255] $ hg update --hidden "desc(A0)" 1 files updated, 0 files merged, 0 files removed, 0 files unresolved working directory parent is obsolete! (471f378eab4c) @@ -93,6 +97,12 @@ Actual test ----------- + $ hg up 1 + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg up 0dec01379d3b + abort: hidden revision '0dec01379d3b'! + (use --hidden to access hidden revisions; pruned) + [255] $ hg up --hidden -r 'desc(B0)' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved working directory parent is obsolete! (0dec01379d3b) @@ -185,6 +195,10 @@ Actual test ----------- + $ hg update 471597cad322 + abort: hidden revision '471597cad322'! + (use --hidden to access hidden revisions; successors: 337fec4d2edc, f257fde29c7a) + [255] $ hg update --hidden 'min(desc(A0))' 0 files updated, 0 files merged, 0 files removed, 0 files unresolved working directory parent is obsolete! (471597cad322) @@ -343,6 +357,10 @@ Actual test ----------- + $ hg update de7290d8b885 + abort: hidden revision 'de7290d8b885'! + (use --hidden to access hidden revisions; successors: 337fec4d2edc, f257fde29c7a and 2 more) + [255] $ hg update --hidden 'min(desc(A0))' 0 files updated, 0 files merged, 0 files removed, 0 files unresolved working directory parent is obsolete! (de7290d8b885) @@ -405,10 +423,20 @@ Actual test ----------- + $ hg update 471f378eab4c + abort: hidden revision '471f378eab4c'! + (use --hidden to access hidden revisions; successor: eb5a0daa2192) + [255] $ hg update --hidden 'desc(A0)' 0 files updated, 0 files merged, 1 files removed, 0 files unresolved working directory parent is obsolete! (471f378eab4c) (use 'hg evolve' to update to its successor: eb5a0daa2192) + $ hg update 0dec01379d3b + working directory parent is obsolete! (471f378eab4c) + (use 'hg evolve' to update to its successor: eb5a0daa2192) + abort: hidden revision '0dec01379d3b'! + (use --hidden to access hidden revisions; successor: eb5a0daa2192) + [255] $ hg update --hidden 'desc(B0)' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved working directory parent is obsolete! (0dec01379d3b) @@ -478,6 +506,10 @@ Actual test ----------- + $ hg update 471f378eab4c + abort: hidden revision '471f378eab4c'! + (use --hidden to access hidden revisions; diverged) + [255] $ hg update --hidden 'desc(A0)' 0 files updated, 0 files merged, 0 files removed, 0 files unresolved working directory parent is obsolete! (471f378eab4c)
--- a/tests/test-evolve.t Fri Apr 28 16:57:41 2017 +0200 +++ b/tests/test-evolve.t Fri Apr 28 16:56:09 2017 +0200 @@ -722,7 +722,7 @@ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg fold --from 6 # want to run hg fold 6 abort: hidden revision '6'! - (use --hidden to access hidden revisions) + (use --hidden to access hidden revisions; successor: af636757ce3b) [255] $ hg log -r 11 --template '{desc}\n' add 3
--- a/tests/test-inhibit.t Fri Apr 28 16:57:41 2017 +0200 +++ b/tests/test-inhibit.t Fri Apr 28 16:56:09 2017 +0200 @@ -364,7 +364,7 @@ $ hg export 1 3 abort: hidden revision '1'! - (use --hidden to access hidden revisions) + (use --hidden to access hidden revisions; pruned) [255] @@ -432,7 +432,7 @@ $ hg rebase -s 10 -d 3 abort: hidden revision '3'! - (use --hidden to access hidden revisions) + (use --hidden to access hidden revisions; pruned) [255] $ hg rebase -r ad78ff7d621f -r 53a94305e133 -d 2db36d8066ff --config experimental.rebaseskipobsolete=0 Warning: accessing hidden changesets 2db36d8066ff for write operation @@ -803,7 +803,7 @@ $ hg push -r 003a4735afde $pwd/inhibit2 pushing to $TESTTMP/inhibit2 abort: hidden revision '003a4735afde'! - (use --hidden to access hidden revisions) + (use --hidden to access hidden revisions; successor: 71eb4f100663) [255] Visible commits can still be pushed
--- a/tests/test-prune.t Fri Apr 28 16:57:41 2017 +0200 +++ b/tests/test-prune.t Fri Apr 28 16:56:09 2017 +0200 @@ -305,7 +305,7 @@ 1 changesets pruned $ hg id -ir dcbb326fdec2 abort: hidden revision 'dcbb326fdec2'! - (use --hidden to access hidden revisions) + (use --hidden to access hidden revisions; pruned) [255] $ hg id -ir d62d843c9a01 d62d843c9a01 @@ -339,7 +339,7 @@ $ hg tag --remove --local c $ hg id -ir 6:2702dd0c91e7 abort: hidden revision '6'! - (use --hidden to access hidden revisions) + (use --hidden to access hidden revisions; pruned) [255] $ hg debugobsstorestat
--- a/tests/test-userguide.t Fri Apr 28 16:57:41 2017 +0200 +++ b/tests/test-userguide.t Fri Apr 28 16:56:09 2017 +0200 @@ -39,7 +39,7 @@ $ hg commit --amend -u alice -d '2 0' -m 'implement feature Y' $ hg shortlog -q -r fe0ecd3bd2a4 abort: hidden revision 'fe0ecd3bd2a4'! - (use --hidden to access hidden revisions) + (use --hidden to access hidden revisions; successor: 934359450037) [255] $ hg --hidden shortlog -G @ 3:934359450037 draft implement feature Y