Mercurial > hg
comparison mercurial/bookmarks.py @ 33517:08bf0ebc6c8e
bookmark: deprecate direct set of a bookmark value
We want all bookmark update to go through 'applychanges', so lets deprecate
legacy ways of doing bookmark update.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 10 Jul 2017 21:47:34 +0200 |
parents | f9e6e43c7987 |
children | 712a85b3677f |
comparison
equal
deleted
inserted
replaced
33516:f9e6e43c7987 | 33517:08bf0ebc6c8e |
---|---|
100 | 100 |
101 self._active = mark | 101 self._active = mark |
102 self._aclean = False | 102 self._aclean = False |
103 | 103 |
104 def __setitem__(self, *args, **kwargs): | 104 def __setitem__(self, *args, **kwargs): |
105 msg = ("'bookmarks[name] = node' is deprecated, " | |
106 "use 'bookmarks.applychanges'") | |
107 self._repo.ui.deprecwarn(msg, '4.3') | |
108 self._set(*args, **kwargs) | |
109 | |
110 def _set(self, key, value): | |
105 self._clean = False | 111 self._clean = False |
106 return dict.__setitem__(self, *args, **kwargs) | 112 return dict.__setitem__(self, key, value) |
107 | 113 |
108 def __delitem__(self, key): | 114 def __delitem__(self, key): |
109 self._clean = False | 115 self._clean = False |
110 return dict.__delitem__(self, key) | 116 return dict.__delitem__(self, key) |
111 | 117 |
116 for name, node in changes: | 122 for name, node in changes: |
117 old = self.get(name) | 123 old = self.get(name) |
118 if node is None: | 124 if node is None: |
119 del self[name] | 125 del self[name] |
120 else: | 126 else: |
121 self[name] = node | 127 self._set(name, node) |
122 if bmchanges is not None: | 128 if bmchanges is not None: |
123 # if a previous value exist preserve the "initial" value | 129 # if a previous value exist preserve the "initial" value |
124 previous = bmchanges.get(name) | 130 previous = bmchanges.get(name) |
125 if previous is not None: | 131 if previous is not None: |
126 old = previous[0] | 132 old = previous[0] |