socialcast-git-extensions 3.1.7 → 3.1.8
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
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTMxY2JlODhkMDhlYTE4YzkzMDg5MTExYzRiMGI2MzRmOWJjMzM3MA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTk4YTgyNDc4ZGRlMzU2NWJhMWEzNzYxYmNhN2Y3ZDcyMDgxNGQzMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzVkOTkxMmRjOTY1Yzg3ZjlhMTAzMWMwZTBmMzUxYzY3MmFmN2ExZmVmZTk2
|
10
|
+
MGQ1MGMzZTFhMzFhMDdlYTNhYTNlMDVmYTJlOTM3NzcxOTMwZjljNDgwODA0
|
11
|
+
ZDAwM2ZiOGEyNmFiMGQyNWQ2NjNhYzE1OGM4Y2ViYjYwMmJlNzc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjQxZTRmMTE5MTEzMzk1ZDBmY2I1OGI1ZjJiM2YwMjdkMWQ2YzA0NjE5YTQ5
|
14
|
+
MGEzMGZjYjA2MWVlODdmZGY3OTAxMWNkYTRjZDRlOTI1MDlhMDc0NjEwZTJm
|
15
|
+
YmE3MjliMTNjMWE3YTcwN2EyZTYzNjU2ZWUyYmIyNTEyNGQwYzA=
|
@@ -72,10 +72,10 @@ module Socialcast
|
|
72
72
|
say "Deleting branches that have been merged into "
|
73
73
|
say base_branch, :green
|
74
74
|
branches(:merged => true, :remote => true).each do |branch|
|
75
|
-
run_cmd "git push origin --delete #{branch}" unless
|
75
|
+
run_cmd "git push origin --delete #{branch}" unless reserved_branch?(branch)
|
76
76
|
end
|
77
77
|
branches(:merged => true).each do |branch|
|
78
|
-
run_cmd "git branch -d #{branch}" unless
|
78
|
+
run_cmd "git branch -d #{branch}" unless reserved_branch?(branch)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -6,7 +6,7 @@ module Socialcast
|
|
6
6
|
module Git
|
7
7
|
private
|
8
8
|
def assert_not_protected_branch!(branch, action)
|
9
|
-
raise "Cannot #{action} reserved branch" if
|
9
|
+
raise "Cannot #{action} reserved branch" if reserved_branch?(branch)
|
10
10
|
end
|
11
11
|
|
12
12
|
# lookup the current branch of the PWD
|
@@ -38,7 +38,7 @@ module Socialcast
|
|
38
38
|
output.each do |branch|
|
39
39
|
branch = branch.gsub(/\*/, '').strip.split(' ').first
|
40
40
|
branch = branch.split('/').last if options[:remote]
|
41
|
-
branches << branch unless
|
41
|
+
branches << branch unless reserved_branch?(branch)
|
42
42
|
end
|
43
43
|
branches.uniq
|
44
44
|
end
|
@@ -105,6 +105,10 @@ module Socialcast
|
|
105
105
|
aggregate_branches.include?(branch) || branch.starts_with?('last_known_good')
|
106
106
|
end
|
107
107
|
|
108
|
+
def reserved_branch?(branch)
|
109
|
+
aggregate_branch?(branch) || reserved_branches.include?(branch)
|
110
|
+
end
|
111
|
+
|
108
112
|
# build a summary of changes
|
109
113
|
def changelog_summary(branch)
|
110
114
|
changes = `git diff --stat origin/#{base_branch}...#{branch}`.split("\n")
|
data/spec/cli_spec.rb
CHANGED
@@ -391,4 +391,21 @@ describe Socialcast::Gitx::CLI do
|
|
391
391
|
]
|
392
392
|
end
|
393
393
|
end
|
394
|
+
|
395
|
+
describe '#cleanup' do
|
396
|
+
before do
|
397
|
+
Socialcast::Gitx::CLI.any_instance.should_receive(:branches).with(:merged => true, :remote => true).and_return(['master', 'foobar', 'last_known_good_master'])
|
398
|
+
Socialcast::Gitx::CLI.any_instance.should_receive(:branches).with(:merged => true).and_return(['staging', 'bazquux', 'last_known_good_prototype'])
|
399
|
+
Socialcast::Gitx::CLI.start ['cleanup']
|
400
|
+
end
|
401
|
+
it 'should only cleanup non-reserved branches' do
|
402
|
+
Socialcast::Gitx::CLI.stubbed_executed_commands.should == [
|
403
|
+
"git checkout master",
|
404
|
+
"git pull",
|
405
|
+
"git remote prune origin",
|
406
|
+
"git push origin --delete foobar",
|
407
|
+
"git branch -d bazquux"
|
408
|
+
]
|
409
|
+
end
|
410
|
+
end
|
394
411
|
end
|