comparison mercurial/context.py @ 19734:e61c6138fa33

context: move evolution functions from changectx to basectx This is just a code move and corrects an overlook from my previous patch series that assumed only a changectx would want this functionality.
author Sean Farley <sean.michael.farley@gmail.com>
date Tue, 17 Sep 2013 23:34:57 -0500
parents 51988f008df3
children 7c21e3398931
comparison
equal deleted inserted replaced
19733:51988f008df3 19734:e61c6138fa33
77 return self._manifest 77 return self._manifest
78 def phasestr(self): 78 def phasestr(self):
79 return phases.phasenames[self.phase()] 79 return phases.phasenames[self.phase()]
80 def mutable(self): 80 def mutable(self):
81 return self.phase() > phases.public 81 return self.phase() > phases.public
82
83 def obsolete(self):
84 """True if the changeset is obsolete"""
85 return self.rev() in obsmod.getrevs(self._repo, 'obsolete')
86
87 def extinct(self):
88 """True if the changeset is extinct"""
89 return self.rev() in obsmod.getrevs(self._repo, 'extinct')
90
91 def unstable(self):
92 """True if the changeset is not obsolete but it's ancestor are"""
93 return self.rev() in obsmod.getrevs(self._repo, 'unstable')
94
95 def bumped(self):
96 """True if the changeset try to be a successor of a public changeset
97
98 Only non-public and non-obsolete changesets may be bumped.
99 """
100 return self.rev() in obsmod.getrevs(self._repo, 'bumped')
101
102 def divergent(self):
103 """Is a successors of a changeset with multiple possible successors set
104
105 Only non-public and non-obsolete changesets may be divergent.
106 """
107 return self.rev() in obsmod.getrevs(self._repo, 'divergent')
108
109 def troubled(self):
110 """True if the changeset is either unstable, bumped or divergent"""
111 return self.unstable() or self.bumped() or self.divergent()
112
113 def troubles(self):
114 """return the list of troubles affecting this changesets.
115
116 Troubles are returned as strings. possible values are:
117 - unstable,
118 - bumped,
119 - divergent.
120 """
121 troubles = []
122 if self.unstable():
123 troubles.append('unstable')
124 if self.bumped():
125 troubles.append('bumped')
126 if self.divergent():
127 troubles.append('divergent')
128 return troubles
82 129
83 def parents(self): 130 def parents(self):
84 """return contexts for each parent changeset""" 131 """return contexts for each parent changeset"""
85 return self._parents 132 return self._parents
86 133
319 yield changectx(self._repo, a) 366 yield changectx(self._repo, a)
320 367
321 def descendants(self): 368 def descendants(self):
322 for d in self._repo.changelog.descendants([self._rev]): 369 for d in self._repo.changelog.descendants([self._rev]):
323 yield changectx(self._repo, d) 370 yield changectx(self._repo, d)
324
325 def obsolete(self):
326 """True if the changeset is obsolete"""
327 return self.rev() in obsmod.getrevs(self._repo, 'obsolete')
328
329 def extinct(self):
330 """True if the changeset is extinct"""
331 return self.rev() in obsmod.getrevs(self._repo, 'extinct')
332
333 def unstable(self):
334 """True if the changeset is not obsolete but it's ancestor are"""
335 return self.rev() in obsmod.getrevs(self._repo, 'unstable')
336
337 def bumped(self):
338 """True if the changeset try to be a successor of a public changeset
339
340 Only non-public and non-obsolete changesets may be bumped.
341 """
342 return self.rev() in obsmod.getrevs(self._repo, 'bumped')
343
344 def divergent(self):
345 """Is a successors of a changeset with multiple possible successors set
346
347 Only non-public and non-obsolete changesets may be divergent.
348 """
349 return self.rev() in obsmod.getrevs(self._repo, 'divergent')
350
351 def troubled(self):
352 """True if the changeset is either unstable, bumped or divergent"""
353 return self.unstable() or self.bumped() or self.divergent()
354
355 def troubles(self):
356 """return the list of troubles affecting this changesets.
357
358 Troubles are returned as strings. possible values are:
359 - unstable,
360 - bumped,
361 - divergent.
362 """
363 troubles = []
364 if self.unstable():
365 troubles.append('unstable')
366 if self.bumped():
367 troubles.append('bumped')
368 if self.divergent():
369 troubles.append('divergent')
370 return troubles
371 371
372 def filectx(self, path, fileid=None, filelog=None): 372 def filectx(self, path, fileid=None, filelog=None):
373 """get a file context from this changeset""" 373 """get a file context from this changeset"""
374 if fileid is None: 374 if fileid is None:
375 fileid = self.filenode(path) 375 fileid = self.filenode(path)