##// END OF EJS Templates
obsutil: move the 'marker' class to the new modules...
marmoute -
r33149:4e30168d default
parent child Browse files
Show More
@@ -307,7 +307,7 b' def _debugobsmarkers(ui, part, indent=0,'
307 ui.write(msg)
307 ui.write(msg)
308 fm = ui.formatter('debugobsolete', opts)
308 fm = ui.formatter('debugobsolete', opts)
309 for rawmarker in sorted(markers):
309 for rawmarker in sorted(markers):
310 m = obsolete.marker(None, rawmarker)
310 m = obsutil.marker(None, rawmarker)
311 fm.startitem()
311 fm.startitem()
312 fm.plain(indent_string)
312 fm.plain(indent_string)
313 cmdutil.showmarker(fm, m)
313 cmdutil.showmarker(fm, m)
@@ -465,48 +465,6 b' def encodemarkers(markers, addheader=Fal'
465 for marker in markers:
465 for marker in markers:
466 yield encodeone(marker)
466 yield encodeone(marker)
467
467
468
469 class marker(object):
470 """Wrap obsolete marker raw data"""
471
472 def __init__(self, repo, data):
473 # the repo argument will be used to create changectx in later version
474 self._repo = repo
475 self._data = data
476 self._decodedmeta = None
477
478 def __hash__(self):
479 return hash(self._data)
480
481 def __eq__(self, other):
482 if type(other) != type(self):
483 return False
484 return self._data == other._data
485
486 def precnode(self):
487 """Precursor changeset node identifier"""
488 return self._data[0]
489
490 def succnodes(self):
491 """List of successor changesets node identifiers"""
492 return self._data[1]
493
494 def parentnodes(self):
495 """Parents of the precursors (None if not recorded)"""
496 return self._data[5]
497
498 def metadata(self):
499 """Decoded metadata dictionary"""
500 return dict(self._data[3])
501
502 def date(self):
503 """Creation date as (unixtime, offset)"""
504 return self._data[4]
505
506 def flags(self):
507 """The flags field of the marker"""
508 return self._data[2]
509
510 @util.nogc
468 @util.nogc
511 def _addsuccessors(successors, markers):
469 def _addsuccessors(successors, markers):
512 for mark in markers:
470 for mark in markers:
@@ -851,7 +809,7 b' def getmarkers(repo, nodes=None, exclusi'
851 rawmarkers = repo.obsstore.relevantmarkers(nodes)
809 rawmarkers = repo.obsstore.relevantmarkers(nodes)
852
810
853 for markerdata in rawmarkers:
811 for markerdata in rawmarkers:
854 yield marker(repo, markerdata)
812 yield obsutil.marker(repo, markerdata)
855
813
856 # keep compatibility for the 4.3 cycle
814 # keep compatibility for the 4.3 cycle
857 def allprecursors(obsstore, nodes, ignoreflags=0):
815 def allprecursors(obsstore, nodes, ignoreflags=0):
@@ -864,6 +822,11 b' def allsuccessors(obsstore, nodes, ignor'
864 util.nouideprecwarn(movemsg, '4.3')
822 util.nouideprecwarn(movemsg, '4.3')
865 return obsutil.allsuccessors(obsstore, nodes, ignoreflags)
823 return obsutil.allsuccessors(obsstore, nodes, ignoreflags)
866
824
825 def marker(repo, data):
826 movemsg = 'obsolete.marker moved to obsutil.marker'
827 repo.ui.deprecwarn(movemsg, '4.3')
828 return obsutil.marker(repo, data)
829
867 def exclusivemarkers(repo, nodes):
830 def exclusivemarkers(repo, nodes):
868 movemsg = 'obsolete.exclusivemarkers moved to obsutil.exclusivemarkers'
831 movemsg = 'obsolete.exclusivemarkers moved to obsutil.exclusivemarkers'
869 repo.ui.deprecwarn(movemsg, '4.3')
832 repo.ui.deprecwarn(movemsg, '4.3')
@@ -7,6 +7,47 b''
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
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]
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
General Comments 0
You need to be logged in to leave comments. Login now