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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e1ed1bd8
Commit
e1ed1bd8
authored
Nov 09, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gracefully recover from previously failed rebase
parent
66917e3e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletion
+33
-1
app/models/merge_request.rb
app/models/merge_request.rb
+10
-1
changelogs/unreleased-ee/1119-gracefully-recover-from-previously-failed-rebase.yml
...1119-gracefully-recover-from-previously-failed-rebase.yml
+4
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+19
-0
No files found.
app/models/merge_request.rb
View file @
e1ed1bd8
...
...
@@ -785,7 +785,16 @@ class MergeRequest < ActiveRecord::Base
end
def
rebase_in_progress?
File
.
exist?
(
rebase_dir_path
)
File
.
exist?
(
rebase_dir_path
)
&&
!
clean_stuck_rebase
end
def
clean_stuck_rebase
expiration_time
=
Time
.
now
-
15
.
minutes
if
File
.
new
(
rebase_dir_path
).
mtime
<
expiration_time
FileUtils
.
rm_rf
(
rebase_dir_path
)
true
end
end
def
diverged_commits_count
...
...
changelogs/unreleased-ee/1119-gracefully-recover-from-previously-failed-rebase.yml
0 → 100644
View file @
e1ed1bd8
---
title
:
Gracefully recover from previously failed rebase
merge_request
:
author
:
spec/models/merge_request_spec.rb
View file @
e1ed1bd8
...
...
@@ -751,6 +751,25 @@ describe MergeRequest, models: true do
subject
{
create
:merge_request
,
:simple
}
end
describe
'#rebase_in_progress?'
do
it
'return true'
do
allow
(
File
).
to
receive
(
:exist?
).
and_return
(
true
)
allow
(
File
).
to
receive
(
:new
).
and_return
(
double
(
:file
,
mtime:
Time
.
now
))
expect
(
subject
.
rebase_in_progress?
).
to
be_truthy
end
it
'return false'
do
allow
(
File
).
to
receive
(
:exist?
).
with
(
subject
.
rebase_dir_path
).
and_return
(
false
)
expect
(
subject
.
rebase_in_progress?
).
to
be_falsey
end
it
'return false if temporary file exists by is expired'
do
allow
(
File
).
to
receive
(
:exist?
).
and_return
(
true
)
allow
(
File
).
to
receive
(
:new
).
and_return
(
double
(
:file
,
mtime:
Time
.
now
-
2
.
hours
))
expect
(
subject
.
rebase_in_progress?
).
to
be_falsey
end
end
describe
'#commits_sha'
do
let
(
:commit0
)
{
double
(
'commit0'
,
sha:
'sha1'
)
}
let
(
:commit1
)
{
double
(
'commit1'
,
sha:
'sha2'
)
}
...
...
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