git-shuffle 0.0.3 → 0.0.4
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/README.md +1 -1
- data/bin/git-shuffle +27 -9
- data/lib/version.rb +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a1d3eff65bae439bbc452eb988ac9af9f969c57
|
4
|
+
data.tar.gz: a43424ecb3d6f32e0fc8ac754314bf9f1aa6456a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19996011a8b5964c01aa797d9bb6e3ade3a3bc0f360d97ef6690338a7ffbd50d242e58dd000379dd7b57aa03ad5545105fc78f85f34ccaa9cde0bedd10a1f428
|
7
|
+
data.tar.gz: ddad6ee3b8380140595311d707ae454254da49e40c2460df1c55630248fc972d7d42ae990e962863e434332c3739f2a51b2441ba8082a2487f6018757f685559
|
data/README.md
CHANGED
data/bin/git-shuffle
CHANGED
@@ -6,25 +6,34 @@ require 'optparse'
|
|
6
6
|
|
7
7
|
options = {}
|
8
8
|
OptionParser.new do |opts|
|
9
|
-
opts.banner = "Usage:
|
9
|
+
opts.banner = "Usage: git-shuffle [options]"
|
10
10
|
|
11
11
|
opts.on("-p path", "--path=path", "Path to the target respository") do |path|
|
12
12
|
options[:path] = path
|
13
13
|
end
|
14
|
+
opts.on("-i interval", "--interval=interval", "How frequent is repo updated in days") do |interval|
|
15
|
+
options[:interval] = interval.to_i
|
16
|
+
end
|
17
|
+
opts.on("-a author", "--author=author", "Author of all commits") do |author|
|
18
|
+
options[:author] = author
|
19
|
+
puts "Setting author email to #{author}..."
|
20
|
+
end
|
21
|
+
opts.on("-c committer", "--committer=committer", "Committer of all commits") do |committer|
|
22
|
+
options[:committer] = committer
|
23
|
+
puts "Setting committer email to #{committer}..."
|
24
|
+
end
|
14
25
|
end.parse!
|
15
26
|
|
16
|
-
if options[:path] == nil
|
17
|
-
puts 'Using current directory...'
|
18
|
-
options[:path] = Dir.pwd
|
19
|
-
end
|
20
27
|
|
21
|
-
Dir.
|
28
|
+
options[:path] = Dir.pwd if options[:path] == nil
|
29
|
+
options[:interval] = 7 if options[:interval] == nil
|
22
30
|
|
23
|
-
|
31
|
+
Dir.chdir options[:path]
|
32
|
+
puts "Working directory: #{options[:path]}, #{options[:interval]} days per commit on average..."
|
24
33
|
|
25
34
|
no_of_all_commits = %x(git log --pretty=format:"%H" | wc -w)
|
26
35
|
no_of_all_commits = no_of_all_commits.to_i
|
27
|
-
development_days_for_repo = no_of_all_commits *
|
36
|
+
development_days_for_repo = no_of_all_commits * options[:interval]
|
28
37
|
puts "Spreading #{no_of_all_commits} commits into #{development_days_for_repo} days."
|
29
38
|
|
30
39
|
days_offset = []
|
@@ -45,8 +54,17 @@ days_offset.each do |offset|
|
|
45
54
|
new_time = Time.new(date.year, date.month, date.day, (18..23).to_a.sample, (0..59).to_a.sample, (0..59).to_a.sample, "+02:00").to_s
|
46
55
|
puts "[#{index}/#{no_of_all_commits}] Set commit #{commit_hash} to #{offset} days ago: #{new_time}"
|
47
56
|
|
57
|
+
extra_cmd = ''
|
58
|
+
if options[:author]
|
59
|
+
extra_cmd += "export GIT_AUTHOR_EMAIL=#{options[:author]}; "
|
60
|
+
end
|
61
|
+
if options[:committer]
|
62
|
+
extra_cmd += "export GIT_COMMITTER_EMAIL=#{options[:committer]}; "
|
63
|
+
end
|
64
|
+
|
48
65
|
command = <<-FOO
|
49
|
-
git filter-branch -f --env-filter "if test \\$GIT_COMMIT = \'#{commit_hash}\' ; then export GIT_AUTHOR_DATE='#{new_time}'; export GIT_COMMITTER_DATE='#{new_time}'; fi && rm -fr '.git/refs/original/'"
|
66
|
+
git filter-branch -f --env-filter "if test \\$GIT_COMMIT = \'#{commit_hash}\' ; then export GIT_AUTHOR_DATE='#{new_time}'; export GIT_COMMITTER_DATE='#{new_time}'; #{extra_cmd} fi && rm -fr '.git/refs/original/'"
|
50
67
|
FOO
|
68
|
+
puts command
|
51
69
|
system(command)
|
52
70
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-shuffle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Han
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: timerizer
|
@@ -37,7 +37,8 @@ files:
|
|
37
37
|
homepage: http://rubygems.org/gems/git-shuffle
|
38
38
|
licenses:
|
39
39
|
- MIT
|
40
|
-
metadata:
|
40
|
+
metadata:
|
41
|
+
source_code_uri: https://github.com/hex0cter/git-shuffle
|
41
42
|
post_install_message:
|
42
43
|
rdoc_options: []
|
43
44
|
require_paths:
|