comparison mercurial/merge.py @ 21524:47b97d9af27e

merge: add labels parameter from merge.update to filemerge Adds a labels function parameter to all the functions between merge.update and filemerge.filemerge. This will allow commands like rebase to specify custom marker labels.
author Durham Goode <durham@fb.com>
date Thu, 08 May 2014 16:54:23 -0700
parents b1ce47dadbdf
children 43eecb4e23f8
comparison
equal deleted inserted replaced
21523:9fb6f328576a 21524:47b97d9af27e
262 262
263 for f, entry in self._state.items(): 263 for f, entry in self._state.items():
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
271 stateentry = self._state[dfile] 271 stateentry = self._state[dfile]
272 state, hash, lfile, afile, anode, ofile, onode, flags = stateentry 272 state, hash, lfile, afile, anode, ofile, onode, flags = stateentry
285 flags = flo 285 flags = flo
286 # restore local 286 # restore local
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]
294 self._dirty = True 295 self._dirty = True
295 elif not r: 296 elif not r:
627 i = 0 628 i = 0
628 i += 1 629 i += 1
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
636 mctx is the context to be merged into the working copy 637 mctx is the context to be merged into the working copy
637 638
732 if f == '.hgsubstate': # subrepo states need updating 733 if f == '.hgsubstate': # subrepo states need updating
733 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), 734 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx),
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:
741 if r is None: 742 if r is None:
742 updated += 1 743 updated += 1
988 repo.dirstate.copy(f0, f) 989 repo.dirstate.copy(f0, f)
989 else: 990 else:
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
997 node = the node to update to, or None if unspecified 998 node = the node to update to, or None if unspecified
998 branchmerge = whether to merge between branches 999 branchmerge = whether to merge between branches
1168 if not partial: 1169 if not partial:
1169 repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) 1170 repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2)
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)
1177 recordupdates(repo, actions, branchmerge) 1178 recordupdates(repo, actions, branchmerge)
1178 # update completed, clear state 1179 # update completed, clear state