508
|
1
|
|
2 """
|
|
3 http://k0s.org/blog/20100821174911
|
|
4
|
|
5 Tag -> hg
|
|
6 """
|
|
7
|
|
8 # XXX stub
|
|
9
|
|
10 import subprocess
|
|
11 import which
|
|
12
|
|
13 def call(*args, **kwargs):
|
|
14 """"""
|
|
15 return subprocess.check_output(*args, **kwargs)
|
|
16
|
|
17 class ExecuteCommands(object):
|
|
18
|
|
19 def __init__(self, *commands, **kwargs):
|
|
20 self.commands = commands
|
|
21 self.kwargs = kwargs
|
|
22
|
|
23 def __call__(self):
|
|
24 for command in self.commands:
|
|
25 yield call(command, **self.kwargs)
|
|
26
|
|
27 class lsdiff(ExecuteCommands):
|
|
28 commands = ['lsdiff']
|
|
29 def __call__(self):
|
|
30 output = []
|
|
31 for retval in ExecuteCommands(self):
|
|
32 raise NotImplementedError
|
|
33
|
|
34 def hg_root(directory=None):
|
|
35 directory = directory if directory else os.getcwd()
|
|
36
|
|
37 # CLI
|
|
38
|
|
39 def main(args=sys.argv[1:]):
|
|
40 parser = optparse.OptionParser()
|
|
41 options, args = parser.parse_args(args)
|
|
42
|
|
43 # find the root
|
|
44 root = hg_root()
|
|
45
|
|
46 # get the files
|
|
47 paths = lsdiff(root)
|
|
48
|
|
49 if __name__ == '__main__':
|
|
50 main()
|