smartlog: write all hashes from smartlog to .hg/hashes

Summary: The hashes in .hg/hashes can be used for bash/zsh completion

Test Plan: Run `hg sl` in a repo. Check that .hg/completionhints contains the same hashes shown by `hg sl`.

Reviewers: durham

Reviewed By: durham

Subscribers: #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2440503

Tasks: 8331035

Signature: t1:2440503:1442268630:c3bb3a52a301d2b6fa461158ccbd087c87e883a5
This commit is contained in:
Gulshan Singh 2015-09-14 13:37:45 -07:00
parent 84c1720a00
commit 0e1385521f

View File

@ -9,7 +9,7 @@ from mercurial import extensions, util, cmdutil, graphmod, templatekw, scmutil
from mercurial import bookmarks, commands, error, revset
from mercurial.extensions import wrapfunction
from hgext import pager
from mercurial.node import hex, nullrev
from mercurial.node import hex, short, nullrev
from mercurial.i18n import _
import errno, os, re
@ -478,6 +478,13 @@ Excludes:
showparents = [ctx.node() for ctx in repo[None].parents()]
cmdutil.displaygraph(ui, revdag, displayer, showparents,
graphmod.asciiedges, None, None)
with open(repo.join('completionhints'), 'w+') as f:
for rev in revdag:
commit_hash = rev[2].node()
# Skip fakectxt nodes
if commit_hash != '...':
f.write(short(commit_hash) + '\n');
finally:
enabled = False