push: skip pristine-tar push if already present remotely
authorAntonio Terceiro <terceiro@debian.org>
Sat, 23 Apr 2022 12:02:10 +0000 (09:02 -0300)
committerGuido Günther <agx@sigxcpu.org>
Sat, 23 Apr 2022 13:49:35 +0000 (15:49 +0200)
When one is working on an older branch (stable update or backport), the
pristine-tar branch may already contain new commits after the one
corresponding to the upstream version in question.

Closes: #1001163
gbp/scripts/push.py

index d6876e269c7d2d1504b9c945879dae12ab231298..63a06a2063677361a76e6b4214fbc95160d698c9 100755 (executable)
@@ -172,8 +172,10 @@ def main(argv):
             if options.pristine_tar:
                 commit, _ = repo.get_pristine_tar_commit(source)
                 if commit:
-                    ref = 'refs/heads/pristine-tar'
-                    to_push['refs'].append((ref, get_push_src(repo, ref, commit)))
+                    target = repo.get_merge_branch('pristine-tar')
+                    if not repo.branch_contains(target, commit, remote=True):
+                        ref = 'refs/heads/pristine-tar'
+                        to_push['refs'].append((ref, get_push_src(repo, ref, commit)))
 
         if do_push(repo, [dest], to_push, dry_run=options.dryrun):
             retval = 0