Mercurial > hg
comparison mercurial/mergestate.py @ 45165:01c4dccfd6b5
mergestate: rename a helpless variable name to bit helpful one
The old variable name `r` makes it ~impossible to understand what does it mean.
One can only understand that after going to callers and hoping that its
documented there.
I also documented return value of the function involved while I was there.
Differential Revision: https://phab.mercurial-scm.org/D8738
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Thu, 09 Jul 2020 18:38:09 +0530 |
parents | 7f41e824a02b |
children | a5be403dd7a0 |
comparison
equal
deleted
inserted
replaced
45164:7f41e824a02b | 45165:01c4dccfd6b5 |
---|---|
617 | 617 |
618 def extras(self, filename): | 618 def extras(self, filename): |
619 return self._stateextras.setdefault(filename, {}) | 619 return self._stateextras.setdefault(filename, {}) |
620 | 620 |
621 def _resolve(self, preresolve, dfile, wctx): | 621 def _resolve(self, preresolve, dfile, wctx): |
622 """rerun merge process for file path `dfile`""" | 622 """rerun merge process for file path `dfile`. |
623 Returns whether the merge was completed and the return value of merge | |
624 obtained from filemerge._filemerge(). | |
625 """ | |
623 if self[dfile] in (MERGE_RECORD_RESOLVED, MERGE_RECORD_DRIVER_RESOLVED): | 626 if self[dfile] in (MERGE_RECORD_RESOLVED, MERGE_RECORD_DRIVER_RESOLVED): |
624 return True, 0 | 627 return True, 0 |
625 if self._state[dfile][0] == MERGE_RECORD_MERGED_OTHER: | 628 if self._state[dfile][0] == MERGE_RECORD_MERGED_OTHER: |
626 return True, 0 | 629 return True, 0 |
627 stateentry = self._state[dfile] | 630 stateentry = self._state[dfile] |
658 f = self._repo.vfs(b'merge/' + localkey) | 661 f = self._repo.vfs(b'merge/' + localkey) |
659 wctx[dfile].write(f.read(), flags) | 662 wctx[dfile].write(f.read(), flags) |
660 f.close() | 663 f.close() |
661 else: | 664 else: |
662 wctx[dfile].remove(ignoremissing=True) | 665 wctx[dfile].remove(ignoremissing=True) |
663 complete, r, deleted = filemerge.premerge( | 666 complete, merge_ret, deleted = filemerge.premerge( |
664 self._repo, | 667 self._repo, |
665 wctx, | 668 wctx, |
666 self._local, | 669 self._local, |
667 lfile, | 670 lfile, |
668 fcd, | 671 fcd, |
669 fco, | 672 fco, |
670 fca, | 673 fca, |
671 labels=self._labels, | 674 labels=self._labels, |
672 ) | 675 ) |
673 else: | 676 else: |
674 complete, r, deleted = filemerge.filemerge( | 677 complete, merge_ret, deleted = filemerge.filemerge( |
675 self._repo, | 678 self._repo, |
676 wctx, | 679 wctx, |
677 self._local, | 680 self._local, |
678 lfile, | 681 lfile, |
679 fcd, | 682 fcd, |
680 fco, | 683 fco, |
681 fca, | 684 fca, |
682 labels=self._labels, | 685 labels=self._labels, |
683 ) | 686 ) |
684 if r is None: | 687 if merge_ret is None: |
685 # no real conflict | 688 # If return value of merge is None, then there are no real conflict |
686 del self._state[dfile] | 689 del self._state[dfile] |
687 self._stateextras.pop(dfile, None) | 690 self._stateextras.pop(dfile, None) |
688 self._dirty = True | 691 self._dirty = True |
689 elif not r: | 692 elif not merge_ret: |
690 self.mark(dfile, MERGE_RECORD_RESOLVED) | 693 self.mark(dfile, MERGE_RECORD_RESOLVED) |
691 | 694 |
692 if complete: | 695 if complete: |
693 action = None | 696 action = None |
694 if deleted: | 697 if deleted: |
706 if dfile in self.localctx: | 709 if dfile in self.localctx: |
707 action = ACTION_ADD_MODIFIED | 710 action = ACTION_ADD_MODIFIED |
708 else: | 711 else: |
709 action = ACTION_ADD | 712 action = ACTION_ADD |
710 # else: regular merges (no action necessary) | 713 # else: regular merges (no action necessary) |
711 self._results[dfile] = r, action | 714 self._results[dfile] = merge_ret, action |
712 | 715 |
713 return complete, r | 716 return complete, merge_ret |
714 | 717 |
715 def preresolve(self, dfile, wctx): | 718 def preresolve(self, dfile, wctx): |
716 """run premerge process for dfile | 719 """run premerge process for dfile |
717 | 720 |
718 Returns whether the merge is complete, and the exit code.""" | 721 Returns whether the merge is complete, and the exit code.""" |