comparison mozillahg/api.py @ 1:da64ea951cd8 default tip

notes to self
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 24 Mar 2013 00:44:33 -0700
parents 1855ba0b873a
children
comparison
equal deleted inserted replaced
0:1855ba0b873a 1:da64ea951cd8
1 """ 1 """
2 mercurial front end API using hg CLI 2 mercurial front end API using hg CLI
3 """ 3 """
4 4
5 import subprocess 5 import subprocess
6
7 from subprocess import check_output as call 6 from subprocess import check_output as call
8 7
9 class Hg(object): 8 class Hg(object):
9 """front end to mercurial using subprocess"""
10
10 def __init__(self, path, hg=None): 11 def __init__(self, path, hg=None):
11 self.hg = hg or 'hg' 12 self.hg = hg or 'hg'
12 self.path = path 13 self.path = path
13 14
14 def __call__(self, *args): 15 def __call__(self, *args):
19 list all commits in a range: [start..finish] 20 list all commits in a range: [start..finish]
20 if `finish` is omitted, tip is used 21 if `finish` is omitted, tip is used
21 """ 22 """
22 23
23 output = self("log", "", "--template", "{rev}\n") 24 output = self("log", "", "--template", "{rev}\n")
24 return [line.strip() for line in output.strip().splitlines() 25 return [line.strip() for line in output.strip().splitlines()]
26
27 def clone(self):
28 """clone a repo"""
29
30 # TODO: how does this fit in with path?
31 # probably ideally anything this class does can operate locally
32 # or remotely (using a local clone for staging when needed)
33
34 # TODO:
35 # fill out .hgrc files default-push