Mercurial > evolve
comparison hgext/obsolete.py @ 299:eda6491ca269
obsolete: add 'obsolete' keyword
The obsolete keyword displays the node status among 'stable',
'unstable', 'suspended', 'extinct'.
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Fri, 22 Jun 2012 18:04:43 +0200 |
parents | f597421662f7 |
children | 3b1f326878e5 |
comparison
equal
deleted
inserted
replaced
298:f597421662f7 | 299:eda6491ca269 |
---|---|
99 from mercurial import phases | 99 from mercurial import phases |
100 from mercurial.node import hex, bin, short, nullid | 100 from mercurial.node import hex, bin, short, nullid |
101 from mercurial.lock import release | 101 from mercurial.lock import release |
102 from mercurial import localrepo | 102 from mercurial import localrepo |
103 from mercurial import cmdutil | 103 from mercurial import cmdutil |
104 from mercurial import templatekw | |
104 | 105 |
105 try: | 106 try: |
106 from mercurial.localrepo import storecache | 107 from mercurial.localrepo import storecache |
107 storecache('babar') # to trigger import | 108 storecache('babar') # to trigger import |
108 except (TypeError, ImportError): | 109 except (TypeError, ImportError): |
213 s = revset.getset(repo, range(len(repo)), x) | 214 s = revset.getset(repo, range(len(repo)), x) |
214 cs = _obsancestors(repo, s) | 215 cs = _obsancestors(repo, s) |
215 return [r for r in subset if r in cs] | 216 return [r for r in subset if r in cs] |
216 | 217 |
217 | 218 |
219 ### template keywords | |
220 ##################### | |
221 | |
222 def obsoletekw(repo, ctx, templ, **args): | |
223 """:obsolete: String. The obsolescence level of the node, could be | |
224 ``stable``, ``unstable``, ``suspended`` or ``extinct``. | |
225 """ | |
226 rev = ctx.rev() | |
227 if rev in repo._extinctset: | |
228 return 'extinct' | |
229 if rev in repo._suspendedset: | |
230 return 'suspended' | |
231 if rev in repo._unstableset: | |
232 return 'unstable' | |
233 return 'stable' | |
218 | 234 |
219 ### Other Extension compat | 235 ### Other Extension compat |
220 ############################ | 236 ############################ |
221 | 237 |
222 | 238 |
308 revset.symbols["suspended"] = revsetsuspended | 324 revset.symbols["suspended"] = revsetsuspended |
309 revset.symbols["extinct"] = revsetextinct | 325 revset.symbols["extinct"] = revsetextinct |
310 revset.symbols["obsparents"] = revsetobsparents | 326 revset.symbols["obsparents"] = revsetobsparents |
311 revset.symbols["obsancestors"] = revsetobsancestors | 327 revset.symbols["obsancestors"] = revsetobsancestors |
312 | 328 |
329 templatekw.keywords['obsolete'] = obsoletekw | |
313 | 330 |
314 try: | 331 try: |
315 rebase = extensions.find('rebase') | 332 rebase = extensions.find('rebase') |
316 if rebase: | 333 if rebase: |
317 extensions.wrapfunction(rebase, 'buildstate', buildstate) | 334 extensions.wrapfunction(rebase, 'buildstate', buildstate) |