Patchwork [1,of,2] localrepo: reuse exchange.bundle2requested()

login
register
mail settings
Submitter via Mercurial-devel
Date May 3, 2017, 5:44 p.m.
Message ID <bf2a70b5c015ff072057.1493833488@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/20408/
State Accepted
Headers show

Comments

via Mercurial-devel - May 3, 2017, 5:44 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1493832806 25200
#      Wed May 03 10:33:26 2017 -0700
# Node ID bf2a70b5c015ff0720571c4512d67eb53f52b85e
# Parent  5f8450df55625fb0be8e40eacb662717fef33de2
localrepo: reuse exchange.bundle2requested()

It seems like localrepo.getbundle() is trying to do the same thing, so
let's just call the method. That way we get the same condition as
there (matching any "HG2" prefix, not only "HG20").

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -164,7 +164,7 @@ 
                                           **kwargs)
         cb = util.chunkbuffer(chunks)
 
-        if bundlecaps is not None and 'HG20' in bundlecaps:
+        if exchange.bundle2requested(bundlecaps):
             # When requesting a bundle2, getbundle returns a stream to make the
             # wire level function happier. We need to build a proper object
             # from it in local peer.