diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3345,6 +3345,7 @@ def locate(ui, repo, *pats, **opts): _('show changesets within the given named branch'), _('BRANCH')), ('P', 'prune', [], _('do not display revision or any of its ancestors'), _('REV')), + ('h', 'hidden', False, _('show hidden changesets')), ] + logopts + walkopts, _('[OPTION]... [FILE]')) def log(ui, repo, *pats, **opts): @@ -3406,6 +3407,8 @@ def log(ui, repo, *pats, **opts): return if opts.get('branch') and ctx.branch() not in opts['branch']: return + if not opts.get('hidden') and ctx.hidden(): + return if df and not df(ctx.date()[0]): return if opts['user'] and not [k for k in opts['user'] diff --git a/tests/test-debugcomplete.t b/tests/test-debugcomplete.t --- a/tests/test-debugcomplete.t +++ b/tests/test-debugcomplete.t @@ -194,7 +194,7 @@ Show all commands + options export: output, switch-parent, rev, text, git, nodates forget: include, exclude init: ssh, remotecmd, insecure - log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, style, template, include, exclude + log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, branch, prune, hidden, patch, git, limit, no-merges, stat, style, template, include, exclude merge: force, tool, rev, preview pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure push: force, rev, bookmark, branch, new-branch, ssh, remotecmd, insecure diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -1138,3 +1138,21 @@ Diff here should be the same: date: Thu Jan 01 00:00:00 1970 +0000 summary: a + $ cat > $HGTMP/testhidden.py << EOF + > def reposetup(ui, repo): + > for line in repo.opener('hidden'): + > ctx = repo[line.strip()] + > repo.changelog.hiddenrevs.add(ctx.rev()) + > EOF + $ echo '[extensions]' >> $HGRCPATH + $ echo "hidden=$HGTMP/testhidden.py" >> $HGRCPATH + $ touch .hg/hidden + $ hg log --template='{rev}:{node}\n' + 1:a765632148dc55d38c35c4f247c618701886cb2f + 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 + $ echo a765632148dc55d38c35c4f247c618701886cb2f > .hg/hidden + $ hg log --template='{rev}:{node}\n' + 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 + $ hg log --template='{rev}:{node}\n' --hidden + 1:a765632148dc55d38c35c4f247c618701886cb2f + 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05