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

login
register
mail settings
Submitter Laurent Charignon
Date Dec. 23, 2015, 7:07 p.m.
Message ID <1721c112f0194a078103.1450897650@dev5073.prn1.facebook.com>
Download mbox | patch
Permalink /patch/12305/
State Changes Requested
Delegated to: Yuya Nishihara
Headers show

Comments

Laurent Charignon - Dec. 23, 2015, 7:07 p.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@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.

Patch

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)