From 2d14eef522739becf994be696b190624692a1d6a Mon Sep 17 00:00:00 2001 From: echel0n Date: Sat, 20 Dec 2014 07:26:19 -0800 Subject: [PATCH] Git clean/reset performed before updates now if set from config to avoid update issues --- .../interfaces/default/config_general.tmpl | 4 +-- sickbeard/versionChecker.py | 27 +++++++------------ 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/gui/slick/interfaces/default/config_general.tmpl b/gui/slick/interfaces/default/config_general.tmpl index b098c75e..f306bfcc 100644 --- a/gui/slick/interfaces/default/config_general.tmpl +++ b/gui/slick/interfaces/default/config_general.tmpl @@ -581,10 +581,10 @@
diff --git a/sickbeard/versionChecker.py b/sickbeard/versionChecker.py index a475687e..bd15cb29 100644 --- a/sickbeard/versionChecker.py +++ b/sickbeard/versionChecker.py @@ -395,19 +395,15 @@ class GitUpdateManager(UpdateManager): # update remote origin url self.update_remote_origin() - def update_cmd(): - 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 - else: - output, err, exit_status = self._run_git(self._git_path, 'checkout -f ' + self.branch) # @UnusedVariable + # remove untracked files and performs a hard reset on git branch to avoid update issues + if sickbeard.GIT_RESET: + self.clean() + self.reset() - 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 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 + else: + output, err, exit_status = self._run_git(self._git_path, 'checkout -f ' + self.branch) # @UnusedVariable if exit_status == 0: self._find_installed_version() @@ -432,11 +428,8 @@ class GitUpdateManager(UpdateManager): Calls git reset --hard to perform a hard reset. Returns a bool depending on the call's success. """ - if sickbeard.GIT_RESET: - output, err, exit_status = self._run_git(self._git_path, 'reset --hard') # @UnusedVariable - if exit_status == 0: - return True - else: + output, err, exit_status = self._run_git(self._git_path, 'reset --hard') # @UnusedVariable + if exit_status == 0: return True def list_remote_branches(self):