mercurial/mergestate.py
changeset 48714 c5f05c0d1c8c
parent 48713 5dfaca4464d1
child 48715 7d073df49a54
equal deleted inserted replaced
48713:5dfaca4464d1 48714:c5f05c0d1c8c
   105     Attributes:
   105     Attributes:
   106 
   106 
   107     _short: internal representation used to identify each action
   107     _short: internal representation used to identify each action
   108 
   108 
   109     no_op:  True if the action does affect the file content or tracking status
   109     no_op:  True if the action does affect the file content or tracking status
       
   110 
       
   111     narrow_safe:
       
   112         True if the action can be safely used for a file outside of the narrow
       
   113         set
   110     """
   114     """
   111 
   115 
   112     ALL_ACTIONS = weakref.WeakSet()
   116     ALL_ACTIONS = weakref.WeakSet()
   113     NO_OP_ACTIONS = weakref.WeakSet()
   117     NO_OP_ACTIONS = weakref.WeakSet()
   114 
   118 
   115     def __init__(self, short, no_op=False):
   119     def __init__(self, short, no_op=False, narrow_safe=False):
   116         self._short = short
   120         self._short = short
   117         self.ALL_ACTIONS.add(self)
   121         self.ALL_ACTIONS.add(self)
   118         self.no_op = no_op
   122         self.no_op = no_op
   119         if self.no_op:
   123         if self.no_op:
   120             self.NO_OP_ACTIONS.add(self)
   124             self.NO_OP_ACTIONS.add(self)
       
   125         self.narrow_safe = narrow_safe
   121 
   126 
   122     def __hash__(self):
   127     def __hash__(self):
   123         return hash(self._short)
   128         return hash(self._short)
   124 
   129 
   125     def __repr__(self):
   130     def __repr__(self):
   136 
   141 
   137     def __lt__(self, other):
   142     def __lt__(self, other):
   138         return self._short < other._short
   143         return self._short < other._short
   139 
   144 
   140 
   145 
   141 ACTION_FORGET = MergeAction(b'f')
   146 ACTION_FORGET = MergeAction(b'f', narrow_safe=True)
   142 ACTION_REMOVE = MergeAction(b'r')
   147 ACTION_REMOVE = MergeAction(b'r', narrow_safe=True)
   143 ACTION_ADD = MergeAction(b'a')
   148 ACTION_ADD = MergeAction(b'a', narrow_safe=True)
   144 ACTION_GET = MergeAction(b'g')
   149 ACTION_GET = MergeAction(b'g', narrow_safe=True)
   145 ACTION_PATH_CONFLICT = MergeAction(b'p')
   150 ACTION_PATH_CONFLICT = MergeAction(b'p')
   146 ACTION_PATH_CONFLICT_RESOLVE = MergeAction('pr')
   151 ACTION_PATH_CONFLICT_RESOLVE = MergeAction('pr')
   147 ACTION_ADD_MODIFIED = MergeAction(b'am')
   152 ACTION_ADD_MODIFIED = MergeAction(b'am', narrow_safe=True)
   148 ACTION_CREATED = MergeAction(b'c')
   153 ACTION_CREATED = MergeAction(b'c', narrow_safe=True)
   149 ACTION_DELETED_CHANGED = MergeAction(b'dc')
   154 ACTION_DELETED_CHANGED = MergeAction(b'dc')
   150 ACTION_CHANGED_DELETED = MergeAction(b'cd')
   155 ACTION_CHANGED_DELETED = MergeAction(b'cd')
   151 ACTION_MERGE = MergeAction(b'm')
   156 ACTION_MERGE = MergeAction(b'm')
   152 ACTION_LOCAL_DIR_RENAME_GET = MergeAction(b'dg')
   157 ACTION_LOCAL_DIR_RENAME_GET = MergeAction(b'dg')
   153 ACTION_DIR_RENAME_MOVE_LOCAL = MergeAction(b'dm')
   158 ACTION_DIR_RENAME_MOVE_LOCAL = MergeAction(b'dm')
   157 # of file deletion, rename etc.)
   162 # of file deletion, rename etc.)
   158 ACTION_KEEP_ABSENT = MergeAction(b'ka', no_op=True)
   163 ACTION_KEEP_ABSENT = MergeAction(b'ka', no_op=True)
   159 # the file is absent on the ancestor and remote side of the merge
   164 # the file is absent on the ancestor and remote side of the merge
   160 # hence this file is new and we should keep it
   165 # hence this file is new and we should keep it
   161 ACTION_KEEP_NEW = MergeAction(b'kn', no_op=True)
   166 ACTION_KEEP_NEW = MergeAction(b'kn', no_op=True)
   162 ACTION_EXEC = MergeAction(b'e')
   167 ACTION_EXEC = MergeAction(b'e', narrow_safe=True)
   163 ACTION_CREATED_MERGE = MergeAction(b'cm')
   168 ACTION_CREATED_MERGE = MergeAction(b'cm', narrow_safe=True)
   164 
   169 
   165 
   170 
   166 # Used by concert to detect situation it does not like, not sure what the exact
   171 # Used by concert to detect situation it does not like, not sure what the exact
   167 # criteria is
   172 # criteria is
   168 CONVERT_MERGE_ACTIONS = (
   173 CONVERT_MERGE_ACTIONS = (