mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-13 11:32:20 -05:00
Malformed airdates now raises a warning instead of a error so we dont clutter logs.
Updates now remove untracked files plus perform a hard reset on branch if first update attempt fails then trys to update for a 2nd time.
This commit is contained in:
parent
3b37dc0540
commit
482f20b735
@ -1686,8 +1686,8 @@ class TVEpisode(object):
|
|||||||
except (ValueError, IndexError):
|
except (ValueError, IndexError):
|
||||||
logger.log(u"Malformed air date of " + str(firstaired) + " retrieved from " + sickbeard.indexerApi(
|
logger.log(u"Malformed air date of " + str(firstaired) + " retrieved from " + sickbeard.indexerApi(
|
||||||
self.indexer).name + " for (" + self.show.name + " - " + str(season) + "x" + str(episode) + ")",
|
self.indexer).name + " for (" + self.show.name + " - " + str(season) + "x" + str(episode) + ")",
|
||||||
logger.ERROR)
|
logger.WARNING)
|
||||||
# if I'm incomplete on TVDB but I once was complete then just delete myself from the DB for now
|
# if I'm incomplete on the indexer but I once was complete then just delete myself from the DB for now
|
||||||
if self.indexerid != -1:
|
if self.indexerid != -1:
|
||||||
self.deleteEpisode()
|
self.deleteEpisode()
|
||||||
return False
|
return False
|
||||||
|
@ -395,24 +395,37 @@ class GitUpdateManager(UpdateManager):
|
|||||||
# update remote origin url
|
# update remote origin url
|
||||||
self.update_remote_origin()
|
self.update_remote_origin()
|
||||||
|
|
||||||
|
def update_cmd():
|
||||||
if self.branch == self._find_installed_branch():
|
if self.branch == self._find_installed_branch():
|
||||||
output, err, exit_status = self._run_git(self._git_path, 'pull -f %s %s' % (sickbeard.GIT_REMOTE, self.branch)) # @UnusedVariable
|
output, err, exit_status = self._run_git(self._git_path, 'pull -f %s %s' % (sickbeard.GIT_REMOTE, self.branch)) # @UnusedVariable
|
||||||
else:
|
else:
|
||||||
output, err, exit_status = self._run_git(self._git_path, 'checkout -f ' + self.branch) # @UnusedVariable
|
output, err, exit_status = self._run_git(self._git_path, 'checkout -f ' + self.branch) # @UnusedVariable
|
||||||
|
|
||||||
|
return output, err, exit_status
|
||||||
|
|
||||||
|
output, err, exit_status = update_cmd()
|
||||||
|
if not exit_status == 0:
|
||||||
|
# remove untracked files and reset branch then attempt updating again
|
||||||
|
if self.clean() and self.reset():
|
||||||
|
output, err, exit_status = update_cmd()
|
||||||
|
|
||||||
if exit_status == 0:
|
if exit_status == 0:
|
||||||
self._find_installed_version()
|
self._find_installed_version()
|
||||||
|
|
||||||
# Notify update successful
|
# Notify update successful
|
||||||
if sickbeard.NOTIFY_ON_UPDATE:
|
if sickbeard.NOTIFY_ON_UPDATE:
|
||||||
notifiers.notify_git_update(sickbeard.CUR_COMMIT_HASH if sickbeard.CUR_COMMIT_HASH else "")
|
notifiers.notify_git_update(sickbeard.CUR_COMMIT_HASH if sickbeard.CUR_COMMIT_HASH else "")
|
||||||
return True
|
|
||||||
else:
|
|
||||||
# perform a hard reset to try and resolve the issue
|
|
||||||
if self.reset() and self.update():
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
def clean(self):
|
||||||
|
"""
|
||||||
|
Calls git clean to remove all untracked files. Returns a bool depending
|
||||||
|
on the call's success.
|
||||||
|
"""
|
||||||
|
output, err, exit_status = self._run_git(self._git_path, 'clean -d -fx ""') # @UnusedVariable
|
||||||
|
if exit_status == 0:
|
||||||
|
return True
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
"""
|
"""
|
||||||
@ -421,11 +434,10 @@ class GitUpdateManager(UpdateManager):
|
|||||||
"""
|
"""
|
||||||
if sickbeard.GIT_RESET:
|
if sickbeard.GIT_RESET:
|
||||||
output, err, exit_status = self._run_git(self._git_path, 'reset --hard') # @UnusedVariable
|
output, err, exit_status = self._run_git(self._git_path, 'reset --hard') # @UnusedVariable
|
||||||
|
|
||||||
if exit_status == 0:
|
if exit_status == 0:
|
||||||
return True
|
return True
|
||||||
|
else:
|
||||||
return False
|
return True
|
||||||
|
|
||||||
def list_remote_branches(self):
|
def list_remote_branches(self):
|
||||||
# update remote origin url
|
# update remote origin url
|
||||||
|
Loading…
Reference in New Issue
Block a user