Mercurial > mozilla > hg > MozillaHg
comparison mozillahg/api.py @ 0:1855ba0b873a
initial commit
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 22 Jan 2013 21:30:20 -0800 |
parents | |
children | da64ea951cd8 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1855ba0b873a |
---|---|
1 """ | |
2 mercurial front end API using hg CLI | |
3 """ | |
4 | |
5 import subprocess | |
6 | |
7 from subprocess import check_output as call | |
8 | |
9 class Hg(object): | |
10 def __init__(self, path, hg=None): | |
11 self.hg = hg or 'hg' | |
12 self.path = path | |
13 | |
14 def __call__(self, *args): | |
15 call([self.hg] + list(args)) | |
16 | |
17 def commits(self, start, finish=None): | |
18 """ | |
19 list all commits in a range: [start..finish] | |
20 if `finish` is omitted, tip is used | |
21 """ | |
22 | |
23 output = self("log", "", "--template", "{rev}\n") | |
24 return [line.strip() for line in output.strip().splitlines() |