Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 35890:44bc37d20271
context: drop deprecated methods (API)
.. api::
The following deprecated methods have been removed from context, with
replacements:
- unstable() -> orphan()
- bumped() -> phasedivergent()
- divergent() -> contentdivergent()
- troubled() -> isunstable()
- troubles() -> instabilities()
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 02 Feb 2018 23:27:30 -0500 |
parents | f61461d2bfd8 |
children | 55e8efa2451a |
comparison
equal
deleted
inserted
replaced
35889:e49c39ffeac2 | 35890:44bc37d20271 |
---|---|
204 | 204 |
205 def extinct(self): | 205 def extinct(self): |
206 """True if the changeset is extinct""" | 206 """True if the changeset is extinct""" |
207 return self.rev() in obsmod.getrevs(self._repo, 'extinct') | 207 return self.rev() in obsmod.getrevs(self._repo, 'extinct') |
208 | 208 |
209 def unstable(self): | |
210 msg = ("'context.unstable' is deprecated, " | |
211 "use 'context.orphan'") | |
212 self._repo.ui.deprecwarn(msg, '4.4') | |
213 return self.orphan() | |
214 | |
215 def orphan(self): | 209 def orphan(self): |
216 """True if the changeset is not obsolete but it's ancestor are""" | 210 """True if the changeset is not obsolete but it's ancestor are""" |
217 return self.rev() in obsmod.getrevs(self._repo, 'orphan') | 211 return self.rev() in obsmod.getrevs(self._repo, 'orphan') |
218 | 212 |
219 def bumped(self): | |
220 msg = ("'context.bumped' is deprecated, " | |
221 "use 'context.phasedivergent'") | |
222 self._repo.ui.deprecwarn(msg, '4.4') | |
223 return self.phasedivergent() | |
224 | |
225 def phasedivergent(self): | 213 def phasedivergent(self): |
226 """True if the changeset try to be a successor of a public changeset | 214 """True if the changeset try to be a successor of a public changeset |
227 | 215 |
228 Only non-public and non-obsolete changesets may be bumped. | 216 Only non-public and non-obsolete changesets may be bumped. |
229 """ | 217 """ |
230 return self.rev() in obsmod.getrevs(self._repo, 'phasedivergent') | 218 return self.rev() in obsmod.getrevs(self._repo, 'phasedivergent') |
231 | 219 |
232 def divergent(self): | |
233 msg = ("'context.divergent' is deprecated, " | |
234 "use 'context.contentdivergent'") | |
235 self._repo.ui.deprecwarn(msg, '4.4') | |
236 return self.contentdivergent() | |
237 | |
238 def contentdivergent(self): | 220 def contentdivergent(self): |
239 """Is a successors of a changeset with multiple possible successors set | 221 """Is a successors of a changeset with multiple possible successors set |
240 | 222 |
241 Only non-public and non-obsolete changesets may be divergent. | 223 Only non-public and non-obsolete changesets may be divergent. |
242 """ | 224 """ |
243 return self.rev() in obsmod.getrevs(self._repo, 'contentdivergent') | 225 return self.rev() in obsmod.getrevs(self._repo, 'contentdivergent') |
244 | 226 |
245 def troubled(self): | |
246 msg = ("'context.troubled' is deprecated, " | |
247 "use 'context.isunstable'") | |
248 self._repo.ui.deprecwarn(msg, '4.4') | |
249 return self.isunstable() | |
250 | |
251 def isunstable(self): | 227 def isunstable(self): |
252 """True if the changeset is either unstable, bumped or divergent""" | 228 """True if the changeset is either unstable, bumped or divergent""" |
253 return self.orphan() or self.phasedivergent() or self.contentdivergent() | 229 return self.orphan() or self.phasedivergent() or self.contentdivergent() |
254 | |
255 def troubles(self): | |
256 """Keep the old version around in order to avoid breaking extensions | |
257 about different return values. | |
258 """ | |
259 msg = ("'context.troubles' is deprecated, " | |
260 "use 'context.instabilities'") | |
261 self._repo.ui.deprecwarn(msg, '4.4') | |
262 | |
263 troubles = [] | |
264 if self.orphan(): | |
265 troubles.append('orphan') | |
266 if self.phasedivergent(): | |
267 troubles.append('bumped') | |
268 if self.contentdivergent(): | |
269 troubles.append('divergent') | |
270 return troubles | |
271 | 230 |
272 def instabilities(self): | 231 def instabilities(self): |
273 """return the list of instabilities affecting this changeset. | 232 """return the list of instabilities affecting this changeset. |
274 | 233 |
275 Instabilities are returned as strings. possible values are: | 234 Instabilities are returned as strings. possible values are: |