#!/usr/bin/env python

from mercurial import (hg, repo, commands)
from subprocess import call
import os

def agvtag_cmd(ui, repo, tag, **opts):
    path = ui.config('agvtag', 'path', default=".", untrusted=False)
    os.chdir(path)
    call(['agvtool', 'new-marketing-version', tag]);
    node = repo.commit(text="Updates Bundle Version String (CFBundleVersionString) for tag "+tag)    
    commands.tag(ui, repo, tag)

cmdtable = {
    # "command-name": (function-call, options-list, help-string)
    "agvtag": (agvtag_cmd, [], "hg agvtag tag")
}
