From ec2f90b8f46fdbd06c754da58efeebfe520d4789 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Sat, 4 Nov 2023 12:47:27 +0900 Subject: [PATCH] Make the no-bundle2 check disable sending bundle2caps on getbundle --- src/hg_connect.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/hg_connect.rs b/src/hg_connect.rs index da714e288..609dac34d 100644 --- a/src/hg_connect.rs +++ b/src/hg_connect.rs @@ -587,13 +587,17 @@ pub fn get_store_bundle( heads: &[HgChangesetId], common: &[HgChangesetId], ) -> Result<(), ImmutBString> { - let bundle2caps = conn.get_capability(b"bundle2").map(|_| { - let bundle2caps = [("HG20", None), ("changegroup", Some(&["01", "02"]))]; - format!( - "HG20,bundle2={}", - percent_encode(encodecaps(bundle2caps).as_bytes(), PYTHON_QUOTE_SET) - ) - }); + let bundle2caps = if check_enabled(Checks::NO_BUNDLE2) { + None + } else { + conn.get_capability(b"bundle2").map(|_| { + let bundle2caps = [("HG20", None), ("changegroup", Some(&["01", "02"]))]; + format!( + "HG20,bundle2={}", + percent_encode(encodecaps(bundle2caps).as_bytes(), PYTHON_QUOTE_SET) + ) + }) + }; conn.getbundle(heads, common, bundle2caps.as_deref()) .and_then(|r| { let mut bundle = BundleReader::new(r).unwrap();