Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: infra/services/gnumbd/gnumbd.py

Issue 424423004: Push pending tag and synthesized commit in a single git push operation. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « infra/libs/git2/test/repo_test.py ('k') | infra/services/gnumbd/test/gnumbd_test.expected/branch.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra/services/gnumbd/gnumbd.py
diff --git a/infra/services/gnumbd/gnumbd.py b/infra/services/gnumbd/gnumbd.py
index 6d37719a2e530dd714441df010d1ffee4c364d03..4e9703ae9c4fa539748a1dd782ab0b04a6825e78 100644
--- a/infra/services/gnumbd/gnumbd.py
+++ b/infra/services/gnumbd/gnumbd.py
@@ -262,7 +262,7 @@ def get_new_commits(real_ref, pending_tag, pending_tip):
new_tag_val.hsh, real_ref.commit.hsh)
return []
new_commits = new_commits[i:]
- pending_tag.fast_forward_push(new_tag_val)
+ pending_tag.repo.fast_forward_push({pending_tag: new_tag_val})
if not new_commits:
LOGGER.warn('Tag was lagging for %r by %d, but no new commits are pending',
@@ -302,18 +302,21 @@ def process_ref(real_ref, pending_tag, new_commits, clock=time):
# TODO(iannucci): The ACL rejection message for the real ref should point
# users to the pending ref.
assert content_of(pending_tag.commit) == content_of(real_ref.commit)
+ assert real_ref.repo == pending_tag.repo
+ repo = real_ref.repo
real_parent = real_ref.commit
for commit in new_commits:
assert content_of(commit.parent) == content_of(real_parent)
synth_commit = synthesize_commit(commit, real_parent, real_ref, clock)
- # TODO(iannucci): do multi-ref atomic push here.
- logging.info('Pushing synthesized commit %r for %r', synth_commit.hsh,
- commit.hsh)
- real_ref.fast_forward_push(synth_commit)
+ logging.info(
+ 'Pushing synthesized commit %r for %r and pending_tag %r',
+ synth_commit.hsh, commit.hsh, pending_tag)
+ repo.fast_forward_push({
+ real_ref: synth_commit,
+ pending_tag: commit,
+ })
- logging.debug('Pushing pending_tag %r', pending_tag)
- pending_tag.fast_forward_push(commit)
real_parent = synth_commit
« no previous file with comments | « infra/libs/git2/test/repo_test.py ('k') | infra/services/gnumbd/test/gnumbd_test.expected/branch.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698