Exemplo n.º 1
0
Arquivo: hg.py Projeto: edisona/amcat
def getRepoStatus(fn):
    """Yield file, status tuples for all files in the repo of fn"""
    repo = getRepo(fn)
    if not repo: return
    cmd = 'hg -R "%s" status -A' % repo
    for st in toolkit.execute(cmd, outonly=True).split("\n"):
        if not st.strip(): continue
        yield st[2:], st[0]
Exemplo n.º 2
0
Arquivo: hg.py Projeto: edisona/amcat
def getStatus(fn):
    """Get the hg status of fn"""
    repo = getRepo(fn)
    if not repo or not os.path.exists(fn): return
    cmd = 'hg -R "%s" status -A "%s"' % (repo, fn)
    st = toolkit.execute(cmd, outonly=True).strip()
    if not st: return 
    return st[0]
Exemplo n.º 3
0
Arquivo: hg.py Projeto: edisona/amcat
def getLastEditUser(fn):
    """Get the username who made the last commit to this file"""
    repo = getRepo(fn)
    if not repo or not os.path.exists(fn): return
    cmd = 'hg -R "%s" log %s/%s | head -3 | tail -1' % (repo, repo, fn)
    for line in toolkit.execute(cmd, outonly=True).split("\n"):
        if line.startswith("user:"******"?"
Exemplo n.º 4
0
def dot2img(dot, format="jpg", layout="dot"):
    cmd = 'dot -T%s -K%s' % (format, layout)
    img = toolkit.execute(cmd, dot, outonly=True)
    return img
Exemplo n.º 5
0
Arquivo: hg.py Projeto: edisona/amcat
 def update(self, revision=None):
     cmd = 'hg update -R {self.repo}'
     if revision: cmd += ' -r {revision}'
     out = toolkit.execute(cmd.format(**locals()), outonly=True)
Exemplo n.º 6
0
Arquivo: hg.py Projeto: edisona/amcat
 def listbranches(self):
     cmd = 'hg branches -R {repo}'.format(**self.__dict__)
     for line in toolkit.execute(cmd, outonly=True).split('\n'):
         if not line.strip(): continue
         yield line.split(' ',1)[0]
Exemplo n.º 7
0
Arquivo: hg.py Projeto: edisona/amcat
def clone(repo, dest):
    """Clone the repository to destination"""
    cmd = 'hg clone {repo} {dest}'.format(**locals())
    print(cmd)
    toolkit.execute(cmd, outonly=True)
    return Repository(dest)