Skip to content

Commit

Permalink
- rename function to fix crash with python 2.6, it uses the download …
Browse files Browse the repository at this point in the history
…function from core in that situation
  • Loading branch information
adrianschroeter committed Sep 17, 2013
1 parent 529e1d4 commit b5def08
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -7272,7 +7272,7 @@ def do_cat(self, subcmd, opts, *args):


# helper function to download a file from a specific revision
def download(self, name, md5, dir, destfile):
def download_rev(self, name, md5, dir, destfile):
o = open(destfile, 'wb')
if md5 != '':
query = {'rev': dir['srcmd5']}
Expand Down Expand Up @@ -7420,13 +7420,13 @@ def do_repairlink(self, subcmd, opts, *args):
md5_new = entries_new.get(name, '')
md5_oldpatched = entries_oldpatched.get(name, '')
if md5_new != '':
self.download(name, md5_new, dir_new, os.path.join(storedir, name))
self.download_rev(name, md5_new, dir_new, os.path.join(storedir, name))
if md5_old == md5_new:
if md5_oldpatched == '':
pac.put_on_deletelist(name)
continue
print(statfrmt(' ', name))
self.download(name, md5_oldpatched, dir_oldpatched, os.path.join(destdir, name))
self.download_rev(name, md5_oldpatched, dir_oldpatched, os.path.join(destdir, name))
continue
if md5_old == md5_oldpatched:
if md5_new == '':
Expand All @@ -7440,12 +7440,12 @@ def do_repairlink(self, subcmd, opts, *args):
print(statfrmt('G', name))
shutil.copy2(os.path.join(storedir, name), os.path.join(destdir, name))
continue
self.download(name, md5_oldpatched, dir_oldpatched, os.path.join(destdir, name + '.mine'))
self.download_rev(name, md5_oldpatched, dir_oldpatched, os.path.join(destdir, name + '.mine'))
if md5_new != '':
shutil.copy2(os.path.join(storedir, name), os.path.join(destdir, name + '.new'))
else:
self.download(name, md5_new, dir_new, os.path.join(destdir, name + '.new'))
self.download(name, md5_old, dir_old, os.path.join(destdir, name + '.old'))
self.download_rev(name, md5_new, dir_new, os.path.join(destdir, name + '.new'))
self.download_rev(name, md5_old, dir_old, os.path.join(destdir, name + '.old'))

if binary_file(os.path.join(destdir, name + '.mine')) or \
binary_file(os.path.join(destdir, name + '.old')) or \
Expand Down Expand Up @@ -7565,18 +7565,18 @@ def do_pull(self, subcmd, opts, *args):
os.unlink(name)
elif md5_old == '':
print(statfrmt('A', name))
self.download(name, md5_new, dir_new, name)
self.download_rev(name, md5_new, dir_new, name)
p.put_on_addlist(name)
else:
print(statfrmt('U', name))
self.download(name, md5_new, dir_new, name)
self.download_rev(name, md5_new, dir_new, name)
continue
# need diff3 to resolve issue
if md5_oldpatched == '':
open(name, 'w').write('')
os.rename(name, name + '.mine')
self.download(name, md5_new, dir_new, name + '.new')
self.download(name, md5_old, dir_old, name + '.old')
self.download_rev(name, md5_new, dir_new, name + '.new')
self.download_rev(name, md5_old, dir_old, name + '.old')
if binary_file(name + '.mine') or binary_file(name + '.old') or binary_file(name + '.new'):
shutil.copy2(name + '.new', name)
print(statfrmt('C', name))
Expand Down

0 comments on commit b5def08

Please sign in to comment.