# HG changeset patch # User Dan Villiom Podlaski Christiansen <danchr@gmail.com> # Date 1627782723 -7200 # Sun Aug 01 03:52:03 2021 +0200 # Node ID 71073a0a3402b42cda9ec91c265473e00bf4bc6b # Parent 8ad6e6f94d12ec0a733f86acee01863d52db537f push: detect failed remote updates Dulwich silently changed its API some time ago. diff --git a/hggit/git_handler.py b/hggit/git_handler.py --- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -427,11 +427,19 @@ if not isinstance(new_refs, dict): # dulwich 0.20.6 changed the API and deprectated treating # the result as a dictionary + ref_status = new_refs.ref_status new_refs = new_refs.refs + else: + ref_status = {} for ref, new_sha in sorted(new_refs.items()): old_sha = old_refs.get(ref) - if old_sha is None: + if ref_status.get(ref) is not None: + self.ui.warn( + b'warning: failed to update %s; %s\n' % + (ref, pycompat.sysbytes(ref_status[ref])), + ) + elif old_sha is None: if self.ui.verbose: self.ui.note(b"adding reference %s::%s => GIT:%s\n" % (remote_desc, ref, new_sha[0:8])) diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -397,6 +397,7 @@ for vers in ( (0, 20, 0), (0, 20, 3), + (0, 20, 4), ) ] ) diff --git a/tests/test-push-to-head.t b/tests/test-push-to-head.t --- a/tests/test-push-to-head.t +++ b/tests/test-push-to-head.t @@ -22,13 +22,8 @@ $ cd hgrepo $ echo beta > beta $ fn_hg_commit -A -m "add beta" - $ hg push - pushing to $TESTTMP/gitrepo - searching for changes - adding objects - added 1 commits with 1 trees and 1 blobs - updating reference refs/heads/master +#if dulwich0204 The output is confusing, and this even more-so: $ hg push @@ -36,7 +31,25 @@ searching for changes adding objects added 1 commits with 1 trees and 1 blobs - updating reference refs/heads/master + warning: failed to update refs/heads/master; branch is currently checked out + + $ hg push + pushing to $TESTTMP/gitrepo + searching for changes + adding objects + added 1 commits with 1 trees and 1 blobs + warning: failed to update refs/heads/master; branch is currently checked out + +#else +This is a bit more sensible: + + $ hg push + pushing to $TESTTMP/gitrepo + searching for changes + adding objects + abort: git remote error: refs/heads/master failed to update + [255] +#endif Show that it really didn't get pushed: