# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1497679051 25200
#      Fri Jun 16 22:57:31 2017 -0700
# Node ID 7e2eb964a5617d25bdb19eb3e54a0c98d2c9bca6
# Parent  20fc5d39d0c1628ed04d08b4064a4fbf001f285f
exchange: switch to usual way of testing for bundle2-ness

We used safehasattr() in one place, but we use isinstance() for this
everywhere else, so switch to the latter.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1731,7 +1731,7 @@
         # 'check_heads' call wil be a no-op
         check_heads(repo, heads, 'uploading changes')
         # push can proceed
-        if not util.safehasattr(cg, 'params'):
+        if not isinstance(cg, bundle2.unbundle20):
             # legacy case: bundle1 (changegroup 01)
             with repo.lock():
                 r = cg.apply(repo, source, url)