diff -r 2d09a485772f -r 1058962ee3ef rakelib/workflow.rake --- a/rakelib/workflow.rake Mon Nov 21 23:24:30 2016 +0000 +++ b/rakelib/workflow.rake Tue Nov 22 21:19:13 2016 +0000 @@ -5,36 +5,74 @@ namespace :'workflow' do # A helper function to :push-upstream and push-staging tasks - def push(remote, user, pass) + def hg_repositories() project.packages_and_application.each do | pkg | if not pkg.nested_package? then repo = Rake::Stx::Configuration::Repository::find(pkg.repository) if repo.type == :'hg' then - hg = HG::Repository.new(BUILD_DIR / pkg.directory) - opts = { - :user => user, - :pass => pass, - } - if hg.bookmark() then - opts[:bookmarks] = '.' - else - opts[:rev] = '.' - end - hg.push(remote, **opts) + hg = HG::Repository.new(BUILD_DIR / pkg.directory) + yield hg end end + end + end + + def push(remote, user, pass, review_only, push_bookmark) + hg_repositories do | hg | + opts = { + :user => user, + :pass => pass, + } + if review_only then + opts[:rev] = '.' + remote_url = hg.paths[remote] || remote + bookmark = hg.bookmark() + puts "" + puts "== changes going to #{remote_url} ==" + puts "" + hg.outgoing(remote, **opts) + puts "" + if push_bookmark and bookmark then + puts "Will update bookmark '#{bookmark}" + end + puts "====================================" + puts "" + else + if push_bookmark && bookmark then + opts[:bookmarks] = ['.'] + else + opts[:rev] = '.' + end + hg.push(remote, **opts) + end end end + desc "Display changes to be pushed to upstream repositores (use it to review what workflow:push-upstream would do)" + task :'out-upstream', :user, :pass do | t, args | + push('default', args[:user], args[:pass], true, false) + end + task :'out-upstream' => :'setup' + desc "Push currently checked out revisions to upstream repositories (to be called after all tests pass on all configurations)" task :'push-upstream', :user, :pass do | t, args | - push('default', args[:user] || nil, args[:pass] || nil) + push('default', args[:user], args[:pass], false, false) end task :'push-upstream' => :'setup' + + desc "Display changes to be pushed to staging repositores (use it to review what workflow:push-staging would do)" + task :'out-staging', :user, :pass do | t, args | + push('staging', args[:user], args[:pass], true, true) + end + task :'out-staging' => :'setup' + desc "Push currently checked out revisions to staging repositories (to be by developer to test her changes)" task :'push-staging', :user, :pass do | t, args | - push('staging', args[:user] || nil, args[:pass] || nil) + push('staging', args[:user], args[:pass], false, true) end task :'push-staging' => :'setup' + + + end