mercurial/state.py
branchstable
changeset 49366 288de6f5d724
parent 48946 642e31cb55f0
child 49829 8ced4ca30ea1
equal deleted inserted replaced
49364:e8ea403b1c46 49366:288de6f5d724
    15 
    15 
    16 We store the data on disk in cbor, for which we use the CBOR format to encode
    16 We store the data on disk in cbor, for which we use the CBOR format to encode
    17 the data.
    17 the data.
    18 """
    18 """
    19 
    19 
    20 from __future__ import absolute_import
       
    21 
    20 
    22 import contextlib
    21 import contextlib
    23 
    22 
    24 from .i18n import _
    23 from .i18n import _
    25 
    24 
    38 
    37 
    39     for t in (Any, Dict):
    38     for t in (Any, Dict):
    40         assert t
    39         assert t
    41 
    40 
    42 
    41 
    43 class cmdstate(object):
    42 class cmdstate:
    44     """a wrapper class to store the state of commands like `rebase`, `graft`,
    43     """a wrapper class to store the state of commands like `rebase`, `graft`,
    45     `histedit`, `shelve` etc. Extensions can also use this to write state files.
    44     `histedit`, `shelve` etc. Extensions can also use this to write state files.
    46 
    45 
    47     All the data for the state is stored in the form of key-value pairs in a
    46     All the data for the state is stored in the form of key-value pairs in a
    48     dictionary.
    47     dictionary.
   101     def exists(self):
   100     def exists(self):
   102         """check whether the state file exists or not"""
   101         """check whether the state file exists or not"""
   103         return self._repo.vfs.exists(self.fname)
   102         return self._repo.vfs.exists(self.fname)
   104 
   103 
   105 
   104 
   106 class _statecheck(object):
   105 class _statecheck:
   107     """a utility class that deals with multistep operations like graft,
   106     """a utility class that deals with multistep operations like graft,
   108     histedit, bisect, update etc and check whether such commands
   107     histedit, bisect, update etc and check whether such commands
   109     are in an unfinished conditition or not and return appropriate message
   108     are in an unfinished conditition or not and return appropriate message
   110     and hint.
   109     and hint.
   111     It also has the ability to register and determine the states of any new
   110     It also has the ability to register and determine the states of any new