# HG changeset patch # User Pierre-Yves David # Date 1315496814 -7200 # Node ID 0bcbf690dfcada9b65bc64c3590d7611b25e995e # Parent 62bdc256709908ef0269cb905e0700a28ee85893 reorganise code diff -r 62bdc2567099 -r 0bcbf690dfca hgext/obsolete.py --- a/hgext/obsolete.py Thu Sep 08 17:32:51 2011 +0200 +++ b/hgext/obsolete.py Thu Sep 08 17:46:54 2011 +0200 @@ -126,6 +126,24 @@ class obsoletingrepo(repo.__class__): + ### Public method + def obsoletedby(self, node): + """return the set of node that make obsolete (obj)""" + return self._obsobjrels.get(node, set()) + + def obsolete(self, node): + """return the set of node that make obsolete (sub)""" + return self._obssubrels.get(node, set()) + + def addobsolete(self, sub, obj): + """Add a relation marking that node is a new version of """ + self._obssubrels.setdefault(sub, set()).add(obj) + self._obsobjrels.setdefault(obj, set()).add(sub) + try: + self.changelog.hiddenrevs.add(repo[obj].rev()) + except error.RepoLookupError: + pass #unknow revision (but keep propagating the data + self._writeobsrels() ### Hidden revision support @util.propertycache @@ -207,24 +225,6 @@ return result - ### Public method - def obsoletedby(self, node): - """return the set of node that make obsolete (obj)""" - return self._obsobjrels.get(node, set()) - - def obsolete(self, node): - """return the set of node that make obsolete (sub)""" - return self._obssubrels.get(node, set()) - - def addobsolete(self, sub, obj): - """Add a relation marking that node is a new version of """ - self._obssubrels.setdefault(sub, set()).add(obj) - self._obsobjrels.setdefault(obj, set()).add(sub) - try: - self.changelog.hiddenrevs.add(repo[obj].rev()) - except error.RepoLookupError: - pass #unknow revision (but keep propagating the data - self._writeobsrels() ### rollback support