Add git_pull rule

This commit is contained in:
nvbn
2015-05-20 02:40:36 +03:00
parent 051f5fcb89
commit ce6855fd97
3 changed files with 42 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
def match(command, settings):
return ('git' in command.script
and 'pull' in command.script
and 'set-upstream' in command.stderr)
def get_new_command(command, settings):
line = command.stderr.split('\n')[-3].strip()
branch = line.split(' ')[-1]
set_upstream = line.replace('<remote>', 'origin')\
.replace('<branch>', branch)
return u'{} && {}'.format(set_upstream, command.script)