diff --git a/lib/hgaster/hooks/generic.py b/lib/hgaster/hooks/generic.py
index eff1d15cf0ddf9b8ae93f754c20d3b2b7fa49324..2be9ca97b9e414adc812b0300deeb718afde2bac 100644
--- a/lib/hgaster/hooks/generic.py
+++ b/lib/hgaster/hooks/generic.py
@@ -177,14 +177,19 @@ def single_head_per_branch_hook(in_branch=None):
 
         pretxnchangegroup.check_heads = python:aster.hooks.single_head_per_branch
         """
+        node = repo[node]
+        if node.phase() == hg.phases.secret:
+            ui.warn("ERROR: you are submitting a secret changeset!")
+            return NOOK
+
         for branch, heads in repo.branchmap().items():
             if in_branch and not re.search(in_branch, branch):
                 continue
-            node = repo[node]
-            if node.branch() != branch or node.phase() == hg.phases.secret:
+            if node.branch() != branch:
                 continue
-            unclosed = [head for head in heads
-                        if not repo[head].extra().get("close")]
+            revs = [repo[head] for head in heads]
+            unclosed = [rev for rev in revs if not rev.extra().get("close")
+                        and rev.phase() != hg.phases.secret]
             if len(unclosed) > 1:
                 ui.warn("ERROR: Only one head per branch is allowed "
                         "(problem on branch '{0}')!\n"