comparison mercurial/merge.py @ 27090:ef6f98473a48

mergestate: add methods to queue files to remove, add or get These are meant for use by custom merge drivers that might want to modify the dirstate. Dirstate internal consistency rules require that all removes happen before any adds -- this means that custom merge drivers shouldn't be modifying the dirstate directly.
author Siddharth Agarwal <sid0@fb.com>
date Sun, 22 Nov 2015 21:59:52 -0800
parents e2b79f57903a
children 2ce00de5cc0e
comparison
equal deleted inserted replaced
27089:dbb30bc16fc2 27090:ef6f98473a48
519 519
520 def recordactions(self): 520 def recordactions(self):
521 """record remove/add/get actions in the dirstate""" 521 """record remove/add/get actions in the dirstate"""
522 branchmerge = self._repo.dirstate.p2() != nullid 522 branchmerge = self._repo.dirstate.p2() != nullid
523 recordupdates(self._repo, self.actions(), branchmerge) 523 recordupdates(self._repo, self.actions(), branchmerge)
524
525 def queueremove(self, f):
526 """queues a file to be removed from the dirstate
527
528 Meant for use by custom merge drivers."""
529 self._results[f] = 0, 'r'
530
531 def queueadd(self, f):
532 """queues a file to be added to the dirstate
533
534 Meant for use by custom merge drivers."""
535 self._results[f] = 0, 'a'
536
537 def queueget(self, f):
538 """queues a file to be marked modified in the dirstate
539
540 Meant for use by custom merge drivers."""
541 self._results[f] = 0, 'g'
524 542
525 def _checkunknownfile(repo, wctx, mctx, f, f2=None): 543 def _checkunknownfile(repo, wctx, mctx, f, f2=None):
526 if f2 is None: 544 if f2 is None:
527 f2 = f 545 f2 = f
528 return (os.path.isfile(repo.wjoin(f)) 546 return (os.path.isfile(repo.wjoin(f))