1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +01:00

- fixed #574758 ('"osc" cannot commit "read-only" files.')

- simply use shutil.copyfile() instead of shutil.copy2() because we don't
  care about the file mode etc.
This commit is contained in:
Marcus Huewe 2010-01-30 18:05:25 +01:00
parent 0d67340644
commit f88e3f7c3f

View File

@ -717,7 +717,7 @@ class Package:
self.filelist.append(f) self.filelist.append(f)
self.filenamelist.append(n) self.filenamelist.append(n)
self.filenamelist_unvers.remove(n) self.filenamelist_unvers.remove(n)
shutil.copy2(os.path.join(self.dir, n), os.path.join(self.storedir, n)) shutil.copyfile(os.path.join(self.dir, n), os.path.join(self.storedir, n))
def delete_file(self, n, force=False): def delete_file(self, n, force=False):
"""deletes a file if possible and marks the file as deleted""" """deletes a file if possible and marks the file as deleted"""
@ -806,7 +806,7 @@ class Package:
u = makeurl(self.apiurl, ['source', self.prjname, self.name, pathname2url(n)], query=query) u = makeurl(self.apiurl, ['source', self.prjname, self.name, pathname2url(n)], query=query)
http_PUT(u, file = os.path.join(self.dir, n)) http_PUT(u, file = os.path.join(self.dir, n))
shutil.copy2(os.path.join(self.dir, n), os.path.join(self.storedir, n)) shutil.copyfile(os.path.join(self.dir, n), os.path.join(self.storedir, n))
def commit(self, msg=''): def commit(self, msg=''):
# commit only if the upstream revision is the same as the working copy's # commit only if the upstream revision is the same as the working copy's
@ -932,7 +932,7 @@ class Package:
get_source_file(self.apiurl, self.prjname, self.name, n, targetfilename=filename, revision=revision) get_source_file(self.apiurl, self.prjname, self.name, n, targetfilename=filename, revision=revision)
os.utime(filename, (-1, mtime)) os.utime(filename, (-1, mtime))
shutil.copy2(filename, storefilename) shutil.copyfile(filename, storefilename)
def mergefile(self, n): def mergefile(self, n):
filename = os.path.join(self.dir, n) filename = os.path.join(self.dir, n)
@ -948,8 +948,8 @@ class Package:
if binary_file(myfilename) or binary_file(upfilename): if binary_file(myfilename) or binary_file(upfilename):
# don't try merging # don't try merging
shutil.copy2(upfilename, filename) shutil.copyfile(upfilename, filename)
shutil.copy2(upfilename, storefilename) shutil.copyfile(upfilename, storefilename)
self.in_conflict.append(n) self.in_conflict.append(n)
self.write_conflictlist() self.write_conflictlist()
return 'C' return 'C'
@ -964,13 +964,13 @@ class Package:
# conflicts were found, and 2 means trouble." # conflicts were found, and 2 means trouble."
if ret == 0: if ret == 0:
# merge was successful... clean up # merge was successful... clean up
shutil.copy2(upfilename, storefilename) shutil.copyfile(upfilename, storefilename)
os.unlink(upfilename) os.unlink(upfilename)
os.unlink(myfilename) os.unlink(myfilename)
return 'G' return 'G'
elif ret == 1: elif ret == 1:
# unsuccessful merge # unsuccessful merge
shutil.copy2(upfilename, storefilename) shutil.copyfile(upfilename, storefilename)
self.in_conflict.append(n) self.in_conflict.append(n)
self.write_conflictlist() self.write_conflictlist()
return 'C' return 'C'