rakelib/workflow.rake
changeset 325 7d9550327b8d
parent 322 d31ea885c8fa
child 326 42a9250a00b2
equal deleted inserted replaced
324:980eac9a7a1d 325:7d9550327b8d
    23       opts = {
    23       opts = {
    24           :user => user,
    24           :user => user,
    25           :pass => pass,
    25           :pass => pass,
    26       }
    26       }
    27       paths = hg.paths
    27       paths = hg.paths
    28       remote_used = remote
    28       unless paths[remote]
    29       if remote_used == 'upstream'
    29         puts ''
    30         remote_used = 'canonical' unless paths['upstream']
    30         puts "!! repository #{hg.path} has no #{remote} repository defined - skipping !!"
    31       elsif remote_used == 'staging'
    31         puts ''
    32         unless paths['staging']
    32         return
    33           puts ''
       
    34           puts "!! repository #{hg.path} has not staging repository defined - skipping !!"
       
    35           puts ''
       
    36           return
       
    37         end
       
    38       end
    33       end
    39 
    34 
    40       # STC and librun are special - never push them automatically
    35       # STC and librun are special - never push them automatically
    41       # to upstream / canonical repo, must be done manually. This is 
    36       # to upstream / default repo, must be done manually. This is
    42       # mainly beacuse there are on separate protected repositories 
    37       # mainly beacuse there are on separate protected repositories
    43       # not accessible without a special setup. Sigh...
    38       # not accessible without a special setup. Sigh...
    44       if ((pkg.name == 'stx:stc') or (pkg.name == 'stx:librun')) and ((remote_used == 'upstream') or (remote_used == 'canonical'))
    39       if ((pkg.name == 'stx:stc') or (pkg.name == 'stx:librun')) and ((remote == 'upstream') or (remote == 'canonical'))
    45         if !review_only
    40         if !review_only
    46           puts ''
    41           puts ''
    47           puts "== Skipping push of #{pkg.name} - you must push manually =="
    42           puts "== Skipping push of #{pkg.name} - you must push manually =="
    48           puts''
    43           puts''
    49         end
    44         end
    50       else
    45       else
    51         has_changes_in_this_repo = false
    46         has_changes_in_this_repo = false
    52         if review_only or STDIN.tty?
    47         if review_only or STDIN.tty?
    53           opts[:rev] = '.'
    48           opts[:rev] = '.'
    54           remote_url = hg.paths[remote_used] || remote_used
    49           remote_url = hg.paths[remote] || remote
    55           bookmark = hg.bookmark
    50           bookmark = hg.bookmark
    56           hg.outgoing(remote_used, **opts) do | status, stdout |
    51           hg.outgoing(remote, **opts) do | status, stdout |
    57             case status.exitstatus
    52             case status.exitstatus
    58             when 0
    53             when 0
    59               puts ''
    54               puts ''
    60               puts "== changes going to #{remote_url} =="
    55               puts "== changes going to #{remote_url} =="
    61               STDOUT.print stdout
    56               STDOUT.print stdout
    71           end
    66           end
    72         end
    67         end
    73         if not review_only
    68         if not review_only
    74           if not STDIN.tty? or (has_changes_in_this_repo and yesNO("Push to #{remote_url}")) then
    69           if not STDIN.tty? or (has_changes_in_this_repo and yesNO("Push to #{remote_url}")) then
    75             (push_bookmark && bookmark) ? (opts[:bookmarks] = ['.']) : (opts[:rev] = '.') # bookmark can be uninitialized
    70             (push_bookmark && bookmark) ? (opts[:bookmarks] = ['.']) : (opts[:rev] = '.') # bookmark can be uninitialized
    76             hg.push(remote_used, **opts)
    71             hg.push(remote, **opts)
    77             has_changes = true
    72             has_changes = true
    78           end
    73           end
    79         end
    74         end
    80       end
    75       end
    81     end
    76     end