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
972b84b9
Commit
972b84b9
authored
Jun 23, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Geo::RepositoryRenamedEventStore
parent
cf6688fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
app/services/geo/repository_renamed_event_store.rb
app/services/geo/repository_renamed_event_store.rb
+44
-0
No files found.
app/services/geo/repository_renamed_event_store.rb
0 → 100644
View file @
972b84b9
module
Geo
class
RepositoryRenamedEventStore
attr_reader
:project
,
:old_repo_path
,
:old_wiki_path
,
:old_name
def
initialize
(
project
,
old_repo_path
:,
old_wiki_path
:,
old_name
:)
@project
=
project
@old_repo_path
=
old_repo_path
@old_wiki_path
=
old_wiki_path
@old_name
=
old_name
end
def
create
return
unless
Gitlab
::
Geo
.
primary?
Geo
::
EventLog
.
transaction
do
event_log
=
Geo
::
EventLog
.
new
event_log
.
repository_renamed_event
=
build_event
event_log
.
save!
end
rescue
ActiveRecord
::
RecordInvalid
log
(
"Renamed event could not be created"
)
end
private
def
build_event
Geo
::
RepositoryDeletedEvent
.
new
(
project:
project
,
repository_storage_name:
project
.
repository
.
storage
,
repository_storage_path:
project
.
repository_storage_path
,
new_path_with_namespace:
project
.
full_path
old_path_with_namespace:
old_repo_path
,
old_wiki_path_with_namespace:
old_wiki_path
,
new_wiki_path_with_namespace:
project
.
wiki
.
path_with_namespace
,
old_project_name:
old_project_name
,
new_project_name:
project
.
name
)
end
def
log
(
message
)
Rails
.
logger
.
info
(
"
#{
self
.
class
.
name
}
:
#{
message
}
for project
#{
project
.
path_with_namespace
}
(
#{
project
.
id
}
)"
)
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