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