mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
7b859c681d
Summary: This command will allow us to expose simple api to all automation checking working copy parent. It's meant to be overridden by our wrapper to read the dirsate directly without shelling out to hg (see D4454504 ) Test Plan: see tests Reviewers: #mercurial, durham, rmcelroy Reviewed By: rmcelroy Subscribers: mjpieters Differential Revision: https://phabricator.intern.facebook.com/D4454502 Signature: t1:4454502:1485441135:09902c6437a7af55dfa5c97e3165681de687231f
19 lines
514 B
Python
19 lines
514 B
Python
from mercurial import cmdutil
|
|
from mercurial.node import hex, nullid
|
|
|
|
cmdtable = {}
|
|
command = cmdutil.command(cmdtable)
|
|
testedwith = 'ships-with-fb-hgext'
|
|
|
|
@command('whereami')
|
|
def whereami(ui, repo, *args, **opts):
|
|
"""output the current working directory parents
|
|
|
|
Outputs the hashes of current working directory parents separated
|
|
by newline.
|
|
"""
|
|
parents = repo.dirstate.parents()
|
|
ui.status('%s\n' % hex(parents[0]))
|
|
if parents[1] != nullid:
|
|
ui.status('%s\n' % hex(parents[1]))
|