diff hggit/git_handler.py @ 544:ebf4ea20ade5

outgoing: don't delete remote refs There was a bug introduced in 8c1f2b07c04b such that calling hg outgoing on a Git repository would result in all refs being deleted from the remote repository (with the possible exception of the currently checked out branch). It wasn't noticed before because the existing test for outgoing didn't actually verify the refs on the remote. This changeset fixes the bug, as well as adding test coverage to allow verifying that the fix works.
author David M. Carr <david@carrclan.us>
date Thu, 27 Sep 2012 22:32:01 -0400
parents 5a688ad69449
children 4bc39fd24db3
line wrap: on
line diff
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -240,14 +240,10 @@
             old_refs.update(refs)
             to_push = set(self.local_heads().values() + self.tags.values())
             new_refs.update(self.get_changed_refs(refs, to_push, True))
-            # don't push anything
-            return {}
+            return refs # always return the same refs to make the send a no-op
 
         try:
-            try:
-                client.send_pack(path, changed, lambda have, want: [])
-            except UpdateRefsError:
-                pass # dulwich throws an error when send_pack doesn't upload
+            client.send_pack(path, changed, lambda have, want: [])
 
             changed_refs = [ref for ref, sha in new_refs.iteritems()
                             if sha != old_refs.get(ref)]