274 lines
10 KiB
HTML
274 lines
10 KiB
HTML
|
<?xml version="1.0" encoding="utf-8"?>
|
||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||
|
<head>
|
||
|
<title>Gitlab::Satellite::MergeAction</title>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||
|
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
|
||
|
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
|
||
|
<link rel="stylesheet" href="../../../css/github.css" type="text/css" media="screen" />
|
||
|
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
|
||
|
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
|
||
|
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
|
||
|
<script src="../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<div class="banner">
|
||
|
|
||
|
<h1>
|
||
|
<span class="type">Class</span>
|
||
|
Gitlab::Satellite::MergeAction
|
||
|
|
||
|
<span class="parent"><
|
||
|
|
||
|
Action
|
||
|
|
||
|
</span>
|
||
|
|
||
|
</h1>
|
||
|
<ul class="files">
|
||
|
|
||
|
<li><a href="../../../files/lib/gitlab/satellite/merge_action_rb.html">lib/gitlab/satellite/merge_action.rb</a></li>
|
||
|
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div id="bodyContent">
|
||
|
<div id="content">
|
||
|
|
||
|
<div class="description">
|
||
|
|
||
|
<p>GitLab server-side merge</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<!-- Method ref -->
|
||
|
<div class="sectiontitle">Methods</div>
|
||
|
<dl class="methods">
|
||
|
|
||
|
<dt>C</dt>
|
||
|
<dd>
|
||
|
<ul>
|
||
|
|
||
|
|
||
|
<li>
|
||
|
<a href="#method-i-can_be_merged-3F">can_be_merged?</a>
|
||
|
</li>
|
||
|
|
||
|
</ul>
|
||
|
</dd>
|
||
|
|
||
|
<dt>M</dt>
|
||
|
<dd>
|
||
|
<ul>
|
||
|
|
||
|
|
||
|
<li>
|
||
|
<a href="#method-i-merge-21">merge!</a>
|
||
|
</li>
|
||
|
|
||
|
</ul>
|
||
|
</dd>
|
||
|
|
||
|
<dt>N</dt>
|
||
|
<dd>
|
||
|
<ul>
|
||
|
|
||
|
|
||
|
<li>
|
||
|
<a href="#method-c-new">new</a>
|
||
|
</li>
|
||
|
|
||
|
</ul>
|
||
|
</dd>
|
||
|
|
||
|
</dl>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<!-- Section attributes -->
|
||
|
<div class="sectiontitle">Attributes</div>
|
||
|
<table border='0' cellpadding='5'>
|
||
|
|
||
|
<tr valign='top'>
|
||
|
<td class='attr-rw'>
|
||
|
[RW]
|
||
|
</td>
|
||
|
<td class='attr-name'>merge_request</td>
|
||
|
<td class='attr-desc'></td>
|
||
|
</tr>
|
||
|
|
||
|
</table>
|
||
|
|
||
|
|
||
|
|
||
|
<!-- Methods -->
|
||
|
|
||
|
<div class="sectiontitle">Class Public methods</div>
|
||
|
|
||
|
<div class="method">
|
||
|
<div class="title method-title" id="method-c-new">
|
||
|
|
||
|
<b>new</b>(user, merge_request)
|
||
|
|
||
|
<a href="../../../classes/Gitlab/Satellite/MergeAction.html#method-c-new" name="method-c-new" class="permalink">Link</a>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="description">
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="sourcecode">
|
||
|
|
||
|
<p class="source-link">
|
||
|
Source:
|
||
|
<a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
|
||
|
|
||
|
</p>
|
||
|
<div id="method-c-new_source" class="dyn-source">
|
||
|
<pre><span class="ruby-comment"># File lib/gitlab/satellite/merge_action.rb, line 7</span>
|
||
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span>(<span class="ruby-identifier">user</span>, <span class="ruby-identifier">merge_request</span>)
|
||
|
<span class="ruby-keyword">super</span> <span class="ruby-identifier">user</span>, <span class="ruby-identifier">merge_request</span>.<span class="ruby-identifier">project</span>
|
||
|
<span class="ruby-ivar">@merge_request</span> = <span class="ruby-identifier">merge_request</span>
|
||
|
<span class="ruby-keyword">end</span></pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="sectiontitle">Instance Public methods</div>
|
||
|
|
||
|
<div class="method">
|
||
|
<div class="title method-title" id="method-i-can_be_merged-3F">
|
||
|
|
||
|
<b>can_be_merged?</b>()
|
||
|
|
||
|
<a href="../../../classes/Gitlab/Satellite/MergeAction.html#method-i-can_be_merged-3F" name="method-i-can_be_merged-3F" class="permalink">Link</a>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="description">
|
||
|
<p>Checks if a merge request can be executed without user interaction</p>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="sourcecode">
|
||
|
|
||
|
<p class="source-link">
|
||
|
Source:
|
||
|
<a href="javascript:toggleSource('method-i-can_be_merged-3F_source')" id="l_method-i-can_be_merged-3F_source">show</a>
|
||
|
|
||
|
</p>
|
||
|
<div id="method-i-can_be_merged-3F_source" class="dyn-source">
|
||
|
<pre><span class="ruby-comment"># File lib/gitlab/satellite/merge_action.rb, line 13</span>
|
||
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">can_be_merged?</span>
|
||
|
<span class="ruby-identifier">in_locked_and_timed_satellite</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">merge_repo</span><span class="ruby-operator">|</span>
|
||
|
<span class="ruby-identifier">merge_in_satellite!</span>(<span class="ruby-identifier">merge_repo</span>)
|
||
|
<span class="ruby-keyword">end</span>
|
||
|
<span class="ruby-keyword">end</span></pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="method">
|
||
|
<div class="title method-title" id="method-i-merge-21">
|
||
|
|
||
|
<b>merge!</b>()
|
||
|
|
||
|
<a href="../../../classes/Gitlab/Satellite/MergeAction.html#method-i-merge-21" name="method-i-merge-21" class="permalink">Link</a>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="description">
|
||
|
<p>Merges the source branch into the target branch in the satellite and pushes
|
||
|
it back to <a href="../Gitolite.html">Gitolite</a>. It also removes the
|
||
|
source branch if requested in the merge request.</p>
|
||
|
|
||
|
<p>Returns false if the merge produced conflicts Returns false if pushing from
|
||
|
the satellite to <a href="../Gitolite.html">Gitolite</a> failed or was
|
||
|
rejected Returns true otherwise</p>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="sourcecode">
|
||
|
|
||
|
<p class="source-link">
|
||
|
Source:
|
||
|
<a href="javascript:toggleSource('method-i-merge-21_source')" id="l_method-i-merge-21_source">show</a>
|
||
|
|
||
|
</p>
|
||
|
<div id="method-i-merge-21_source" class="dyn-source">
|
||
|
<pre><span class="ruby-comment"># File lib/gitlab/satellite/merge_action.rb, line 26</span>
|
||
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">merge!</span>
|
||
|
<span class="ruby-identifier">in_locked_and_timed_satellite</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">merge_repo</span><span class="ruby-operator">|</span>
|
||
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">merge_in_satellite!</span>(<span class="ruby-identifier">merge_repo</span>)
|
||
|
<span class="ruby-comment"># push merge back to Gitolite</span>
|
||
|
<span class="ruby-comment"># will raise CommandFailed when push fails</span>
|
||
|
<span class="ruby-identifier">merge_repo</span>.<span class="ruby-identifier">git</span>.<span class="ruby-identifier">push</span>({<span class="ruby-identifier">raise</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>, <span class="ruby-identifier">timeout</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>}, <span class="ruby-value">:origin</span>, <span class="ruby-identifier">merge_request</span>.<span class="ruby-identifier">target_branch</span>)
|
||
|
|
||
|
<span class="ruby-comment"># remove source branch</span>
|
||
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">merge_request</span>.<span class="ruby-identifier">should_remove_source_branch</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">project</span>.<span class="ruby-identifier">root_ref?</span>(<span class="ruby-identifier">merge_request</span>.<span class="ruby-identifier">source_branch</span>)
|
||
|
<span class="ruby-comment"># will raise CommandFailed when push fails</span>
|
||
|
<span class="ruby-identifier">merge_repo</span>.<span class="ruby-identifier">git</span>.<span class="ruby-identifier">push</span>({<span class="ruby-identifier">raise</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>, <span class="ruby-identifier">timeout</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>}, <span class="ruby-value">:origin</span>, <span class="ruby-node">":#{merge_request.source_branch}"</span>)
|
||
|
<span class="ruby-keyword">end</span>
|
||
|
|
||
|
<span class="ruby-comment"># merge, push and branch removal successful</span>
|
||
|
<span class="ruby-keyword">true</span>
|
||
|
<span class="ruby-keyword">end</span>
|
||
|
<span class="ruby-keyword">end</span>
|
||
|
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Grit</span><span class="ruby-operator">::</span><span class="ruby-constant">Git</span><span class="ruby-operator">::</span><span class="ruby-constant">CommandFailed</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">ex</span>
|
||
|
<span class="ruby-constant">Gitlab</span><span class="ruby-operator">::</span><span class="ruby-constant">GitLogger</span>.<span class="ruby-identifier">error</span>(<span class="ruby-identifier">ex</span>.<span class="ruby-identifier">message</span>)
|
||
|
<span class="ruby-keyword">false</span>
|
||
|
<span class="ruby-keyword">end</span></pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|