210
210
contents = entry.contents_change
211
211
if contents is None:
213
this_path = this.readonly_path(entry.id)
214
this_path = this.id2abspath(entry.id)
214
217
def make_merge():
215
218
if this_path is None:
216
219
return conflict_handler.missing_for_merge(entry.id,
237
240
if this_contents == contents.new_contents:
240
other_path = other.readonly_path(entry.id)
241
243
conflict_handler.new_contents_conflict(this_path,
243
245
elif isinstance(contents.old_contents, changeset.TreeFileCreate) and \
244
246
isinstance(contents.new_contents, changeset.TreeFileCreate):
245
247
return make_merge()
261
263
metadata = entry.metadata_change
262
264
if metadata is None:
264
if isinstance(metadata, changeset.ChangeExecFlag):
265
if metadata.new_exec_flag is None:
267
elif metadata.old_exec_flag is None:
270
base_path = base.readonly_path(entry.id)
271
other_path = other.readonly_path(entry.id)
272
return ExecFlagMerge(base_path, other_path)
266
assert isinstance(metadata, changeset.ChangeExecFlag)
267
if metadata.new_exec_flag is None:
269
elif metadata.old_exec_flag is None:
272
return ExecFlagMerge(base, other, entry.id)
275
275
class ExecFlagMerge(object):
276
def __init__(self, base_path, other_path):
277
self.base_path = base_path
278
self.other_path = other_path
276
def __init__(self, base_tree, other_tree, file_id):
277
self.base_tree = base_tree
278
self.other_tree = other_tree
279
self.file_id = file_id
280
281
def apply(self, filename, conflict_handler, reverse=False):
282
base = self.base_path
283
other = self.other_path
283
base = self.base_tree
284
other = self.other_tree
285
base = self.other_path
286
other = self.base_path
287
base_mode = os.stat(base).st_mode
288
base_exec_flag = bool(base_mode & 0111)
289
other_mode = os.stat(other).st_mode
290
other_exec_flag = bool(other_mode & 0111)
286
base = self.other_tree
287
other = self.base_tree
288
base_exec_flag = base.is_executable(self.file_id)
289
other_exec_flag = other.is_executable(self.file_id)
291
290
this_mode = os.stat(filename).st_mode
292
291
this_exec_flag = bool(this_mode & 0111)
293
292
if (base_exec_flag != other_exec_flag and