lib/gitscape/base.rb in gitscape-1.3.4 vs lib/gitscape/base.rb in gitscape-1.3.5

- old
+ new

@@ -56,12 +56,12 @@ live_current_version_number end def git_has_conflicts puts_conflicts=true - conflicts_status = `git status --porcelain | grep UU` - has_conflicts = conflicts_status.length > 0 + conflicts_status = `git status --porcelain` + has_conflicts = conflicts_status.scan(/[AUD]{2}/).count > 0 puts conflicts_status if has_conflicts && puts_conflicts has_conflicts end @@ -196,20 +196,25 @@ \tPlease resolve this and try again." exit 3 end end + # Checkout release branch + puts `git checkout #{release_branch_name}` + puts `git pull live` + # Checkout live - `git checkout live` + puts `git checkout live` + puts `git pull live` # Record the revision of live used for the rollback tag live_rollback_revision = `git log -n1 --oneline`.scan(/(^[^ ]+) .*$/).flatten[0] merge_options = "--no-ff -s recursive -Xignore-space-change" # Merge the release branch into live - `git merge #{merge_options} #{release_branch_name}` + puts `git merge #{merge_options} #{release_branch_name}` # Error and conflict checking if !$?.success? then exit 4 end if git_has_conflicts then puts "Merge conflicts when pulling #{release_branch_name} into live" @@ -228,36 +233,36 @@ # Record the revision of live used for the release tag live_release_revision = `git log -n1 --oneline`.scan(/(^[^ ]+) .*$/).flatten[0] # Merge the release branch into master - `git checkout master` - `git merge #{merge_options} #{release_branch_name}` + puts `git checkout master` + puts `git pull` + puts `git merge #{merge_options} #{release_branch_name}` # Error and conflict checking if !$?.success? then exit 4 end if git_has_conflicts then puts "Merge conflicts when pulling #{release_branch_name} into master" puts "Please bother Xavier if you see this message :)" exit 2 end # Tag the state of live for both release and rollback - `git tag rollback-to/i#{current_version_number} #{live_rollback_revision}` + puts `git tag rollback-to/i#{current_version_number} #{live_rollback_revision}` if !$?.success? then puts "=== WARNING: Failed to create rollback-to/i#{current_version_number} tag" - `git tag -d rollback-to/i#{current_version_number}` end `git tag live/i#{new_version_number}/release #{live_release_revision}` if !$?.success? then - `git tag -d rollback-to/i#{current_version_number}` - `git tag -d live/i#{new_version_number}/release #{live_release_revision}` + puts "=== WARNING: Failed to create live/i#{new_version_number}/release" + puts `git tag -d rollback-to/i#{current_version_number}` exit 4 end - `git push origin live --tags` - `git push origin master` + puts `git push origin live --tags` + puts `git push origin master` end # Returns true if the supplied Git commit hash or reference exists def self.commit_exists?(commit_id) `git rev-parse #{commit_id}`