Commit aa5821e5 authored by Stan Hu's avatar Stan Hu

Assorted Bitbucket Server importer code cleanup based on review

parent 636bcebc
......@@ -13,7 +13,7 @@ class Import::BitbucketServerController < Import::BaseController
# Repository names are limited to 128 characters. They must start with a
# letter or number and may contain spaces, hyphens, underscores, and periods.
# (https://community.atlassian.com/t5/Answers-Developer-Questions/stash-repository-names/qaq-p/499054)
VALID_BITBUCKET_CHARS = /\A[a-zA-z0-9\-_\.\s]+\z/
VALID_BITBUCKET_CHARS = /\A[\w\-_\.\s]+\z/
def new
end
......
......@@ -41,12 +41,9 @@
= link_to project.full_path, [project.namespace.becomes(Namespace), project]
%td.job-status
- if project.import_status == 'finished'
%span
%i.fa.fa-check
Done
= icon('check', text: 'Done')
- elsif project.import_status == 'started'
%i.fa.fa-spinner.fa-spin
started
= icon('spin', text: 'started')
- else
= project.human_import_status_name
......
......@@ -12,10 +12,10 @@ module BitbucketServer
ConnectionError = Class.new(StandardError)
def initialize(options = {})
@api_version = options.fetch(:api_version, DEFAULT_API_VERSION)
@base_uri = options[:base_uri]
@username = options[:user]
@token = options[:password]
@api_version = options.fetch(:api_version, DEFAULT_API_VERSION)
@base_uri = options[:base_uri]
@username = options[:user]
@token = options[:password]
end
def get(path, extra_query = {})
......
......@@ -20,7 +20,7 @@ module BitbucketServer
private
def parse_attrs(raw)
raw.slice(*%w(size nextPageStart isLastPage)).symbolize_keys
raw.slice('size', 'nextPageStart', 'isLastPage').symbolize_keys
end
def parse_values(raw, bitbucket_rep_class)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment