summaryrefslogtreecommitdiff
path: root/tool/redmine-backporter.rb
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2021-02-02 19:14:37 +0900
committerNARUSE, Yui <naruse@airemix.jp>2021-02-02 19:14:37 +0900
commitd29cb56bfa40f8c077518623b63bb26988fbe60e (patch)
treec3a2072135cf1cf113926f429bbe42be1fa1f26e /tool/redmine-backporter.rb
parentce2062dee6405030091966c47b1124ec9a4c62d4 (diff)
Use local repository instead of remote
to improve performance
Diffstat (limited to 'tool/redmine-backporter.rb')
-rwxr-xr-xtool/redmine-backporter.rb15
1 files changed, 7 insertions, 8 deletions
diff --git a/tool/redmine-backporter.rb b/tool/redmine-backporter.rb
index 9d1f5fbe48..06c37ab811 100755
--- a/tool/redmine-backporter.rb
+++ b/tool/redmine-backporter.rb
@@ -244,6 +244,11 @@ def find_git_log(pattern)
`git #{RUBY_REPO_PATH ? "-C #{RUBY_REPO_PATH.shellescape}" : ""} log --grep="#{pattern}"`
end
+def has_commit(commit, branch)
+ base = RUBY_REPO_PATH ? ["-C", RUBY_REPO_PATH.shellescape] : nil
+ system("git", *base, "merge-base", "--is-ancestor", commit, branch)
+end
+
def show_last_journal(http, uri)
res = http.get("#{uri.path}?include=journals")
res.value
@@ -269,14 +274,8 @@ def backport_command_string
@changesets = @changesets.select do |c|
next false if c.match(/\A\d{1,6}\z/) # skip SVN revision
- # check if the Git revision is included in trunk
- begin
- uri = URI("#{REDMINE_BASE}/projects/ruby-master/repository/git/revisions/#{c}")
- uri.read($openuri_options)
- true
- rescue
- false
- end
+ # check if the Git revision is included in master
+ has_commit(c, "master")
end
@changesets.define_singleton_method(:validated){true}
end