This repository was archived by the owner on Jan 22, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupgrade.rb
More file actions
54 lines (42 loc) · 1.17 KB
/
upgrade.rb
File metadata and controls
54 lines (42 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# frozen_string_literal: true
module Git
module Pkgs
module Commands
class Upgrade
include Output
def initialize(args)
@args = args
@options = parse_options
end
def run
repo = Repository.new
require_database(repo)
Database.connect(repo.git_dir, check_version: false)
stored = Database.stored_version || 0
current = Database::SCHEMA_VERSION
if stored >= current
info "Database is up to date (version #{current})"
return
end
info "Upgrading database from version #{stored} to #{current}..."
info "This requires re-indexing the repository."
info ""
# Run init --force
Init.new(["--force"]).run
end
def parse_options
options = {}
parser = OptionParser.new do |opts|
opts.banner = "Usage: git pkgs upgrade [options]"
opts.on("-h", "--help", "Show this help") do
puts opts
exit
end
end
parser.parse!(@args)
options
end
end
end
end
end