##// 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 def recordupdates(repo, actions, branchmerge, getfiledata):
781 def recordupdates(repo, actions, branchmerge, getfiledata):
782 """record merge actions to the dirstate"""
782 """record merge actions to the dirstate"""
783 dirstate = repo.dirstate
784 update_file = dirstate.update_file
785
783 # remove (must come first)
786 # remove (must come first)
784 for f, args, msg in actions.get(ACTION_REMOVE, []):
787 for f, args, msg in actions.get(ACTION_REMOVE, []):
785 if branchmerge:
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 else:
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 # forget (must come first)
793 # forget (must come first)
791 for f, args, msg in actions.get(ACTION_FORGET, []):
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 # resolve path conflicts
797 # resolve path conflicts
795 for f, args, msg in actions.get(ACTION_PATH_CONFLICT_RESOLVE, []):
798 for f, args, msg in actions.get(ACTION_PATH_CONFLICT_RESOLVE, []):
796 (f0, origf0) = args
799 (f0, origf0) = args
797 repo.dirstate.update_file(f, p1_tracked=False, wc_tracked=True)
800 update_file(f, p1_tracked=False, wc_tracked=True)
798 repo.dirstate.copy(origf0, f)
801 dirstate.copy(origf0, f)
799 if f0 == origf0:
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 else:
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 # re-add
807 # re-add
805 for f, args, msg in actions.get(ACTION_ADD, []):
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 # re-add/mark as modified
811 # re-add/mark as modified
809 for f, args, msg in actions.get(ACTION_ADD_MODIFIED, []):
812 for f, args, msg in actions.get(ACTION_ADD_MODIFIED, []):
810 if branchmerge:
813 if branchmerge:
811 repo.dirstate.update_file(
814 update_file(
812 f, p1_tracked=True, wc_tracked=True, possibly_dirty=True
815 f, p1_tracked=True, wc_tracked=True, possibly_dirty=True
813 )
816 )
814 else:
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 # exec change
820 # exec change
818 for f, args, msg in actions.get(ACTION_EXEC, []):
821 for f, args, msg in actions.get(ACTION_EXEC, []):
819 repo.dirstate.update_file(
822 update_file(f, p1_tracked=True, wc_tracked=True, possibly_dirty=True)
820 f, p1_tracked=True, wc_tracked=True, possibly_dirty=True
821 )
822
823
823 # keep
824 # keep
824 for f, args, msg in actions.get(ACTION_KEEP, []):
825 for f, args, msg in actions.get(ACTION_KEEP, []):
@@ -836,9 +837,9 b' def recordupdates(repo, actions, branchm'
836 for f, args, msg in actions.get(ACTION_GET, []):
837 for f, args, msg in actions.get(ACTION_GET, []):
837 if branchmerge:
838 if branchmerge:
838 # tracked in p1 can be True also but update_file should not care
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 p1_tracked = old_entry.any_tracked and not old_entry.added
841 p1_tracked = old_entry.any_tracked and not old_entry.added
841 repo.dirstate.update_file(
842 update_file(
842 f,
843 f,
843 p1_tracked=p1_tracked,
844 p1_tracked=p1_tracked,
844 wc_tracked=True,
845 wc_tracked=True,
@@ -846,7 +847,7 b' def recordupdates(repo, actions, branchm'
846 )
847 )
847 else:
848 else:
848 parentfiledata = getfiledata[f] if getfiledata else None
849 parentfiledata = getfiledata[f] if getfiledata else None
849 repo.dirstate.update_file(
850 update_file(
850 f,
851 f,
851 p1_tracked=True,
852 p1_tracked=True,
852 wc_tracked=True,
853 wc_tracked=True,
@@ -860,7 +861,7 b' def recordupdates(repo, actions, branchm'
860 # We've done a branch merge, mark this file as merged
861 # We've done a branch merge, mark this file as merged
861 # so that we properly record the merger later
862 # so that we properly record the merger later
862 p1_tracked = f1 == f
863 p1_tracked = f1 == f
863 repo.dirstate.update_file(
864 update_file(
864 f,
865 f,
865 p1_tracked=p1_tracked,
866 p1_tracked=p1_tracked,
866 wc_tracked=True,
867 wc_tracked=True,
@@ -868,13 +869,11 b' def recordupdates(repo, actions, branchm'
868 )
869 )
869 if f1 != f2: # copy/rename
870 if f1 != f2: # copy/rename
870 if move:
871 if move:
871 repo.dirstate.update_file(
872 update_file(f1, p1_tracked=True, wc_tracked=False)
872 f1, p1_tracked=True, wc_tracked=False
873 )
874 if f1 != f:
873 if f1 != f:
875 repo.dirstate.copy(f1, f)
874 dirstate.copy(f1, f)
876 else:
875 else:
877 repo.dirstate.copy(f2, f)
876 dirstate.copy(f2, f)
878 else:
877 else:
879 # We've update-merged a locally modified file, so
878 # We've update-merged a locally modified file, so
880 # we set the dirstate to emulate a normal checkout
879 # we set the dirstate to emulate a normal checkout
@@ -882,30 +881,28 b' def recordupdates(repo, actions, branchm'
882 # merge will appear as a normal local file
881 # merge will appear as a normal local file
883 # modification.
882 # modification.
884 if f2 == f: # file not locally copied/moved
883 if f2 == f: # file not locally copied/moved
885 repo.dirstate.update_file(
884 update_file(
886 f, p1_tracked=True, wc_tracked=True, possibly_dirty=True
885 f, p1_tracked=True, wc_tracked=True, possibly_dirty=True
887 )
886 )
888 if move:
887 if move:
889 repo.dirstate.update_file(
888 update_file(f1, p1_tracked=False, wc_tracked=False)
890 f1, p1_tracked=False, wc_tracked=False
891 )
892
889
893 # directory rename, move local
890 # directory rename, move local
894 for f, args, msg in actions.get(ACTION_DIR_RENAME_MOVE_LOCAL, []):
891 for f, args, msg in actions.get(ACTION_DIR_RENAME_MOVE_LOCAL, []):
895 f0, flag = args
892 f0, flag = args
896 if branchmerge:
893 if branchmerge:
897 repo.dirstate.update_file(f, p1_tracked=False, wc_tracked=True)
894 update_file(f, p1_tracked=False, wc_tracked=True)
898 repo.dirstate.update_file(f0, p1_tracked=True, wc_tracked=False)
895 update_file(f0, p1_tracked=True, wc_tracked=False)
899 repo.dirstate.copy(f0, f)
896 dirstate.copy(f0, f)
900 else:
897 else:
901 repo.dirstate.update_file(f, p1_tracked=True, wc_tracked=True)
898 update_file(f, p1_tracked=True, wc_tracked=True)
902 repo.dirstate.update_file(f0, p1_tracked=False, wc_tracked=False)
899 update_file(f0, p1_tracked=False, wc_tracked=False)
903
900
904 # directory rename, get
901 # directory rename, get
905 for f, args, msg in actions.get(ACTION_LOCAL_DIR_RENAME_GET, []):
902 for f, args, msg in actions.get(ACTION_LOCAL_DIR_RENAME_GET, []):
906 f0, flag = args
903 f0, flag = args
907 if branchmerge:
904 if branchmerge:
908 repo.dirstate.update_file(f, p1_tracked=False, wc_tracked=True)
905 update_file(f, p1_tracked=False, wc_tracked=True)
909 repo.dirstate.copy(f0, f)
906 dirstate.copy(f0, f)
910 else:
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