Rakefiles: do not consider secret changesets as heads when updating stx-8.0.0
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 01 Mar 2018 22:31:43 +0000
branchstx-8.0.0
changeset 220 8faa459a7ee9
parent 219 c96964104b1a
child 221 a0f64acd117d
Rakefiles: do not consider secret changesets as heads when updating
rakelib/hglib.rb
rakelib/scm.rb
--- a/rakelib/hglib.rb	Tue Jan 23 09:50:40 2018 +0000
+++ b/rakelib/hglib.rb	Thu Mar 01 22:31:43 2018 +0000
@@ -344,8 +344,13 @@
     # Return changeset IDs of all head revisions. 
     # If `branch` is given, return only heads in given
     # branch.
-    def heads(branch = nil)
-      branch ? log("head() and branch('#{branch}')") : log('head()')
+    # If `secret_secret` is false, then changesets in 
+    # secret phase are ignored (even if thet're heads    
+    def heads(branch = nil, include_secret: true)
+      revset  = "head()"
+      revset += " and branch('#{branch}')" if branch
+      revset += " and !secret()" if not include_secret
+      return log(revset)
     end
 
     # Return name of an active bookmark or nil if no bookmark
--- a/rakelib/scm.rb	Tue Jan 23 09:50:40 2018 +0000
+++ b/rakelib/scm.rb	Thu Mar 01 22:31:43 2018 +0000
@@ -167,7 +167,7 @@
           if bookmarks.has_key? 'master'
             revision = 'master'
           else
-            if hg.heads(branch).size > 1
+            if hg.heads(branch, include_secret: false).size > 1
               raise CheckoutException.new("HG: Cannot checkout #{directory}: directory. The ->#{branch}<- branch has multiple heads but no bookmark named 'master'! (All other branches are ignored)")
             end
           end