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
Tatuya Kamada
gitlab-ce
Commits
65549a58
Commit
65549a58
authored
Jul 15, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add project name and namespace to filename on project export
added changelog
parent
86f83db2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
3 deletions
+33
-3
CHANGELOG
CHANGELOG
+1
-0
app/services/projects/import_export/export_service.rb
app/services/projects/import_export/export_service.rb
+1
-1
lib/gitlab/import_export.rb
lib/gitlab/import_export.rb
+7
-0
lib/gitlab/import_export/saver.rb
lib/gitlab/import_export/saver.rb
+3
-2
spec/lib/gitlab/import_export/import_export_spec.rb
spec/lib/gitlab/import_export/import_export_spec.rb
+21
-0
No files found.
CHANGELOG
View file @
65549a58
...
...
@@ -93,6 +93,7 @@ v 8.10.0 (unreleased)
- Redesign Builds and Pipelines pages
- Change status color and icon for running builds
- Fix markdown rendering for: consecutive labels references, label references that begin with a digit or contains `.`
- Project export filename now includes the project and namespace path
v 8.9.6
- Fix importing of events under notes for GitLab projects. !5154
...
...
app/services/projects/import_export/export_service.rb
View file @
65549a58
...
...
@@ -10,7 +10,7 @@ module Projects
def
save_all
if
[
version_saver
,
project_tree_saver
,
uploads_saver
,
repo_saver
,
wiki_repo_saver
].
all?
(
&
:save
)
Gitlab
::
ImportExport
::
Saver
.
save
(
shared:
@shared
)
Gitlab
::
ImportExport
::
Saver
.
save
(
project:
project
,
shared:
@shared
)
notify_success
else
cleanup_and_notify
...
...
lib/gitlab/import_export.rb
View file @
65549a58
...
...
@@ -3,6 +3,7 @@ module Gitlab
extend
self
VERSION
=
'0.1.1'
FILENAME_LIMIT
=
50
def
export_path
(
relative_path
:)
File
.
join
(
storage_path
,
relative_path
)
...
...
@@ -28,6 +29,12 @@ module Gitlab
'VERSION'
end
def
export_filename
(
project
:)
basename
=
"
#{
Time
.
now
.
strftime
(
'%Y-%m-%d_%H-%M-%3N'
)
}
_
#{
project
.
namespace
.
path
}
_
#{
project
.
path
}
"
"
#{
basename
[
0
..
FILENAME_LIMIT
]
}
_export.tar.gz"
end
def
version
VERSION
end
...
...
lib/gitlab/import_export/saver.rb
View file @
65549a58
...
...
@@ -7,7 +7,8 @@ module Gitlab
new
(
*
args
).
save
end
def
initialize
(
shared
:)
def
initialize
(
project
:,
shared
:)
@project
=
project
@shared
=
shared
end
...
...
@@ -36,7 +37,7 @@ module Gitlab
end
def
archive_file
@archive_file
||=
File
.
join
(
@shared
.
export_path
,
'..'
,
"
#{
Time
.
now
.
strftime
(
'%Y-%m-%d_%H-%M-%3N'
)
}
_project_export.tar.gz"
)
@archive_file
||=
File
.
join
(
@shared
.
export_path
,
'..'
,
Gitlab
::
ImportExport
.
export_filename
(
project:
@project
)
)
end
end
end
...
...
spec/lib/gitlab/import_export/import_export_spec.rb
0 → 100644
View file @
65549a58
require
'spec_helper'
describe
Gitlab
::
ImportExport
,
services:
true
do
describe
'export filename'
do
let
(
:project
)
{
create
(
:project
,
:public
,
path:
'project-path'
)
}
it
'contains the project path'
do
expect
(
described_class
.
export_filename
(
project:
project
)).
to
include
(
project
.
path
)
end
it
'contains the namespace path'
do
expect
(
described_class
.
export_filename
(
project:
project
)).
to
include
(
project
.
namespace
.
path
)
end
it
'does not go over a certain length'
do
project
.
path
=
'a'
*
100
expect
(
described_class
.
export_filename
(
project:
project
).
length
).
to
be
<
70
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