def parent(self, vcdir, abortOnError=True):
self.check_for_hg()
# We don't use run because this can be called very early before _opts is set
try:
out = subprocess.check_output(['hg', '-R', vcdir, 'parents', '--template', '{node}\n'])
parents = out.rstrip('\n').split('\n')
if len(parents) != 1:
if abortOnError:
abort('hg parents returned {} parents (expected 1)'.format(len(parents)))
return None
return parents[0]
except subprocess.CalledProcessError:
if abortOnError:
abort('hg parents failed')
else:
return None
评论列表
文章目录