1
0
mirror of https://github.com/moparisthebest/SickRage synced 2025-01-07 11:58:01 -05:00

Git clean/reset performed before updates now if set from config to avoid update issues

This commit is contained in:
echel0n 2014-12-20 07:26:19 -08:00
parent 482f20b735
commit 2d14eef522
2 changed files with 12 additions and 19 deletions

View File

@ -581,10 +581,10 @@
<div class="field-pair"> <div class="field-pair">
<label for="git_reset"> <label for="git_reset">
<span class="component-title">Git branch reset</span> <span class="component-title">Git reset</span>
<span class="component-desc"> <span class="component-desc">
<input type="checkbox" name="git_reset" id="git_reset" #if True == $sickbeard.GIT_RESET then 'checked="checked"' else ''#/> <input type="checkbox" name="git_reset" id="git_reset" #if True == $sickbeard.GIT_RESET then 'checked="checked"' else ''#/>
<p>reset git branch automatically to help resolve update issues</p> <p>removes untracked files and performs a hard reset on git branch automatically to help resolve update issues</p>
</span> </span>
</label> </label>
</div> </div>

View File

@ -395,19 +395,15 @@ class GitUpdateManager(UpdateManager):
# update remote origin url # update remote origin url
self.update_remote_origin() self.update_remote_origin()
def update_cmd(): # remove untracked files and performs a hard reset on git branch to avoid update issues
if self.branch == self._find_installed_branch(): if sickbeard.GIT_RESET:
output, err, exit_status = self._run_git(self._git_path, 'pull -f %s %s' % (sickbeard.GIT_REMOTE, self.branch)) # @UnusedVariable self.clean()
else: self.reset()
output, err, exit_status = self._run_git(self._git_path, 'checkout -f ' + self.branch) # @UnusedVariable
return output, err, exit_status 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 = update_cmd() else:
if not exit_status == 0: output, err, exit_status = self._run_git(self._git_path, 'checkout -f ' + self.branch) # @UnusedVariable
# 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()
@ -432,11 +428,8 @@ class GitUpdateManager(UpdateManager):
Calls git reset --hard to perform a hard reset. Returns a bool depending Calls git reset --hard to perform a hard reset. Returns a bool depending
on the call's success. on the call's success.
""" """
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
else:
return True return True
def list_remote_branches(self): def list_remote_branches(self):