Skip to content

Commit

Permalink
Small fix: don't forget remote_hash if no choice is done in list
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustavo Carvalho committed Feb 25, 2014
1 parent 44a2cc5 commit 5e35b50
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions RSync.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def remote_path(self, relative_path=''):
class STRSync:
def __init__(self, view=sublime.active_window().active_view()):
self.view = view
self.remote_hash = False

#################################
# settings and preferences handling
Expand Down Expand Up @@ -145,19 +146,18 @@ def check_remote_local_git_hash(self):
(ran_ok, local_hash) = run_executable([gitpath, 'rev-parse', 'HEAD'])
if not ran_ok:
raise Exception(local_hash)
(ran_ok, remote_hash) = run_executable(
(ran_ok, self.remote_hash) = run_executable(
[
sshpath,
self.main_host().remote_host(),
'cd {}; git rev-parse HEAD'.format(self.main_host().path()),
])
if not ran_ok:
raise Exception(remote_hash)
if remote_hash in annoy_on_hash_different:
raise Exception(self.remote_hash)
if self.remote_hash in annoy_on_hash_different:
return
if remote_hash != local_hash:
annoy_on_hash_different.append(remote_hash)
print ("Remote Git hash ({}) is diferent from local ({})".format(remote_hash, local_hash))
if self.remote_hash != local_hash:
print ("Remote Git hash ({}) is diferent from local ({})".format(self.remote_hash, local_hash))
self.view.window().show_quick_panel(
[
'Remote Git hash is diferent from local hash. FULL Rsync ?',
Expand All @@ -168,6 +168,8 @@ def check_remote_local_git_hash(self):
)

def handle_hash_is_different(self, answer):
if answer in [0, 1]:
annoy_on_hash_different.append(self.remote_hash)
if answer == 0:
self.sync_structure()

Expand Down

0 comments on commit 5e35b50

Please sign in to comment.