45b4b52a4727e9aeedabcd39e011d4408f35b7e8
angie
Wed Nov 22 16:48:32 2017 -0800
In printDataVersion, instead of preferring hgFixed.trackVersion to trackDb setting dataVersion, prefer dataVersion because it is easier to manage pushes with a dataVersion file vs. with rows of the trackVersion table. refs #18997 note-141
diff --git src/hg/lib/hui.c src/hg/lib/hui.c
index fc73543..375c162 100644
--- src/hg/lib/hui.c
+++ src/hg/lib/hui.c
@@ -8909,54 +8909,52 @@
outs[12] = taxId;
uUrl = subMulti(url, ArraySize(ins), ins, outs);
outs[0] = eItem;
eUrl = subMulti(url, ArraySize(ins), ins, outs);
freeDyString(&uUrl);
freeMem(eItem);
freeMem(scName);
return eUrl->string;
}
void printDataVersion(char *database, struct trackDb *tdb)
/* If this annotation has a dataVersion setting, print it.
* check hgFixed.trackVersion, meta data and trackDb 'dataVersion'. */
{
-char *version = NULL;
-
-// try the hgFixed.trackVersion table
-struct trackVersion *trackVersion = getTrackVersion(database, tdb->track);
-// try trackVersion table with parent, for composites/superTracks
-if(trackVersion == NULL && (tdb->parent!=NULL))
- trackVersion = getTrackVersion(database, tdb->parent->track);
-
// try the metadata
-if(trackVersion == NULL)
- {
metadataForTable(database, tdb, NULL);
- version = (char *)metadataFindValue(tdb, "dataVersion");
- }
-else
- version = trackVersion->version;
+char *version = (char *)metadataFindValue(tdb, "dataVersion");
// try trackDb itself, this automatically will go up the hierarchy
if (version == NULL)
-{
version = trackDbSetting(tdb, "dataVersion");
-}
-
-if (version == NULL)
- return;
-// On the RR, dataVersion can also be the path to a local file, for otto tracks
+if (version != NULL)
+ {
+ // dataVersion can also be the path to a local file, for otto tracks
if (!trackHubDatabase(database) && !isHubTrack(tdb->table) && startsWith("/", version))
{
- char *path = replaceInUrl((char *)version, "", NULL, database, "", 0, 0, tdb->track, FALSE);
- struct lineFile* lf = lineFileOpen(path, TRUE);
+ char *path = replaceInUrl(version, "", NULL, database, "", 0, 0, tdb->track, FALSE);
+ struct lineFile* lf = lineFileMayOpen(path, TRUE);
if (lf)
version = lineFileReadAll(lf);
+ else
+ version = NULL;
+ lineFileClose(&lf);
+ }
+ }
+if (version == NULL)
+ {
+ // try the hgFixed.trackVersion table
+ struct trackVersion *trackVersion = getTrackVersion(database, tdb->track);
+ // try trackVersion table with parent, for composites/superTracks
+ if (trackVersion == NULL && tdb->parent != NULL)
+ trackVersion = getTrackVersion(database, tdb->parent->track);
+ if (trackVersion != NULL)
+ version = trackVersion->version;
}
-if (version != NULL)
+if (isNotEmpty(version))
printf("Data version: %s
\n", version);
}