Commit Graph

15 Commits

Author SHA1 Message Date
timeless
dd077e79ae bundle: use single quotes in use warning 2016-09-20 23:46:15 +00:00
Gregory Szorc
4ad5f2e492 bundle2: store changeset count when creating file bundles
The bundle2 changegroup part has an advisory param saying how many
changesets are in the part. Before this patch, we were setting
this part when generating bundle2 parts via the wire protocol but
not when generating local bundle2 files.

A side effect of not setting the changeset count part is that progress
bars don't work when applying changesets. As the tests show, this
impacted clone bundles, shelve, backup bundles, `hg unbundle`, and
anything touching bundle2 files.

This patch adds a backdoor to allow us to pass state from
changegroup generation into the unbundler. We store the number
of changesets in the changegroup in this state and use it to
populate the aforementioned advisory part parameter when generating
the bundle2 bundle.

I concede that I'm not thrilled by how state is being passed in
changegroup.py (it feels a bit hacky). I would love to overhaul the
rather confusing set of functions in changegroup.py with something that
passes rich objects around instead of e.g. low-level generators.
However, given the code freeze for 3.9 is imminent, I'd rather not
undertake this endeavor right now. This feels like the easiest way
to get the parameter added to the changegroup part.
2016-07-17 15:13:51 -07:00
Gregory Szorc
f5105c6a41 util: implement a deterministic __repr__ on sortdict
`hg debugbundle` is calling repr() on bundle2 part params, which are
now util.sortdict instances. Unfortunately, repr() doesn't appear
to be deterministic for util.sortdict. So, we implement one.

We include the type name because that's the common convention for
__repr__ implementations. Having the type name in `hg debugbundle`
is a bit ugly. But it's a debug command and I don't care enough to
fix it.
2016-07-17 15:10:30 -07:00
Gregory Szorc
3a890f3e32 commands: teach debugbundle to print bundle specification
This seems like the most logical place to put this functionality.

Test coverage over existing known bundle specs has been added.
2016-01-14 22:57:55 -08:00
Pierre-Yves David
0341332573 test: use generaldelta in 'test-bundle-type.t'
Generaldelta changes some of the default targets for 'hg bundle'. All cases are
already properly tested but some ambiguous specifications are affected.
2015-10-20 11:48:49 +02:00
Danek Duvall
d23d8113a8 test: test-bundle-type.t needs to work more universally
The cut and head utilities on Solaris have weird differences from the GNU
versions.  The f helper script does a dump more nicely than those tools,
anyway.
2015-11-10 09:58:10 -08:00
Gregory Szorc
c55df1f741 exchange: refactor bundle specification parsing
The old code was tailored to `hg bundle` usage and not appropriate for
use as a general API, which clone bundles will require. The code has
been rewritten to make it more generally suitable.

We introduce dedicated error types to represent invalid and unsupported
bundle specifications. The reason we need dedicated error types (rather
than error.Abort) is because clone bundles will want to catch these
exception as part of filtering entries. We don't want to swallow
error.Abort on principle.
2015-10-13 10:57:54 -07:00
Pierre-Yves David
11cc1a1216 getsubset: get the unpacker version from the bundler
The current setup requires to pass both a packer and, optionally, the version
of the unpacker. This is confusing and error prone as the two value cannot
mismatch. Instead, we simply grab the version from the packer. This fixes a bug
where requesting a cg2 from 'hg bundle' were reported as changegroup 1.

I should have caught that in the initial changeset but I missed it somehow.
2015-10-09 14:59:37 -07:00
Pierre-Yves David
8f390ad0b6 bundle: extend the format of --type to support version and compression
We had some basic undocumented support for uncompressed bundle2 support. We now
have an official extensible syntax to specify both format type and compression
(eg: bzip2-v2).

In practice, this changeset introduce the 'v1' and 'v2' identifier to make it
possible to combine format and compression. The default format is still 'v1'.
We'll care about picking 'v1' or 'v2' in regard with general delta in the next
changesets.
2015-10-01 19:16:00 -07:00
Pierre-Yves David
50e5ae9a7a test-bundle-type: replace unbundle with debugbundle
We now have a convenient command to look at bundle contents, let's use
it.
2015-10-01 20:15:00 -07:00
Thomas Arendsen Hein
498dfaa7d6 pull: print "pulling from foo" before accessing the other repo
1. This is consistent with pushing.
2. This allows to see the URL of the other repo in case accessing the repo
   fails, e.g. wrong ssh path or issues with the https certificate, without
   using --debug or showconfig paths.

Additionally add test for this in the context of ssh with a wrong path.
2015-02-24 10:55:24 +01:00
Bryan O'Sullivan
9b32b66805 commands: move bundle type validation earlier
Checking the bundle type late in the command's execution can mean
that we do work for a long time before complaining about incorrect
user input and aborting.  Guess how I discovered this.
2012-04-13 11:01:07 -07:00
Matt Mackall
08439e0f2d tests: add exit codes to unified tests 2010-09-16 17:51:32 -05:00
Matt Mackall
60627b799a bundlerepo: remove duplication of bundle decompressors 2010-08-25 16:55:54 -05:00
Martin Geisler
9e6d9afbda tests: unify test-bundle-type 2010-08-14 03:23:56 +02:00