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