4652765bd72b72b8360715448dd5874c93c79eb5
braney
  Sat Aug 17 15:07:44 2024 -0700
cartRewrite.  If an old session has gnomadVariantsV4 set then set
gnomadVariantsV4.1 to the same value

diff --git src/hg/cgilib/cartRewrite.c src/hg/cgilib/cartRewrite.c
index 4e81eb4..2c44abf 100644
--- src/hg/cgilib/cartRewrite.c
+++ src/hg/cgilib/cartRewrite.c
@@ -2,44 +2,46 @@
  * have a version number and this code knows how to make the cart compatble
  * with trackDb. */
 
 /* Copyright (C) 2021 The Regents of the University of California 
  * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */
 
 #include "common.h"
 #include "cart.h"
 #include "hgConfig.h"
 
 void cartEdit0(struct cart *cart);
 void cartEdit1(struct cart *cart);
 void cartEdit2(struct cart *cart);
 void cartEdit3(struct cart *cart);
 void cartEdit4(struct cart *cart);
+void cartEdit5(struct cart *cart);
 
 struct cartRewrite
 {
 void (*func)(struct cart *cart);
 };
 
 // Here's the list of cart rewrite functions
 static struct cartRewrite cartRewrites[] =
 {
 { cartEdit0},
 { cartEdit1},
 { cartEdit2},
 { cartEdit3},
 { cartEdit4},
+{ cartEdit5},
 };
 
 void cartRewrite(struct cart *cart, unsigned trackDbCartVersion, unsigned cartVersion)
 /* Rewrite the cart to update it to expectations of trackDb. */
 {
 if (sameString(cfgOptionDefault("cartVersion", "on"), "off"))
     return;
 
 // call the rewrite functions to bring us up to the trackDb cart version
 for(; cartVersion < trackDbCartVersion; cartVersion++)
     {
     // if we don't have a rewrite for this increment, bail out
     // with a warning in the error_log
     if (cartVersion >= ArraySize(cartRewrites))
         {
@@ -67,15 +69,25 @@
 
     if (vis)
         {
         if (differentString(vis, "hide"))
             {
             // Turn on the super track since one of its subtracks was visible before
             cartTurnOnSuper = TRUE;
             break;
             }
         }
     }
 
 if (cartTurnOnSuper)
     cartSetString(cart, superTrackName, "show");
 }
+
+void cartMatchVis(struct cart *cart, char *oldTrackName,  char *newTrackName)
+/* Make new track have the same visibility as an old track */
+{
+char *vis = cartOptionalString(cart, oldTrackName);
+
+printf("in cartMatch %s %s %s\n",oldTrackName, newTrackName, vis);
+if (vis)
+    cartSetString(cart, newTrackName, vis);
+}