##// END OF EJS Templates
mergestate: reduce the number of attribute lookups...
Raphaël Gomès -
r52925:09a54892 default
parent child Browse files
Show More
@@ -780,45 +780,46 b' class memmergestate(_mergestate_base):'
780 780
781 781 def recordupdates(repo, actions, branchmerge, getfiledata):
782 782 """record merge actions to the dirstate"""
783 dirstate = repo.dirstate
784 update_file = dirstate.update_file
785
783 786 # remove (must come first)
784 787 for f, args, msg in actions.get(ACTION_REMOVE, []):
785 788 if branchmerge:
786 repo.dirstate.update_file(f, p1_tracked=True, wc_tracked=False)
789 update_file(f, p1_tracked=True, wc_tracked=False)
787 790 else:
788 repo.dirstate.update_file(f, p1_tracked=False, wc_tracked=False)
791 update_file(f, p1_tracked=False, wc_tracked=False)
789 792
790 793 # forget (must come first)
791 794 for f, args, msg in actions.get(ACTION_FORGET, []):
792 repo.dirstate.update_file(f, p1_tracked=False, wc_tracked=False)
795 update_file(f, p1_tracked=False, wc_tracked=False)
793 796
794 797 # resolve path conflicts
795 798 for f, args, msg in actions.get(ACTION_PATH_CONFLICT_RESOLVE, []):
796 799 (f0, origf0) = args
797 repo.dirstate.update_file(f, p1_tracked=False, wc_tracked=True)
798 repo.dirstate.copy(origf0, f)
800 update_file(f, p1_tracked=False, wc_tracked=True)
801 dirstate.copy(origf0, f)
799 802 if f0 == origf0:
800 repo.dirstate.update_file(f0, p1_tracked=True, wc_tracked=False)
803 update_file(f0, p1_tracked=True, wc_tracked=False)
801 804 else:
802 repo.dirstate.update_file(f0, p1_tracked=False, wc_tracked=False)
805 update_file(f0, p1_tracked=False, wc_tracked=False)
803 806
804 807 # re-add
805 808 for f, args, msg in actions.get(ACTION_ADD, []):
806 repo.dirstate.update_file(f, p1_tracked=False, wc_tracked=True)
809 update_file(f, p1_tracked=False, wc_tracked=True)
807 810
808 811 # re-add/mark as modified
809 812 for f, args, msg in actions.get(ACTION_ADD_MODIFIED, []):
810 813 if branchmerge:
811 repo.dirstate.update_file(
814 update_file(
812 815 f, p1_tracked=True, wc_tracked=True, possibly_dirty=True
813 816 )
814 817 else:
815 repo.dirstate.update_file(f, p1_tracked=False, wc_tracked=True)
818 update_file(f, p1_tracked=False, wc_tracked=True)
816 819
817 820 # exec change
818 821 for f, args, msg in actions.get(ACTION_EXEC, []):
819 repo.dirstate.update_file(
820 f, p1_tracked=True, wc_tracked=True, possibly_dirty=True
821 )
822 update_file(f, p1_tracked=True, wc_tracked=True, possibly_dirty=True)
822 823
823 824 # keep
824 825 for f, args, msg in actions.get(ACTION_KEEP, []):
@@ -836,9 +837,9 b' def recordupdates(repo, actions, branchm'
836 837 for f, args, msg in actions.get(ACTION_GET, []):
837 838 if branchmerge:
838 839 # tracked in p1 can be True also but update_file should not care
839 old_entry = repo.dirstate.get_entry(f)
840 old_entry = dirstate.get_entry(f)
840 841 p1_tracked = old_entry.any_tracked and not old_entry.added
841 repo.dirstate.update_file(
842 update_file(
842 843 f,
843 844 p1_tracked=p1_tracked,
844 845 wc_tracked=True,
@@ -846,7 +847,7 b' def recordupdates(repo, actions, branchm'
846 847 )
847 848 else:
848 849 parentfiledata = getfiledata[f] if getfiledata else None
849 repo.dirstate.update_file(
850 update_file(
850 851 f,
851 852 p1_tracked=True,
852 853 wc_tracked=True,
@@ -860,7 +861,7 b' def recordupdates(repo, actions, branchm'
860 861 # We've done a branch merge, mark this file as merged
861 862 # so that we properly record the merger later
862 863 p1_tracked = f1 == f
863 repo.dirstate.update_file(
864 update_file(
864 865 f,
865 866 p1_tracked=p1_tracked,
866 867 wc_tracked=True,
@@ -868,13 +869,11 b' def recordupdates(repo, actions, branchm'
868 869 )
869 870 if f1 != f2: # copy/rename
870 871 if move:
871 repo.dirstate.update_file(
872 f1, p1_tracked=True, wc_tracked=False
873 )
872 update_file(f1, p1_tracked=True, wc_tracked=False)
874 873 if f1 != f:
875 repo.dirstate.copy(f1, f)
874 dirstate.copy(f1, f)
876 875 else:
877 repo.dirstate.copy(f2, f)
876 dirstate.copy(f2, f)
878 877 else:
879 878 # We've update-merged a locally modified file, so
880 879 # we set the dirstate to emulate a normal checkout
@@ -882,30 +881,28 b' def recordupdates(repo, actions, branchm'
882 881 # merge will appear as a normal local file
883 882 # modification.
884 883 if f2 == f: # file not locally copied/moved
885 repo.dirstate.update_file(
884 update_file(
886 885 f, p1_tracked=True, wc_tracked=True, possibly_dirty=True
887 886 )
888 887 if move:
889 repo.dirstate.update_file(
890 f1, p1_tracked=False, wc_tracked=False
891 )
888 update_file(f1, p1_tracked=False, wc_tracked=False)
892 889
893 890 # directory rename, move local
894 891 for f, args, msg in actions.get(ACTION_DIR_RENAME_MOVE_LOCAL, []):
895 892 f0, flag = args
896 893 if branchmerge:
897 repo.dirstate.update_file(f, p1_tracked=False, wc_tracked=True)
898 repo.dirstate.update_file(f0, p1_tracked=True, wc_tracked=False)
899 repo.dirstate.copy(f0, f)
894 update_file(f, p1_tracked=False, wc_tracked=True)
895 update_file(f0, p1_tracked=True, wc_tracked=False)
896 dirstate.copy(f0, f)
900 897 else:
901 repo.dirstate.update_file(f, p1_tracked=True, wc_tracked=True)
902 repo.dirstate.update_file(f0, p1_tracked=False, wc_tracked=False)
898 update_file(f, p1_tracked=True, wc_tracked=True)
899 update_file(f0, p1_tracked=False, wc_tracked=False)
903 900
904 901 # directory rename, get
905 902 for f, args, msg in actions.get(ACTION_LOCAL_DIR_RENAME_GET, []):
906 903 f0, flag = args
907 904 if branchmerge:
908 repo.dirstate.update_file(f, p1_tracked=False, wc_tracked=True)
909 repo.dirstate.copy(f0, f)
905 update_file(f, p1_tracked=False, wc_tracked=True)
906 dirstate.copy(f0, f)
910 907 else:
911 repo.dirstate.update_file(f, p1_tracked=True, wc_tracked=True)
908 update_file(f, p1_tracked=True, wc_tracked=True)
General Comments 0
You need to be logged in to leave comments. Login now