[PATCH 1 of 2] context: add a method to tell if a changeset is secret

Laurent Charignon lcharignon at fb.com
Wed Dec 23 19:07:30 UTC 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1450897553 28800
#      Wed Dec 23 11:05:53 2015 -0800
# Node ID 1721c112f0194a078103b3b673de236b5cd5cd52
# Parent  fe376159a58d9b3d748b669ac011b0eed0346fea
context: add a method to tell if a changeset is secret

Before this patch we had to compare the phase of a changeset to phases.secret
to know if a changeset was secret. This patch gives us an easier way to do that
and can make our code more legible.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -162,6 +162,8 @@
         return phases.phasenames[self.phase()]
     def mutable(self):
         return self.phase() > phases.public
+    def secret(self):
+        return self.phase() == phases.secret
 
     def getfileset(self, expr):
         return fileset.getfileset(self, expr)


More information about the Mercurial-devel mailing list