Mercurial > public > mercurial-scm > hg
comparison mercurial/state.py @ 43702:127d46468a45
state: add a pytype annotation
Differential Revision: https://phab.mercurial-scm.org/D7383
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 13 Nov 2019 22:22:49 -0500 |
parents | 8ff1ecfadcd1 |
children | 7b14d649af1b |
comparison
equal
deleted
inserted
replaced
43701:c9301ac73b95 | 43702:127d46468a45 |
---|---|
25 error, | 25 error, |
26 util, | 26 util, |
27 ) | 27 ) |
28 from .utils import cborutil | 28 from .utils import cborutil |
29 | 29 |
30 if not globals(): | |
31 from typing import ( | |
32 Any, | |
33 Dict, | |
34 ) | |
35 | |
36 for t in (Any, Dict): | |
37 assert t | |
38 | |
30 | 39 |
31 class cmdstate(object): | 40 class cmdstate(object): |
32 """a wrapper class to store the state of commands like `rebase`, `graft`, | 41 """a wrapper class to store the state of commands like `rebase`, `graft`, |
33 `histedit`, `shelve` etc. Extensions can also use this to write state files. | 42 `histedit`, `shelve` etc. Extensions can also use this to write state files. |
34 | 43 |
48 """ | 57 """ |
49 self._repo = repo | 58 self._repo = repo |
50 self.fname = fname | 59 self.fname = fname |
51 | 60 |
52 def read(self): | 61 def read(self): |
62 # type: () -> Dict[bytes, Any] | |
53 """read the existing state file and return a dict of data stored""" | 63 """read the existing state file and return a dict of data stored""" |
54 return self._read() | 64 return self._read() |
55 | 65 |
56 def save(self, version, data): | 66 def save(self, version, data): |
57 """write all the state data stored to .hg/<filename> file | 67 """write all the state data stored to .hg/<filename> file |