extract-repo 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/extract_repo.rb +25 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d5ea6956dc3a02f797894c47d0eaea989ce46d0dcaa355c5e16ef0111719b88
|
4
|
+
data.tar.gz: c03ba66bd8348e32dc8bdc1dc35fd2adb60e9914b87207af01481b2585a54adf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68931f1e4f076a9f2f810b78725092f05b97748c5a602c4d07174350dcd3dc69090b2525f134c55426b50c8e284a1cc3ae28f0497746a0d9019718b80c98579b
|
7
|
+
data.tar.gz: 554b2bc2b3cfa2de1568d7b581f630b9445431c30159bc8c6ccc6b6975fb624dcca937600f56455cdf79607d5740a07f527b06e34a2052d79783b97d6f9e8635
|
data/CHANGELOG.md
CHANGED
data/lib/extract_repo.rb
CHANGED
@@ -116,10 +116,32 @@ class ExtractRepo < Foobara::Command
|
|
116
116
|
def determine_historic_paths
|
117
117
|
chdir output_path do
|
118
118
|
file_paths.dup.each do |file_path|
|
119
|
-
|
119
|
+
renames = {}
|
120
120
|
|
121
|
-
|
122
|
-
|
121
|
+
relevant_sha1s = sh "git log --follow --pretty=format:%H -- \"#{file_path}\""
|
122
|
+
relevant_sha1s = relevant_sha1s.strip.split("\n")
|
123
|
+
|
124
|
+
relevant_sha1s.each do |sha1|
|
125
|
+
status_lines = sh "git diff-tree -M --no-commit-id --name-status -r #{sha1}"
|
126
|
+
status_lines = status_lines.strip.split("\n")
|
127
|
+
|
128
|
+
status_lines.each do |status_line|
|
129
|
+
next unless status_line.start_with?("R")
|
130
|
+
|
131
|
+
similarity, from_path, to_path = status_line.split("\t")
|
132
|
+
similarity = similarity.match(/^R0*(\d+)$/)[1].to_i
|
133
|
+
|
134
|
+
if similarity >= 80
|
135
|
+
renames[to_path] = from_path
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
loop do
|
141
|
+
file_path = renames[file_path]
|
142
|
+
break unless file_path
|
143
|
+
|
144
|
+
file_paths << file_path
|
123
145
|
end
|
124
146
|
end
|
125
147
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extract-repo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '0'
|
79
79
|
requirements: []
|
80
|
-
rubygems_version: 3.6.
|
80
|
+
rubygems_version: 3.6.8
|
81
81
|
specification_version: 4
|
82
82
|
summary: Extract code from one repository into a new repository, preserving history
|
83
83
|
of the extracted files.
|