Mercurial > hg
changeset 17072:517af63ba382
obsolete: helper class to access obsolete marker data
author | Pierre-Yves.David@ens-lyon.org |
---|---|
date | Thu, 07 Jun 2012 19:19:58 +0200 |
parents | 11f26e2669aa |
children | 3a79a5682af1 |
files | mercurial/obsolete.py |
diffstat | 1 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/obsolete.py Thu Jun 07 19:15:23 2012 +0200 +++ b/mercurial/obsolete.py Thu Jun 07 19:19:58 2012 +0200 @@ -120,6 +120,34 @@ d[key] = value return d +class marker(object): + """Wrap obsolete marker raw data""" + + def __init__(self, repo, data): + # the repo argument will be used to create changectx in later version + self._repo = repo + self._data = data + self._decodedmeta = None + + def precnode(self): + """Precursor changeset node identifier""" + return self._data[0] + + def succnodes(self): + """List of successor changesets node identifiers""" + return self._data[1] + + def metadata(self): + """Decoded metadata dictionary""" + if self._decodedmeta is None: + self._decodedmeta = decodemeta(self._data[3]) + return self._decodedmeta + + def date(self): + """Creation date as (unixtime, offset)""" + parts = self.metadata()['date'].split(' ') + return (float(parts[0]), int(parts[1])) + class obsstore(object): """Store obsolete markers