sim: support "--" as comment
authorJoey Hess <joeyh@joeyh.name>
Wed, 25 Sep 2024 18:47:32 +0000 (14:47 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 25 Sep 2024 18:47:32 +0000 (14:47 -0400)
Using this in my sim files that are also mdwn files to avoid comments
being displayed as headers.

Annex/Sim/File.hs
doc/git-annex-sim.mdwn
doc/sims/balanced.mdwn
doc/sims/randomwanted.mdwn
doc/sims/sizebalanced_cluster.mdwn
doc/sims/sizebalanced_splitbrain.mdwn

index 4c3d2652d4ec86656db3e2fac656b8009bc60e3a..554a3a621b9e89faa22525ee6f3cd193941c9469 100644 (file)
@@ -27,7 +27,8 @@ parseSimFile = go [] . lines
 
 parseSimFileLine :: String -> Either String SimCommand
 parseSimFileLine s
-       | "#" `isPrefixOf` s = Right (CommandComment s)
+       | "#" `isPrefixOf` s || "--" `isPrefixOf` s = 
+               Right (CommandComment s)
        | all isSpace s = Right (CommandBlank)
        | otherwise = parseSimCommand (words s)
 
index a1fb30f54bec3b4d3be16e115f877e5ae858cd96..0ea3895af18720a8685c78dd68b896bc5c4a59db 100644 (file)
@@ -42,7 +42,8 @@ shown before it is stopped.
 
 This text file is used to configure the simulation and also to report on
 the results of the simulation. Each line takes the form of a command
-followed by parameters to the command. Lines starting with "#" are comments.
+followed by parameters to the command. Lines starting with "#" or "--"
+are comments.
 
 Here is an example sim file:
 
index 38764d791d057bc3c4afc9d4279fd5285f56ca6e..e6721732537d8b0812a5c330c8e2b18a68e4546a 100644 (file)
@@ -1,4 +1,4 @@
-# size balanced preferred content sim  
+-- size balanced preferred content sim  
 seed -4592890916829221843  
 init foo  
 init bar  
index 48961223460b712507fda278822be40b81ad8b65..b73d87416d12f6ddef9a5b1ac6d88f83e2ae1fc6 100644 (file)
@@ -1,6 +1,6 @@
-# This is a simulation of random preferred content expressions.  
-# git-annex sim run this in a loop to explore if an expression can fail to
-# stabilize
+-- This is a simulation of random preferred content expressions.  
+-- git-annex sim run this in a loop to explore if an expression can fail to
+-- stabilize
 init foo  
 init bar  
 connect foo <-> bar  
@@ -8,6 +8,6 @@ addmulti 10 .x 100.0kB 10.0MB foo
 addmulti 10 .y 100.0kB 10.0MB foo  
 randomwanted bar largerthan=1MB include=*.x anything present  
 randomwanted foo largerthan=1MB include=*.x anything present  
-# 40 is the maximum possible steps, in case bar wants to get all 20 files,  
-# and foo wants to drop them all  
+-- 40 is the maximum possible steps, in case bar wants to get all 20 files,  
+-- and foo wants to drop them all  
 stepstable 40  
index d649dc2915ffd9a866af86e50d2083de92f67a4f..1f5399b83f141eab6f76ff8551339a7a4036e27a 100644 (file)
@@ -1,8 +1,8 @@
-# Size balanced preferred content sim with multiple repositories sending  
-# concurrently to the same repositories, in a cluster.  
-#   
-# This demonstrates that size balanced preferred content does not get out  
-# of balance when used with cluster nodes.  
+-- Size balanced preferred content sim with multiple repositories sending  
+-- concurrently to the same repositories, in a cluster.  
+--  
+-- This demonstrates that size balanced preferred content does not get out  
+-- of balance when used with cluster nodes.  
 init foo  
 init bar  
 init node1  
index a41ad82112a72e3d274e64235e7327cf176b69bc..1fc09a3a961760046253410845ff9a671f4220c8 100644 (file)
@@ -1,9 +1,9 @@
-# Size balanced preferred content sim with multiple repositories sending  
-# concurrently to the same repositories, without communication.  
-#  
-# This demonstrates how size balanced preferred content can get out of  
-# balance in this situation. Since there is no random seed, each  
-# git-annex sim start of this file will display a different result.  
+-- Size balanced preferred content sim with multiple repositories sending  
+-- concurrently to the same repositories, without communication.  
+-- 
+-- This demonstrates how size balanced preferred content can get out of  
+-- balance in this situation. Since there is no random seed, each  
+-- git-annex sim start of this file will display a different result.  
 init foo  
 init fii  
 init fum  
@@ -56,6 +56,6 @@ connect fum <- foo -> fii
 action foo gitpull fii  
 action foo gitpull fum  
 visit foo git-annex maxsize  
-#rebalance on  
-#step 100  
-#visit foo echo "after rebalance:"; git-annex maxsize  
+--rebalance on  
+--step 100  
+--visit foo echo "after rebalance:"; git-annex maxsize