2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/9860d1c6998d/
Changeset: 9860d1c6998d
Branch: next-stable
User: greg
Date: 2014-07-30 16:41:52
Summary: Do not increment a repository's times_downloaded counter when setting metadata on it.
Affected #: 1 file
diff -r 6b44b99b79b8c4383e8475e409c53f9deae7f7ff -r 9860d1c6998d38f633a11aae45bd3f667e236cc0 lib/galaxy/webapps/tool_shed/framework/middleware/hg.py
--- a/lib/galaxy/webapps/tool_shed/framework/middleware/hg.py
+++ b/lib/galaxy/webapps/tool_shed/framework/middleware/hg.py
@@ -22,6 +22,7 @@
CHUNK_SIZE = 65536
+
class Hg( object ):
def __init__( self, app, config ):
@@ -35,12 +36,20 @@
self.db_url = self.config[ 'database_connection' ]
else:
self.db_url = "sqlite:///%s?isolation_level=IMMEDIATE" % self.config[ 'database_file' ]
+ # Keep track of whether we're setting repository metadata so that we do not increment the times_downloaded
+ # count for the repository.
+ self.setting_repository_metadata = False
def __call__( self, environ, start_response ):
+ if 'PATH_INFO' in environ:
+ path_info = environ[ 'PATH_INFO' ].lstrip( '/' )
+ if path_info == 'repository/reset_all_metadata':
+ self.setting_repository_metadata = True
cmd = self.__get_hg_command( **environ )
# The 'getbundle' command indicates that a mercurial client is getting a bundle of one or more changesets, indicating
- # a clone or a pull.
- if cmd == 'getbundle':
+ # a clone or a pull. However, we do not want to increment the times_downloaded count if we're only setting repository
+ # metadata.
+ if cmd == 'getbundle' and not self.setting_repository_metadata:
common, _ = environ[ 'HTTP_X_HGARG_1' ].split( '&' )
# The 'common' parameter indicates the full sha-1 hash of the changeset the client currently has checked out. If
# this is 0000000000000000000000000000000000000000, then the client is performing a fresh checkout. If it has any
https://bitbucket.org/galaxy/galaxy-central/commits/157adaf92f9c/
Changeset: 157adaf92f9c
User: greg
Date: 2014-07-30 16:42:28
Summary: Merged next-stable
Affected #: 1 file
diff -r 38ba45d6ba5be65b3b743fc08739e16cd6e0ac8f -r 157adaf92f9c5f06a2ae50a1e7103d0b29543a07 lib/galaxy/webapps/tool_shed/framework/middleware/hg.py
--- a/lib/galaxy/webapps/tool_shed/framework/middleware/hg.py
+++ b/lib/galaxy/webapps/tool_shed/framework/middleware/hg.py
@@ -22,6 +22,7 @@
CHUNK_SIZE = 65536
+
class Hg( object ):
def __init__( self, app, config ):
@@ -35,12 +36,20 @@
self.db_url = self.config[ 'database_connection' ]
else:
self.db_url = "sqlite:///%s?isolation_level=IMMEDIATE" % self.config[ 'database_file' ]
+ # Keep track of whether we're setting repository metadata so that we do not increment the times_downloaded
+ # count for the repository.
+ self.setting_repository_metadata = False
def __call__( self, environ, start_response ):
+ if 'PATH_INFO' in environ:
+ path_info = environ[ 'PATH_INFO' ].lstrip( '/' )
+ if path_info == 'repository/reset_all_metadata':
+ self.setting_repository_metadata = True
cmd = self.__get_hg_command( **environ )
# The 'getbundle' command indicates that a mercurial client is getting a bundle of one or more changesets, indicating
- # a clone or a pull.
- if cmd == 'getbundle':
+ # a clone or a pull. However, we do not want to increment the times_downloaded count if we're only setting repository
+ # metadata.
+ if cmd == 'getbundle' and not self.setting_repository_metadata:
common, _ = environ[ 'HTTP_X_HGARG_1' ].split( '&' )
# The 'common' parameter indicates the full sha-1 hash of the changeset the client currently has checked out. If
# this is 0000000000000000000000000000000000000000, then the client is performing a fresh checkout. If it has any
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/4b37f57c1d2e/
Changeset: 4b37f57c1d2e
User: jmchilton
Date: 2014-07-25 04:20:08
Summary: More generic logic for checking empty histories.
This fixes a bug where web UI short circuits rendering of history panel if history only contains dataset collections and no datasets.
The most obvious alternative to this would be to 1) add collection information to the per-content state ids dict - which may not make a lot of sense since we haven't nailed down exactly what collection states should look like and if they will be drawn from the same possible set of states as dataset states or 2) build a separate set of state summaries for dataset collections. In addition to these two approaches being more work, they also lock the API into more expensive queries by default.
Affected #: 2 files
diff -r 646c414e90515d78d99461e090815f1a01f18c72 -r 4b37f57c1d2ecd925697ade51a043e51452db606 lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -874,7 +874,7 @@
class History( object, Dictifiable, UsesAnnotations, HasName ):
dict_collection_visible_keys = ( 'id', 'name', 'published', 'deleted' )
- dict_element_visible_keys = ( 'id', 'name', 'published', 'deleted', 'genome_build', 'purged', 'importable', 'slug' )
+ dict_element_visible_keys = ( 'id', 'name', 'published', 'deleted', 'genome_build', 'purged', 'importable', 'slug', 'empty' )
default_name = 'Unnamed history'
def __init__( self, id=None, name=None, user=None ):
@@ -891,6 +891,10 @@
self.galaxy_sessions = []
self.tags = []
+ @property
+ def empty( self ):
+ return self.hid_counter == 1
+
def _next_hid( self ):
# this is overriden in mapping.py db_next_hid() method
if len( self.datasets ) == 0:
diff -r 646c414e90515d78d99461e090815f1a01f18c72 -r 4b37f57c1d2ecd925697ade51a043e51452db606 static/scripts/mvc/history/history-model.js
--- a/static/scripts/mvc/history/history-model.js
+++ b/static/scripts/mvc/history/history-model.js
@@ -212,17 +212,14 @@
// get the history data
return jQuery.ajax( galaxy_config.root + 'api/histories/' + historyId );
}
- function countHdasFromHistory( historyData ){
+ function isEmpty( historyData ){
// get the number of hdas accrd. to the history
- if( !historyData || !historyData.state_ids ){ return 0; }
- return _.reduce( historyData.state_ids, function( memo, list, state ){
- return memo + list.length;
- }, 0 );
+ return historyData && historyData.empty;
}
function getHdas( historyData ){
// get the hda data
// if no hdas accrd. to history: return empty immed.
- if( !countHdasFromHistory( historyData ) ){ return []; }
+ if( isEmpty( historyData ) ){ return []; }
// if there are hdas accrd. to history: get those as well
if( _.isFunction( hdaDetailIds ) ){
hdaDetailIds = hdaDetailIds( historyData );
https://bitbucket.org/galaxy/galaxy-central/commits/e8692fc5228b/
Changeset: e8692fc5228b
User: jmchilton
Date: 2014-07-28 19:21:29
Summary: Merged in jmchilton/galaxy-central-fork-1 (pull request #442)
More generic logic for checking empty histories.
Affected #: 2 files
diff -r d5870d822b2492d99cc46fc31ab21c5b9b237cae -r e8692fc5228bed58379bfde50af5b6abb71026fe lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -874,7 +874,7 @@
class History( object, Dictifiable, UsesAnnotations, HasName ):
dict_collection_visible_keys = ( 'id', 'name', 'published', 'deleted' )
- dict_element_visible_keys = ( 'id', 'name', 'published', 'deleted', 'genome_build', 'purged', 'importable', 'slug' )
+ dict_element_visible_keys = ( 'id', 'name', 'published', 'deleted', 'genome_build', 'purged', 'importable', 'slug', 'empty' )
default_name = 'Unnamed history'
def __init__( self, id=None, name=None, user=None ):
@@ -891,6 +891,10 @@
self.galaxy_sessions = []
self.tags = []
+ @property
+ def empty( self ):
+ return self.hid_counter == 1
+
def _next_hid( self ):
# this is overriden in mapping.py db_next_hid() method
if len( self.datasets ) == 0:
diff -r d5870d822b2492d99cc46fc31ab21c5b9b237cae -r e8692fc5228bed58379bfde50af5b6abb71026fe static/scripts/mvc/history/history-model.js
--- a/static/scripts/mvc/history/history-model.js
+++ b/static/scripts/mvc/history/history-model.js
@@ -212,17 +212,14 @@
// get the history data
return jQuery.ajax( galaxy_config.root + 'api/histories/' + historyId );
}
- function countHdasFromHistory( historyData ){
+ function isEmpty( historyData ){
// get the number of hdas accrd. to the history
- if( !historyData || !historyData.state_ids ){ return 0; }
- return _.reduce( historyData.state_ids, function( memo, list, state ){
- return memo + list.length;
- }, 0 );
+ return historyData && historyData.empty;
}
function getHdas( historyData ){
// get the hda data
// if no hdas accrd. to history: return empty immed.
- if( !countHdasFromHistory( historyData ) ){ return []; }
+ if( isEmpty( historyData ) ){ return []; }
// if there are hdas accrd. to history: get those as well
if( _.isFunction( hdaDetailIds ) ){
hdaDetailIds = hdaDetailIds( historyData );
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.