0
|
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()
|