Bug 5506 - bundle -t zstd fails on non-generaldelta repository
Summary: bundle -t zstd fails on non-generaldelta repository
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: bundle2 (show other bugs)
Version: 4.1.1
Hardware: All All
: wish bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-16 14:54 UTC by FUJIWARA Katsunori
Modified: 2017-04-08 00:00 UTC (History)
3 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description FUJIWARA Katsunori 2017-03-16 14:54 UTC
On long-lived repository (5.5 years or so, or one created with
usegeneraldelta=no, explicitly), "hg bundle --type zstd" fails
with error below.

    File "..../mercurial/bundle2.py", line 1320, in writebundle
      header, comp = bundletypes[bundletype]
  KeyError: 'HG10ZS'

If current repository doesn't have "generaldelta" in its
requirements, parsebundlespec() in exchange.py returns "v1" as
"appropriate bundle version".

This causes unknown bundle type name "HG10ZS" for "hg bundle
--type zstd".

This issue can be reproduced by steps below.

  $ hg --config format.usegeneraldelta=no init repo
  $ echo a > repo/a
  $ hg -R repo commit -Am '#0'
  $ hg -R repo bundle --all --type zstd bundle.zstd
Comment 1 Gregory Szorc 2017-03-16 15:04 UTC
Seems like a legit bug.

The workaround is to use `-t zstd-v2` to force a version 2 bundle.

We'll have to add some code to the bundlespec parser to automatically bump zstd bundles to v2 and error if zstd-v1 is explicitly requested.

I'll code up a patch for stable.
Comment 2 Gregory Szorc 2017-03-16 15:35 UTC
Patches on list. Marked for stable.
Comment 3 FUJIWARA Katsunori 2017-03-16 15:54 UTC
One self nit-picking.

generaldelta itself was introduced at 1.9 (= about 5.5 years before), but
"enabling it by default" was introduced at 3.7 (= about 1 years before) :-)
Comment 4 Bugzilla 2017-03-31 00:00 UTC
Bug was set to IN_PROGRESS for 14 days, moving back to confirmed
Comment 5 Gregory Szorc 2017-03-31 00:08 UTC
This was fixed in both https://www.mercurial-scm.org/repo/hg/rev/ffed3bf5cd4c and https://www.mercurial-scm.org/repo/hg/rev/10c0ee338535, which will be part of 4.1.2. I'm not sure why the bots didn't update this bug when those changesets landed.
Comment 6 Bugzilla 2017-04-08 00:00 UTC
Bug was set to TESTING for 7 days, resolving