diff mbox series

[pushed] contrib: run fetch before pushing Daily bump

Message ID 29487d53-ef09-764b-cbd0-0fa09f459fc3@suse.cz
State New
Headers show
Series [pushed] contrib: run fetch before pushing Daily bump | expand

Commit Message

Martin Liška Oct. 5, 2022, 6:41 p.m. UTC
As seen from recent days, the script fails when it pushes
a branch while another revision was pushed by a user.
Prevent that by doing fetch right before the pull.

The error message example:

cmdline: git push origin releases/gcc-11
stderr: 'fatal: unable to parse object: 4249a65c814287af667aa78789436d3fc618e80a
error: remote unpack failed: eof before pack header was fully read

I'm going to push the change and let's see if it mitigates the problem.

Martin

contrib/ChangeLog:

	* gcc-changelog/git_update_version.py: Do fetch before a push.
---
 contrib/gcc-changelog/git_update_version.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Tobias Burnus Oct. 5, 2022, 8:09 p.m. UTC | #1
On 05.10.22 20:41, Martin Liška wrote:
> +++ b/contrib/gcc-changelog/git_update_version.py
> @@ -127,6 +127,7 @@ def update_current_branch(ref_name):
>               repo.git.add(datestamp_path)
>               if not args.current:
>                   repo.index.commit('Daily bump.')
> +                origin.fetch()
>                   if args.push:
>                       repo.git.push('origin', branch)
>                       print('branch is pushed')

Don't you need a 'rebase' in addition? Or alternately – putting 'fetch'
before 'commit' and then 'merge' would be alternately possible.

Tobias

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
Martin Liška Oct. 6, 2022, 9:13 a.m. UTC | #2
On 10/5/22 22:09, Tobias Burnus wrote:
> On 05.10.22 20:41, Martin Liška wrote:
>> +++ b/contrib/gcc-changelog/git_update_version.py
>> @@ -127,6 +127,7 @@ def update_current_branch(ref_name):
>>               repo.git.add(datestamp_path)
>>               if not args.current:
>>                   repo.index.commit('Daily bump.')
>> +                origin.fetch()
>>                   if args.push:
>>                       repo.git.push('origin', branch)
>>                       print('branch is pushed')
> 
> Don't you need a 'rebase' in addition?

Well, no, because that would mean the script won't generate a ChangeLog entry for some commits.

> Or alternately – putting 'fetch'
> before 'commit' and then 'merge' would be alternately possible.

Well, the window is pretty small, in between 'git pull' and processing the ChangeLog entries
it should take only a few seconds before a push is done.

Anyway, it failed today again, let me add more robust logging.

Martin

> 
> Tobias
> 
> -----------------
> Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
diff mbox series

Patch

diff --git a/contrib/gcc-changelog/git_update_version.py b/contrib/gcc-changelog/git_update_version.py
index 05a9f7e402d..8462179b5ab 100755
--- a/contrib/gcc-changelog/git_update_version.py
+++ b/contrib/gcc-changelog/git_update_version.py
@@ -127,6 +127,7 @@  def update_current_branch(ref_name):
             repo.git.add(datestamp_path)
             if not args.current:
                 repo.index.commit('Daily bump.')
+                origin.fetch()
                 if args.push:
                     repo.git.push('origin', branch)
                     print('branch is pushed')
@@ -149,7 +150,7 @@  else:
             print('=== Working on: %s ===' % branch, flush=True)
             branch.checkout()
             origin.pull(rebase=True)
-            print('branch pulled and checked out')
+            print('branch pulled and checked out', flush=True)
             update_current_branch(name)
             assert not repo.index.diff(None)
             print('branch is done\n', flush=True)