equal
deleted
inserted
replaced
353 return encoding.tolocal(self._branch) |
353 return encoding.tolocal(self._branch) |
354 |
354 |
355 def setparents(self, p1, p2=None): |
355 def setparents(self, p1, p2=None): |
356 """Set dirstate parents to p1 and p2. |
356 """Set dirstate parents to p1 and p2. |
357 |
357 |
358 When moving from two parents to one, 'm' merged entries a |
358 When moving from two parents to one, "merged" entries a |
359 adjusted to normal and previous copy records discarded and |
359 adjusted to normal and previous copy records discarded and |
360 returned by the call. |
360 returned by the call. |
361 |
361 |
362 See localrepo.setparents() |
362 See localrepo.setparents() |
363 """ |
363 """ |
384 for f in candidatefiles: |
384 for f in candidatefiles: |
385 s = self._map.get(f) |
385 s = self._map.get(f) |
386 if s is None: |
386 if s is None: |
387 continue |
387 continue |
388 |
388 |
389 # Discard 'm' markers when moving away from a merge state |
389 # Discard "merged" markers when moving away from a merge state |
390 if s.state == b'm': |
390 if s.merged: |
391 source = self._map.copymap.get(f) |
391 source = self._map.copymap.get(f) |
392 if source: |
392 if source: |
393 copies[f] = source |
393 copies[f] = source |
394 self.normallookup(f) |
394 self.normallookup(f) |
395 # Also fix up otherparent markers |
395 # Also fix up otherparent markers |
525 |
525 |
526 def normallookup(self, f): |
526 def normallookup(self, f): |
527 '''Mark a file normal, but possibly dirty.''' |
527 '''Mark a file normal, but possibly dirty.''' |
528 if self.in_merge: |
528 if self.in_merge: |
529 # if there is a merge going on and the file was either |
529 # if there is a merge going on and the file was either |
530 # in state 'm' (-1) or coming from other parent (-2) before |
530 # "merged" or coming from other parent (-2) before |
531 # being removed, restore that state. |
531 # being removed, restore that state. |
532 entry = self._map.get(f) |
532 entry = self._map.get(f) |
533 if entry is not None: |
533 if entry is not None: |
534 if entry.state == b'r' and entry[2] in (NONNORMAL, FROM_P2): |
534 if entry.state == b'r' and entry[2] in (NONNORMAL, FROM_P2): |
535 source = self._map.copymap.get(f) |
535 source = self._map.copymap.get(f) |
538 elif entry[2] == FROM_P2: |
538 elif entry[2] == FROM_P2: |
539 self.otherparent(f) |
539 self.otherparent(f) |
540 if source: |
540 if source: |
541 self.copy(source, f) |
541 self.copy(source, f) |
542 return |
542 return |
543 if ( |
543 if entry.merged or entry.state == b'n' and entry[2] == FROM_P2: |
544 entry.state == b'm' |
|
545 or entry.state == b'n' |
|
546 and entry[2] == FROM_P2 |
|
547 ): |
|
548 return |
544 return |
549 self._addpath(f, b'n', 0, possibly_dirty=True) |
545 self._addpath(f, b'n', 0, possibly_dirty=True) |
550 self._map.copymap.pop(f, None) |
546 self._map.copymap.pop(f, None) |
551 |
547 |
552 def otherparent(self, f): |
548 def otherparent(self, f): |
1360 # This can happen if we quickly do multiple commits. |
1356 # This can happen if we quickly do multiple commits. |
1361 # Force lookup, so we don't miss such a racy file change. |
1357 # Force lookup, so we don't miss such a racy file change. |
1362 ladd(fn) |
1358 ladd(fn) |
1363 elif listclean: |
1359 elif listclean: |
1364 cadd(fn) |
1360 cadd(fn) |
1365 elif state == b'm': |
1361 elif t.merged: |
1366 madd(fn) |
1362 madd(fn) |
1367 elif state == b'a': |
1363 elif state == b'a': |
1368 aadd(fn) |
1364 aadd(fn) |
1369 elif state == b'r': |
1365 elif state == b'r': |
1370 radd(fn) |
1366 radd(fn) |