36d5542588a99a3e44bf65d16aa3c4600b562b87 braney Tue Jun 8 10:10:30 2021 -0700 changes in response to code review #27643 diff --git src/hg/lib/cartRewrite.c src/hg/lib/cartRewrite.c index d2c5727..f33f2ff 100644 --- src/hg/lib/cartRewrite.c +++ src/hg/lib/cartRewrite.c @@ -1,18 +1,19 @@ #include "common.h" #include "cart.h" +#include "hgConfig.h" static char *edit0Mm10tracks[] = { "snp142", "snp142Mult", "snp138", "snp138Common", "snp138Mult", "snp137Common", "snp137Mult", "snp137", }; static char *edit0Hg19tracks[] = { @@ -99,31 +100,31 @@ "snp146", }; static void turnOnSuper(struct cart *cart, char **trackNames, unsigned numTracks, char *superTrackName) { boolean turnOnSuper = FALSE; int ii; // go through all the tracks moved into the supertrack for(ii = 0; ii < numTracks; ii++) { char *vis = cartOptionalString(cart, trackNames[ii]); if (vis) { - if (sameString(vis, "dense") || sameString(vis, "pack") || sameString(vis, "full") ) + if (differentString(vis, "hide")) { // Turn on the super track since one of its subtracks was visible before turnOnSuper = TRUE; break; } } } if (turnOnSuper) cartSetString(cart, superTrackName, "show"); } static void cartEdit0(struct cart *cart) /* Moving a bunch of SNP tracks to an archive super track. We need * to turn on the super track if any of what are now subTracks are visible. @@ -144,26 +145,32 @@ // Here's the list of cart rewrite functions struct cartRewrite { void (*func)(struct cart *cart); }; static struct cartRewrite cartRewrites[] = { { cartEdit0}, }; 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; + if (trackDbCartVersion > ArraySize(cartRewrites)) - errAbort("Do not have cart rewrite rules to bring it up to version %d\n", trackDbCartVersion); + { + fprintf(stderr,"CartRewriteError: do not have cart rewrite rules to bring it up to version %d requested by trackDb\n", trackDbCartVersion); + return; + } // call the rewrite functions to bring us up to the trackDb cart version int ii; for(ii = cartVersion; ii < trackDbCartVersion; ii++) (cartRewrites[ii].func)(cart); cartSetVersion(cart, trackDbCartVersion); }