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:
nyuszika7h 2015-06-01 20:38:10 +02:00
parent 24851f3c56
commit 1ac59cea78

View File

@ -7167,34 +7167,33 @@ def vote(cli, nick, chan, rest):
def fpull(cli, nick, chan, rest):
"""Pulls from the repository to update the bot."""
args = ["git", "pull", "--stat", "--rebase=preserve"]
commands = ["git fetch",
"git rebase --stat --preserve-merges"]
if rest:
args += rest.split(" ")
for command in commands:
child = subprocess.Popen(command.split(),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
(out, err) = child.communicate()
ret = child.returncode
child = subprocess.Popen(args,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
(out, err) = child.communicate()
ret = child.returncode
for line in (out + err).splitlines():
if chan == nick:
cli.msg(nick, line.decode("utf-8"))
else:
pm(cli, nick, line.decode("utf-8"))
for line in (out + err).splitlines():
if chan == nick:
cli.msg(nick, line.decode("utf-8"))
else:
pm(cli, nick, line.decode("utf-8"))
if ret != 0:
if ret < 0:
cause = "signal"
ret *= -1
else:
cause = "status"
if ret != 0:
if ret < 0:
cause = "signal"
ret *= -1
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))
if chan == nick:
cli.msg(nick, "Process %s exited with %s %d" % (command, cause, ret))
else:
pm(cli, nick, "Process %s exited with %s %d" % (command, cause, ret))
@cmd("fsend", admin_only=True, pm=True)
def fsend(cli, nick, chan, rest):