1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-26 14:46:14 +01:00

- fix important bug, which could lead to overwriting local modifications when

upstream changes are merged
- if a merge fails, the store copy must be updated neverthelesss
This commit is contained in:
Dr. Peter Poeml 2007-01-23 06:55:43 +00:00
parent 3e1d1a1e78
commit 3e82391e1f
2 changed files with 17 additions and 10 deletions

6
TODO
View File

@ -169,11 +169,7 @@ if import cElememtTree fails, use elementtree
if that fails, point to home:cthiel1 repository (or devel:languages:python)
two merge issues:
1)
when updating, the file should be copied to store even if merge fails. this would prevent
that, after manual merging and osc resolve, one still sees the upstream changes in osc diff.
a merge issue:
2)
check the following:

View File

@ -347,19 +347,30 @@ class Package:
return 'C'
else:
# try merging
ret = os.system('diff3 -m -E %s %s %s > %s' \
% (myfilename, storefilename, upfilename, filename))
# diff3 OPTIONS... MINE OLDER YOURS
merge_cmd = 'diff3 -m -E %s %s %s > %s' % (myfilename, storefilename, upfilename, filename)
# we would rather use the subprocess module, but it is not availablebefore 2.4
ret = os.system(merge_cmd) / 256
# "An exit status of 0 means `diff3' was successful, 1 means some
# conflicts were found, and 2 means trouble."
if ret == 0:
# merge was successful... clean up
os.rename(upfilename, filename)
shutil.copy2(filename, storefilename)
shutil.copy2(upfilename, storefilename)
os.unlink(upfilename)
os.unlink(myfilename)
return 'G'
else:
elif ret == 1:
# unsuccessful merge
shutil.copy2(upfilename, storefilename)
self.in_conflict.append(n)
self.write_conflictlist()
return 'C'
else:
print >>sys.stderr, '\ndiff3 got in trouble... exit code:', ret
print >>sys.stderr, 'the command line was:'
print >>sys.stderr, merge_cmd
sys.exit(1)