##// END OF EJS Templates
dirstate: add a `in_merge` property...
marmoute -
r48299:94c58f3a default
parent child Browse files
Show More
@@ -337,6 +337,11 b' class dirstate(object):'
337 337 def p2(self):
338 338 return self._validate(self._pl[1])
339 339
340 @property
341 def in_merge(self):
342 """True if a merge is in progress"""
343 return self._pl[1] != self._nodeconstants.nullid
344
340 345 def branch(self):
341 346 return encoding.tolocal(self._branch)
342 347
@@ -513,7 +518,7 b' class dirstate(object):'
513 518
514 519 def normallookup(self, f):
515 520 '''Mark a file normal, but possibly dirty.'''
516 if self._pl[1] != self._nodeconstants.nullid:
521 if self.in_merge:
517 522 # if there is a merge going on and the file was either
518 523 # in state 'm' (-1) or coming from other parent (-2) before
519 524 # being removed, restore that state.
@@ -535,7 +540,7 b' class dirstate(object):'
535 540
536 541 def otherparent(self, f):
537 542 '''Mark as coming from the other parent, always dirty.'''
538 if self._pl[1] == self._nodeconstants.nullid:
543 if not self.in_merge:
539 544 msg = _(b"setting %r to other parent only allowed in merges") % f
540 545 raise error.Abort(msg)
541 546 if f in self and self[f] == b'n':
@@ -556,7 +561,7 b' class dirstate(object):'
556 561 self._dirty = True
557 562 oldstate = self[f]
558 563 size = 0
559 if self._pl[1] != self._nodeconstants.nullid:
564 if self.in_merge:
560 565 entry = self._map.get(f)
561 566 if entry is not None:
562 567 # backup the previous state
@@ -572,7 +577,7 b' class dirstate(object):'
572 577
573 578 def merge(self, f):
574 579 '''Mark a file merged.'''
575 if self._pl[1] == self._nodeconstants.nullid:
580 if not self.in_merge:
576 581 return self.normallookup(f)
577 582 return self.otherparent(f)
578 583
General Comments 0
You need to be logged in to leave comments. Login now