comparison mercurial/filemerge.py @ 26516:eb9876aa8770

filemerge: use symlinkcheck for :merge and :union This exposes a couple of bugs, both of which will be fixed in upcoming patches.
author Siddharth Agarwal <sid0@fb.com>
date Tue, 06 Oct 2015 22:57:21 -0700
parents 0ffa7fe1076b
children d8463a743d7d
comparison
equal deleted inserted replaced
26515:0ffa7fe1076b 26516:eb9876aa8770
240 """ 240 """
241 Uses the internal non-interactive simple merge algorithm for merging 241 Uses the internal non-interactive simple merge algorithm for merging
242 files. It will fail if there are any conflicts and leave markers in 242 files. It will fail if there are any conflicts and leave markers in
243 the partially merged file. Markers will have two sections, one for each side 243 the partially merged file. Markers will have two sections, one for each side
244 of merge, unless mode equals 'union' which suppresses the markers.""" 244 of merge, unless mode equals 'union' which suppresses the markers."""
245 tool, toolpath, binary, symlink = toolconf
246 if symlink:
247 repo.ui.warn(_('warning: internal :merge cannot merge symlinks '
248 'for %s\n') % fcd.path())
249 return False, 1
250 r = _premerge(repo, toolconf, files, labels=labels) 245 r = _premerge(repo, toolconf, files, labels=labels)
251 if r: 246 if r:
252 a, b, c, back = files 247 a, b, c, back = files
253 248
254 ui = repo.ui 249 ui = repo.ui
257 return True, r 252 return True, r
258 return False, 0 253 return False, 0
259 254
260 @internaltool('union', True, 255 @internaltool('union', True,
261 _("merging %s incomplete! " 256 _("merging %s incomplete! "
262 "(edit conflicts, then use 'hg resolve --mark')\n")) 257 "(edit conflicts, then use 'hg resolve --mark')\n"),
258 precheck=_symlinkcheck)
263 def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): 259 def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
264 """ 260 """
265 Uses the internal non-interactive simple merge algorithm for merging 261 Uses the internal non-interactive simple merge algorithm for merging
266 files. It will use both left and right sides for conflict regions. 262 files. It will use both left and right sides for conflict regions.
267 No markers are inserted.""" 263 No markers are inserted."""
268 return _merge(repo, mynode, orig, fcd, fco, fca, toolconf, 264 return _merge(repo, mynode, orig, fcd, fco, fca, toolconf,
269 files, labels, 'union') 265 files, labels, 'union')
270 266
271 @internaltool('merge', True, 267 @internaltool('merge', True,
272 _("merging %s incomplete! " 268 _("merging %s incomplete! "
273 "(edit conflicts, then use 'hg resolve --mark')\n")) 269 "(edit conflicts, then use 'hg resolve --mark')\n"),
270 precheck=_symlinkcheck)
274 def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): 271 def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
275 """ 272 """
276 Uses the internal non-interactive simple merge algorithm for merging 273 Uses the internal non-interactive simple merge algorithm for merging
277 files. It will fail if there are any conflicts and leave markers in 274 files. It will fail if there are any conflicts and leave markers in
278 the partially merged file. Markers will have two sections, one for each side 275 the partially merged file. Markers will have two sections, one for each side