##// END OF EJS Templates
merge: add labels parameter from merge.update to filemerge...
Durham Goode -
r21524:47b97d9a default
parent child Browse files
Show More
@@ -452,9 +452,9 b' def overridecalculateupdates(origfn, rep'
452 452
453 453 # Override filemerge to prompt the user about how they wish to merge
454 454 # largefiles. This will handle identical edits without prompting the user.
455 def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca):
455 def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca, labels=None):
456 456 if not lfutil.isstandin(orig):
457 return origfn(repo, mynode, orig, fcd, fco, fca)
457 return origfn(repo, mynode, orig, fcd, fco, fca, labels=labels)
458 458
459 459 ahash = fca.data().strip().lower()
460 460 dhash = fcd.data().strip().lower()
@@ -300,6 +300,8 b' def _formatconflictmarker(repo, ctx, tem'
300 300 '{ifeq(branch, "default", "", "{branch} ")}' +
301 301 '- {author|user}: "{desc|firstline}"')
302 302
303 _defaultconflictlabels = ['local', 'other']
304
303 305 def _formatlabels(repo, fcd, fco, labels):
304 306 """Formats the given labels using the conflict marker template.
305 307
@@ -318,7 +320,7 b' def _formatlabels(repo, fcd, fco, labels'
318 320 return [_formatconflictmarker(repo, cd, tmpl, labels[0], pad),
319 321 _formatconflictmarker(repo, co, tmpl, labels[1], pad)]
320 322
321 def filemerge(repo, mynode, orig, fcd, fco, fca):
323 def filemerge(repo, mynode, orig, fcd, fco, fca, labels=None):
322 324 """perform a 3-way merge in the working directory
323 325
324 326 mynode = parent node before merge
@@ -376,10 +378,12 b' def filemerge(repo, mynode, orig, fcd, f'
376 378 ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca))
377 379
378 380 markerstyle = ui.config('ui', 'mergemarkers', 'detailed')
379 labels = ['local', 'other']
380 381 if markerstyle == 'basic':
381 formattedlabels = labels
382 formattedlabels = _defaultconflictlabels
382 383 else:
384 if not labels:
385 labels = _defaultconflictlabels
386
383 387 formattedlabels = _formatlabels(repo, fcd, fco, labels)
384 388
385 389 needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf,
@@ -264,7 +264,7 b' class mergestate(object):'
264 264 if entry[0] == 'u':
265 265 yield f
266 266
267 def resolve(self, dfile, wctx):
267 def resolve(self, dfile, wctx, labels=None):
268 268 """rerun merge process for file path `dfile`"""
269 269 if self[dfile] == 'r':
270 270 return 0
@@ -287,7 +287,8 b' class mergestate(object):'
287 287 f = self._repo.opener("merge/" + hash)
288 288 self._repo.wwrite(dfile, f.read(), flags)
289 289 f.close()
290 r = filemerge.filemerge(self._repo, self._local, lfile, fcd, fco, fca)
290 r = filemerge.filemerge(self._repo, self._local, lfile, fcd, fco, fca,
291 labels=labels)
291 292 if r is None:
292 293 # no real conflict
293 294 del self._state[dfile]
@@ -629,7 +630,7 b' def batchget(repo, mctx, actions):'
629 630 if i > 0:
630 631 yield i, f
631 632
632 def applyupdates(repo, actions, wctx, mctx, overwrite):
633 def applyupdates(repo, actions, wctx, mctx, overwrite, labels=None):
633 634 """apply the merge action list to the working directory
634 635
635 636 wctx is the working copy context
@@ -734,7 +735,7 b' def applyupdates(repo, actions, wctx, mc'
734 735 overwrite)
735 736 continue
736 737 audit(f)
737 r = ms.resolve(f, wctx)
738 r = ms.resolve(f, wctx, labels=labels)
738 739 if r is not None and r > 0:
739 740 unresolved += 1
740 741 else:
@@ -990,7 +991,7 b' def recordupdates(repo, actions, branchm'
990 991 repo.dirstate.normal(f)
991 992
992 993 def update(repo, node, branchmerge, force, partial, ancestor=None,
993 mergeancestor=False):
994 mergeancestor=False, labels=None):
994 995 """
995 996 Perform a merge between the working directory and the given node
996 997
@@ -1170,7 +1171,7 b' def update(repo, node, branchmerge, forc'
1170 1171 # note that we're in the middle of an update
1171 1172 repo.vfs.write('updatestate', p2.hex())
1172 1173
1173 stats = applyupdates(repo, actions, wc, p2, overwrite)
1174 stats = applyupdates(repo, actions, wc, p2, overwrite, labels=labels)
1174 1175
1175 1176 if not partial:
1176 1177 repo.setparents(fp1, fp2)
General Comments 0
You need to be logged in to leave comments. Login now