view bitten/build/hgtools.py @ 731:9b5630fdd35e

Use the hash and not the sequence number when updating local Mercurial repository. The hash is guaranteed to refer to the same changeset, whereas the sequence number may differ if local repository contains other changes. Closes #528.
author osimons
date Thu, 11 Feb 2010 17:36:10 +0000
parents 6b3de00356d1
children f703a0bf6548
line wrap: on
line source
# -*- coding: utf-8 -*-

"""Recipe commands for Mercurial."""

import logging

log = logging.getLogger('bitten.build.hgtools')

__docformat__ = 'restructuredtext en'

def pull(ctxt, revision=None, dir_='.'):
    """pull and update the local working copy from the Mercurial repository.
    
    :param ctxt: the build context
    :type ctxt: `Context`
    :param revision: the revision to check out
    :param dir\_: the name of a local subdirectory containing the working copy
    """
    args = ['pull', '-u']
    if revision:
        args += ['-r', revision.split(':')[1]]

    from bitten.build import shtools
    returncode = shtools.execute(ctxt, file_='hg', args=args, dir_=dir_)
    if returncode != 0:
        ctxt.error('hg pull -u failed (%s)' % returncode)
Copyright (C) 2012-2017 Edgewall Software