comparison mercurial/obsutil.py @ 33148:4e30168d7939

obsutil: move the 'marker' class to the new modules We have a new 'obsutil' module now. We move high level utility there to bring 'obsolete.py' back to a more reasonable size.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 27 Jun 2017 01:51:40 +0200
parents 7017567ebdf2
children a14e2e7f7d1f
comparison
equal deleted inserted replaced
33147:07439e9f245b 33148:4e30168d7939
4 # 4 #
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 from __future__ import absolute_import 8 from __future__ import absolute_import
9
10 class marker(object):
11 """Wrap obsolete marker raw data"""
12
13 def __init__(self, repo, data):
14 # the repo argument will be used to create changectx in later version
15 self._repo = repo
16 self._data = data
17 self._decodedmeta = None
18
19 def __hash__(self):
20 return hash(self._data)
21
22 def __eq__(self, other):
23 if type(other) != type(self):
24 return False
25 return self._data == other._data
26
27 def precnode(self):
28 """Precursor changeset node identifier"""
29 return self._data[0]
30
31 def succnodes(self):
32 """List of successor changesets node identifiers"""
33 return self._data[1]
34
35 def parentnodes(self):
36 """Parents of the precursors (None if not recorded)"""
37 return self._data[5]
38
39 def metadata(self):
40 """Decoded metadata dictionary"""
41 return dict(self._data[3])
42
43 def date(self):
44 """Creation date as (unixtime, offset)"""
45 return self._data[4]
46
47 def flags(self):
48 """The flags field of the marker"""
49 return self._data[2]
9 50
10 def closestpredecessors(repo, nodeid): 51 def closestpredecessors(repo, nodeid):
11 """yield the list of next predecessors pointing on visible changectx nodes 52 """yield the list of next predecessors pointing on visible changectx nodes
12 53
13 This function respect the repoview filtering, filtered revision will be 54 This function respect the repoview filtering, filtered revision will be