Patchwork exchange: switch to usual way of testing for bundle2-ness

login
register
mail settings
Submitter via Mercurial-devel
Date June 17, 2017, 5:58 a.m.
Message ID <0296f9489a0510d258ac.1497679084@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/21452/
State Accepted
Headers show

Comments

via Mercurial-devel - June 17, 2017, 5:58 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1497679051 25200
#      Fri Jun 16 22:57:31 2017 -0700
# Node ID 0296f9489a0510d258ac9ec8ea0841e0a7c4c25c
# Parent  9d472b219fb07e011c7a6255c5be47e6fc66229c
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.
Yuya Nishihara - June 18, 2017, 6:03 a.m.
On Fri, 16 Jun 2017 22:58:04 -0700, Martin von Zweigbergk via Mercurial-devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1497679051 25200
> #      Fri Jun 16 22:57:31 2017 -0700
> # Node ID 0296f9489a0510d258ac9ec8ea0841e0a7c4c25c
> # Parent  9d472b219fb07e011c7a6255c5be47e6fc66229c
> exchange: switch to usual way of testing for bundle2-ness

Sure, queued. Thanks.

Patch

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)