Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
2ef45507
Commit
2ef45507
authored
Jul 16, 2014
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gitlab::Git::Compare in Satellite::CompareAction
parent
de582ab3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
lib/gitlab/satellite/compare_action.rb
lib/gitlab/satellite/compare_action.rb
+6
-9
No files found.
lib/gitlab/satellite/compare_action.rb
View file @
2ef45507
...
@@ -17,11 +17,7 @@ module Gitlab
...
@@ -17,11 +17,7 @@ module Gitlab
in_locked_and_timed_satellite
do
|
target_repo
|
in_locked_and_timed_satellite
do
|
target_repo
|
prepare_satellite!
(
target_repo
)
prepare_satellite!
(
target_repo
)
update_satellite_source_and_target!
(
target_repo
)
update_satellite_source_and_target!
(
target_repo
)
common_commit
=
target_repo
.
git
.
native
(
:merge_base
,
default_options
,
[
"origin/
#{
@target_branch
}
"
,
"source/
#{
@source_branch
}
"
]).
strip
compare
(
target_repo
).
diffs
#this method doesn't take default options
diffs
=
target_repo
.
diff
(
common_commit
,
"source/
#{
@source_branch
}
"
)
diffs
=
diffs
.
map
{
|
diff
|
Gitlab
::
Git
::
Diff
.
new
(
diff
)
}
diffs
end
end
rescue
Grit
::
Git
::
CommandFailed
=>
ex
rescue
Grit
::
Git
::
CommandFailed
=>
ex
raise
BranchesWithoutParent
raise
BranchesWithoutParent
...
@@ -32,9 +28,7 @@ module Gitlab
...
@@ -32,9 +28,7 @@ module Gitlab
in_locked_and_timed_satellite
do
|
target_repo
|
in_locked_and_timed_satellite
do
|
target_repo
|
prepare_satellite!
(
target_repo
)
prepare_satellite!
(
target_repo
)
update_satellite_source_and_target!
(
target_repo
)
update_satellite_source_and_target!
(
target_repo
)
commits
=
target_repo
.
commits_between
(
"origin/
#{
@target_branch
}
"
,
"source/
#{
@source_branch
}
"
)
compare
(
target_repo
).
commits
commits
=
commits
.
map
{
|
commit
|
Gitlab
::
Git
::
Commit
.
new
(
commit
,
nil
)
}
commits
end
end
rescue
Grit
::
Git
::
CommandFailed
=>
ex
rescue
Grit
::
Git
::
CommandFailed
=>
ex
handle_exception
(
ex
)
handle_exception
(
ex
)
...
@@ -46,10 +40,13 @@ module Gitlab
...
@@ -46,10 +40,13 @@ module Gitlab
def
update_satellite_source_and_target!
(
target_repo
)
def
update_satellite_source_and_target!
(
target_repo
)
target_repo
.
remote_add
(
'source'
,
@source_project
.
repository
.
path_to_repo
)
target_repo
.
remote_add
(
'source'
,
@source_project
.
repository
.
path_to_repo
)
target_repo
.
remote_fetch
(
'source'
)
target_repo
.
remote_fetch
(
'source'
)
target_repo
.
git
.
checkout
(
default_options
({
b:
true
}),
@target_branch
,
"origin/
#{
@target_branch
}
"
)
rescue
Grit
::
Git
::
CommandFailed
=>
ex
rescue
Grit
::
Git
::
CommandFailed
=>
ex
handle_exception
(
ex
)
handle_exception
(
ex
)
end
end
def
compare
(
repo
)
@compare
||=
Gitlab
::
Git
::
Compare
.
new
(
Gitlab
::
Git
::
Repository
.
new
(
repo
.
path
),
"origin/
#{
@target_branch
}
"
,
"source/
#{
@source_branch
}
"
)
end
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment