Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
e5f8397f
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e5f8397f
编写于
4月 22, 2012
作者:
V
Valery Sizov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fast automerge: done
上级
dcbb875c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
52 addition
and
21 deletion
+52
-21
app/models/project/hooks_trait.rb
app/models/project/hooks_trait.rb
+2
-2
app/models/project/repository_trait.rb
app/models/project/repository_trait.rb
+2
-15
lib/gitlab_merge.rb
lib/gitlab_merge.rb
+5
-2
lib/gitlabhq/satellite.rb
lib/gitlabhq/satellite.rb
+41
-0
lib/tasks/gitlab/enable_automerge.rake
lib/tasks/gitlab/enable_automerge.rake
+2
-2
未找到文件。
app/models/project/hooks_trait.rb
浏览文件 @
e5f8397f
...
...
@@ -102,8 +102,8 @@ module Project::HooksTrait
# Execute web hooks
self
.
execute_web_hooks
(
oldrev
,
newrev
,
ref
,
user
)
# Create
repo
satellite
self
.
create_repo_satellite
unless
self
.
satellite_
exists?
# Create satellite
self
.
satellite
.
create
unless
self
.
satellite
.
exists?
end
end
end
app/models/project/repository_trait.rb
浏览文件 @
e5f8397f
...
...
@@ -37,21 +37,8 @@ module Project::RepositoryTrait
end
end
def
path_to_repo_satellite
File
.
join
(
Rails
.
root
,
"tmp"
,
"repo_satellites"
,
self
.
path
)
end
def
satellite_exists?
File
.
exist?
path_to_repo_satellite
end
def
create_repo_satellite
`git clone
#{
url_to_repo
}
#{
path_to_repo_satellite
}
`
Dir
.
chdir
(
path_to_repo_satellite
)
do
primary_branch
=
Grit
::
Repo
.
new
(
"."
).
heads
.
first
.
name
#usually it`s master
`git checkout -b __parking_branch`
`git branch -D
#{
primary_branch
}
`
end
def
satellite
@satellite
||=
Gitlabhq
::
Satellite
.
new
(
self
)
end
def
write_hook
(
name
,
content
)
...
...
lib/gitlab_merge.rb
浏览文件 @
e5f8397f
...
...
@@ -29,10 +29,13 @@ class GitlabMerge
File
.
open
(
File
.
join
(
Rails
.
root
,
"tmp"
,
"merge_repo"
,
"
#{
project
.
path
}
.lock"
),
"w+"
)
do
|
f
|
f
.
flock
(
File
::
LOCK_EX
)
unless
project
.
satellite
_
exists?
unless
project
.
satellite
.
exists?
raise
"You should run: rake gitlab_enable_automerge"
end
Dir
.
chdir
(
project
.
path_to_repo_satellite
)
do
project
.
satellite
.
clear
Dir
.
chdir
(
project
.
satellite
.
path
)
do
merge_repo
=
Grit
::
Repo
.
new
(
'.'
)
merge_repo
.
git
.
sh
"git fetch origin"
merge_repo
.
git
.
sh
"git config user.name
\"
#{
user
.
name
}
\"
"
...
...
lib/gitlabhq/satellite.rb
0 → 100644
浏览文件 @
e5f8397f
module
Gitlabhq
class
Satellite
PARKING_BRANCH
=
"__parking_branch"
attr_accessor
:project
def
initialize
project
self
.
project
=
project
end
def
create
`git clone
#{
project
.
url_to_repo
}
#{
path
}
`
end
def
path
File
.
join
(
Rails
.
root
,
"tmp"
,
"repo_satellites"
,
project
.
path
)
end
def
exists?
File
.
exists?
path
end
#will be deleted all branches except PARKING_BRANCH
def
clear
Dir
.
chdir
(
path
)
do
heads
=
Grit
::
Repo
.
new
(
"."
).
heads
.
map
{
|
head
|
head
.
name
}
if
heads
.
include?
PARKING_BRANCH
`git checkout
#{
PARKING_BRANCH
}
`
else
`git checkout -b
#{
PARKING_BRANCH
}
`
end
heads
.
delete
(
PARKING_BRANCH
)
heads
.
each
do
|
head
|
`git branch -D
#{
head
}
`
end
end
end
end
end
lib/tasks/gitlab/enable_automerge.rake
浏览文件 @
e5f8397f
...
...
@@ -7,9 +7,9 @@ namespace :gitlab do
end
Project
.
find_each
do
|
project
|
if
project
.
repo_exists?
&&
!
project
.
satellite
_
exists?
if
project
.
repo_exists?
&&
!
project
.
satellite
.
exists?
puts
"Creating satellite for
#{
project
.
name
}
..."
.
green
project
.
create_repo_satelli
te
project
.
satellite
.
crea
te
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录