mercurial/dirstate.py
changeset 50022 e333cc169c45
parent 50021 4e955a7a6a55
child 50023 e1cff85484e2
equal deleted inserted replaced
50021:4e955a7a6a55 50022:e333cc169c45
    66         return obj._join(fname)
    66         return obj._join(fname)
    67 
    67 
    68 
    68 
    69 def requires_changing_parents(func):
    69 def requires_changing_parents(func):
    70     def wrap(self, *args, **kwargs):
    70     def wrap(self, *args, **kwargs):
    71         if not self.pendingparentchange():
    71         if not self.is_changing_parents:
    72             msg = 'calling `%s` outside of a changing_parents context'
    72             msg = 'calling `%s` outside of a changing_parents context'
    73             msg %= func.__name__
    73             msg %= func.__name__
    74             raise error.ProgrammingError(msg)
    74             raise error.ProgrammingError(msg)
    75         if self._invalidated_context:
    75         if self._invalidated_context:
    76             msg = 'calling `%s` after the dirstate was invalidated'
    76             msg = 'calling `%s` after the dirstate was invalidated'
    80     return wrap
    80     return wrap
    81 
    81 
    82 
    82 
    83 def requires_not_changing_parents(func):
    83 def requires_not_changing_parents(func):
    84     def wrap(self, *args, **kwargs):
    84     def wrap(self, *args, **kwargs):
    85         if self.pendingparentchange():
    85         if self.is_changing_parents:
    86             msg = 'calling `%s` inside of a changing_parents context'
    86             msg = 'calling `%s` inside of a changing_parents context'
    87             msg %= func.__name__
    87             msg %= func.__name__
    88             raise error.ProgrammingError(msg)
    88             raise error.ProgrammingError(msg)
    89         return func(self, *args, **kwargs)
    89         return func(self, *args, **kwargs)
    90 
    90 
   201             "`dirstate.changing_parents(repo)`"
   201             "`dirstate.changing_parents(repo)`"
   202         )
   202         )
   203         raise error.ProgrammingError(msg)
   203         raise error.ProgrammingError(msg)
   204 
   204 
   205     def pendingparentchange(self):
   205     def pendingparentchange(self):
       
   206         """Returns true if the dirstate is in the middle of a set of changes
       
   207         that modify the dirstate parent.
       
   208         """
       
   209         self._ui.deprecwarn(b"dirstate.is_changing_parents", b"6.5")
       
   210         return self.is_changing_parents
       
   211 
       
   212     @property
       
   213     def is_changing_parents(self):
   206         """Returns true if the dirstate is in the middle of a set of changes
   214         """Returns true if the dirstate is in the middle of a set of changes
   207         that modify the dirstate parent.
   215         that modify the dirstate parent.
   208         """
   216         """
   209         return self._changing_level > 0
   217         return self._changing_level > 0
   210 
   218