fpull: Support git versions older than 1.9
Those versions don't support the --rebase=preserve option of git pull.
This commit is contained in:
parent
24851f3c56
commit
1ac59cea78
@ -7167,34 +7167,33 @@ def vote(cli, nick, chan, rest):
|
|||||||
def fpull(cli, nick, chan, rest):
|
def fpull(cli, nick, chan, rest):
|
||||||
"""Pulls from the repository to update the bot."""
|
"""Pulls from the repository to update the bot."""
|
||||||
|
|
||||||
args = ["git", "pull", "--stat", "--rebase=preserve"]
|
commands = ["git fetch",
|
||||||
|
"git rebase --stat --preserve-merges"]
|
||||||
|
|
||||||
if rest:
|
for command in commands:
|
||||||
args += rest.split(" ")
|
child = subprocess.Popen(command.split(),
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE)
|
||||||
|
(out, err) = child.communicate()
|
||||||
|
ret = child.returncode
|
||||||
|
|
||||||
child = subprocess.Popen(args,
|
for line in (out + err).splitlines():
|
||||||
stdout=subprocess.PIPE,
|
if chan == nick:
|
||||||
stderr=subprocess.PIPE)
|
cli.msg(nick, line.decode("utf-8"))
|
||||||
(out, err) = child.communicate()
|
else:
|
||||||
ret = child.returncode
|
pm(cli, nick, line.decode("utf-8"))
|
||||||
|
|
||||||
for line in (out + err).splitlines():
|
if ret != 0:
|
||||||
if chan == nick:
|
if ret < 0:
|
||||||
cli.msg(nick, line.decode("utf-8"))
|
cause = "signal"
|
||||||
else:
|
ret *= -1
|
||||||
pm(cli, nick, line.decode("utf-8"))
|
else:
|
||||||
|
cause = "status"
|
||||||
|
|
||||||
if ret != 0:
|
if chan == nick:
|
||||||
if ret < 0:
|
cli.msg(nick, "Process %s exited with %s %d" % (command, cause, ret))
|
||||||
cause = "signal"
|
else:
|
||||||
ret *= -1
|
pm(cli, nick, "Process %s exited with %s %d" % (command, cause, ret))
|
||||||
else:
|
|
||||||
cause = "status"
|
|
||||||
|
|
||||||
if chan == nick:
|
|
||||||
cli.msg(nick, "Process %s exited with %s %d" % (args, cause, ret))
|
|
||||||
else:
|
|
||||||
pm(cli, nick, "Process %s exited with %s %d" % (args, cause, ret))
|
|
||||||
|
|
||||||
@cmd("fsend", admin_only=True, pm=True)
|
@cmd("fsend", admin_only=True, pm=True)
|
||||||
def fsend(cli, nick, chan, rest):
|
def fsend(cli, nick, chan, rest):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user