c9b40ed334908a1b791191a3df227ae991b4810e
braney
  Fri Mar 22 18:07:12 2013 -0700
fold back in the changes Angie made in the commit before my last commit.  Change cartCopyCustomTracks() to not take a database argument since it's interation over all the "ctfile_*" in the cart anyway.All of this is to fix the problem that now loading a cart and connecting to hubs is what should be an atomic act.   As it was, there were some hdb routines called after a new cart was loaded, but before the referenced hubs were loaded.
As it is now, hgSession will load new carts without reloading the associated hubs.  This would only be a problem with assembly hubs, and I don't think it matters since hgSession isn't displaying hub data anyway.

diff --git src/hg/hgSession/hgSession.c src/hg/hgSession/hgSession.c
index 875b7c4..6986ad1 100644
--- src/hg/hgSession/hgSession.c
+++ src/hg/hgSession/hgSession.c
@@ -639,31 +639,31 @@
     dyStringClear(dy);
     dyStringPrintf(dy, "INSERT INTO %s ", namedSessionTable);
     dyStringAppend(dy, "(userName, sessionName, contents, shared, "
 		       "firstUse, lastUse, useCount) VALUES (");
     dyStringPrintf(dy, "'%s', '%s', ", encUserName, encSessionName);
     dyStringAppend(dy, "'");
     cleanHgSessionFromCart(cart);
     cartEncodeState(cart, dy);
     dyStringAppend(dy, "', ");
     dyStringPrintf(dy, "%d, ", (shareSession ? 1 : 0));
     dyStringPrintf(dy, "%s, now(), %d);", firstUse, useCount);
     sqlUpdate(conn, dy->string);
     dyStringFree(&dy);
 
     /* Prevent modification of custom tracks just saved to namedSessionDb: */
-    cartCopyCustomTracks(cart, cartUsualString(cart, "db", hDefaultDb()));
+    cartCopyCustomTracks(cart);
 
     if (useCount > INITIAL_USE_COUNT)
 	dyStringPrintf(dyMessage,
 	  "Overwrote the contents of session <B>%s</B> "
 	  "(that %s be shared with other users).  "
 	  "%s %s",
 	  htmlEncode(sessionName), (shareSession ? "may" : "may not"),
 	  getSessionLink(encUserName, encSessionName),
 	  getSessionEmailLink(encUserName, encSessionName));
     else
 	dyStringPrintf(dyMessage,
 	  "Added a new session <B>%s</B> that %s be shared with other users.  "
 	  "%s %s",
 	  htmlEncode(sessionName), (shareSession ? "may" : "may not"),
 	  getSessionLink(encUserName, encSessionName),