def do_hg_pull(dir, repository, hg): fulldir = os.path.join(topsrcdir, dir) # clone if the dir doesn't exist, pull if it does if not os.path.exists(fulldir): fulldir = os.path.join(topsrcdir, dir) check_call_noisy([hg, 'clone', repository, fulldir]) else: cmd = [hg, 'pull', '-u', '-R', fulldir] if repository is not None: cmd.append(repository) check_call_noisy(cmd) check_call([hg, 'parent', '-R', fulldir, '--template=Updated to revision {node}.\n'])
def check_call_noisy(cmd, *args, **kwargs): print "Executing command:", cmd check_call(cmd, *args, **kwargs)