|
@ -0,0 +1,39 @@
|
|
1
|
import os
|
|
2
|
import subprocess
|
|
3
|
from utilities import isGit, isMercurial, isBazaar
|
|
4
|
|
|
5
|
def incoming(arguments):
|
|
6
|
'''
|
|
7
|
Shows incoming commits.
|
|
8
|
'''
|
|
9
|
|
|
10
|
if isGit():
|
|
11
|
out, err = executeCommandWithResponse(["git", "remote"])
|
|
12
|
if not err and out:
|
|
13
|
executeCommandWithResponse(["git", "remote", "update", "-p"])
|
|
14
|
executeCommand(["git", "log", "..@{u}"])
|
|
15
|
|
|
16
|
if isMercurial():
|
|
17
|
out, err = executeCommandWithResponse(["git", "paths"])
|
|
18
|
if not err and out:
|
|
19
|
executeCommand(["hg", "incoming"])
|
|
20
|
|
|
21
|
if isBazaar():
|
|
22
|
out, err = executeCommandWithResponse(["bzr", "missing"])
|
|
23
|
if not err and out:
|
|
24
|
executeCommand(["bzr", "missing"])
|
|
25
|
|
|
26
|
def executeCommand(command):
|
|
27
|
'''
|
|
28
|
Execute the given command.
|
|
29
|
'''
|
|
30
|
|
|
31
|
subprocess.call(command, stderr=subprocess.STDOUT)
|
|
32
|
|
|
33
|
def executeCommandWithResponse(command):
|
|
34
|
'''
|
|
35
|
Execute the given command and return the output and errors.
|
|
36
|
'''
|
|
37
|
|
|
38
|
proc = subprocess.Popen(command, stderr=open(os.devnull, 'w'), stdout=subprocess.PIPE)
|
|
39
|
return proc.communicate()
|