Patchwork [1,of,8] obsmarker: add a `flags` method

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 16, 2014, 12:33 a.m.
Message ID <23c889905c6298cab09e.1408149203@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5438/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 16, 2014, 12:33 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1408120890 25200
#      Fri Aug 15 09:41:30 2014 -0700
# Node ID 23c889905c6298cab09eba54e65faa7c1c015da7
# Parent  8dda6f6ff564d8fe6ac7b8ce4c74eb9bfb5de14a
obsmarker: add a `flags` method

We introduce a proper method to access the flag information.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1182,11 +1182,11 @@  def showmarker(ui, marker):
     To be used by debug function."""
     ui.write(hex(marker.precnode()))
     for repl in marker.succnodes():
         ui.write(' ')
         ui.write(hex(repl))
-    ui.write(' %X ' % marker._data[2])
+    ui.write(' %X ' % marker.flags())
     ui.write('{%s}' % (', '.join('%r: %r' % t for t in
                                  sorted(marker.metadata().items()))))
     ui.write('\n')
 
 def finddate(ui, repo, date):
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -224,10 +224,14 @@  class marker(object):
     def date(self):
         """Creation date as (unixtime, offset)"""
         parts = self.metadata()['date'].split(' ')
         return (float(parts[0]), int(parts[1]))
 
+    def flags(self):
+        """The flags field of the marker"""
+        return self._data[2]
+
 class obsstore(object):
     """Store obsolete markers
 
     Markers can be accessed with two mappings:
     - precursors[x] -> set(markers on precursors edges of x)